From f53506a723cddf308455bc7d509d84c4b6aab43e Mon Sep 17 00:00:00 2001 From: Felix Brendel Date: Wed, 14 Oct 2020 10:05:13 +0200 Subject: [PATCH] activated system shutdown hook again, line_label macro --- hooks.hpp | 14 +++++++------- macros.hpp | 1 + types.hpp | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/hooks.hpp b/hooks.hpp index 1552399..08d8b19 100644 --- a/hooks.hpp +++ b/hooks.hpp @@ -75,10 +75,10 @@ struct Hook : Array_List> { } }; -// struct __System_Shutdown_Hook : Hook { -// void operator()() = delete; -// ~__System_Shutdown_Hook() { -// Hook::operator()(); -// dealloc(); -// } -// } system_shutdown_hook; +struct __System_Shutdown_Hook : Hook { + void operator()() = delete; + ~__System_Shutdown_Hook() { + Hook::operator()(); + dealloc(); + } +} system_shutdown_hook; diff --git a/macros.hpp b/macros.hpp index 1603d7c..94f8ac7 100644 --- a/macros.hpp +++ b/macros.hpp @@ -4,6 +4,7 @@ #define proc auto #define concat(x, y) x ## y #define label(x, y) concat(x, y) +#define line_label(x) label(x, __LINE__) /** diff --git a/types.hpp b/types.hpp index 675ae40..83e69a7 100644 --- a/types.hpp +++ b/types.hpp @@ -35,7 +35,7 @@ struct StringSlice { inline auto make_heap_string(const char* str) -> String { String ret; ret.length = strlen(str); - ret.data = strdup(str); + ret.data = _strdup(str); return ret; }