From 9badfb304098672061a0b17d8d86ce696e7c13b6 Mon Sep 17 00:00:00 2001 From: Epochryphon Date: Sun, 28 Jun 2026 21:52:49 -0500 Subject: [PATCH] changes global variable to static --- source_code/new_log.c | 36 ++++++++++++++++++------------------ source_code/new_log.h | 2 +- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/source_code/new_log.c b/source_code/new_log.c index 79ed130..233c03b 100644 --- a/source_code/new_log.c +++ b/source_code/new_log.c @@ -46,14 +46,14 @@ struct callback_struct } callback_type; -static struct global_log_data_struct +static struct static_log_data_struct { void *user_data; lock_function lock; int severity_level; bool quiet; callback_type callbacks[MAX_CALLBACKS]; -} global_log_data_struct; +} static_log_data_struct; static const char * @@ -147,10 +147,10 @@ file_callback(log_event_type *event) static void lock(void) { - if (global_log_data_struct.lock) + if (static_log_data_struct.lock) { - global_log_data_struct.lock(true, - global_log_data_struct.user_data); + static_log_data_struct.lock(true, + static_log_data_struct.user_data); } } @@ -158,10 +158,10 @@ lock(void) static void unlock(void) { - if (global_log_data_struct.lock) + if (static_log_data_struct.lock) { - global_log_data_struct.lock(false, - global_log_data_struct.user_data); + static_log_data_struct.lock(false, + static_log_data_struct.user_data); } } @@ -177,22 +177,22 @@ void log_set_lock(lock_function function, void *user_data) { - global_log_data_struct.lock = function; - global_log_data_struct.user_data = user_data; + static_log_data_struct.lock = function; + static_log_data_struct.user_data = user_data; } void log_set_level(int severity_level) { - global_log_data_struct.severity_level = severity_level; + static_log_data_struct.severity_level = severity_level; } void log_set_quiet(bool should_be_quiet) { - global_log_data_struct.quiet = should_be_quiet; + static_log_data_struct.quiet = should_be_quiet; } @@ -203,12 +203,12 @@ log_add_callback(log_function function, { for (int i = 0; i < MAX_CALLBACKS; i++) { - if (global_log_data_struct.callbacks[i].function) + if (static_log_data_struct.callbacks[i].function) { continue; } - global_log_data_struct.callbacks[i] = (callback_type) + static_log_data_struct.callbacks[i] = (callback_type) { function, user_data, @@ -260,8 +260,8 @@ log_log(int severity_level, lock(); - if (!global_log_data_struct.quiet - && severity_level >= global_log_data_struct.severity_level) + if (!static_log_data_struct.quiet + && severity_level >= static_log_data_struct.severity_level) { init_event(&event, stderr); @@ -274,10 +274,10 @@ log_log(int severity_level, } for (int i = 0; i < MAX_CALLBACKS - && global_log_data_struct.callbacks[i].function; + && static_log_data_struct.callbacks[i].function; i++) { - callback_type *callback_pointer = &global_log_data_struct.callbacks[i]; + callback_type *callback_pointer = &static_log_data_struct.callbacks[i]; if (severity_level >= callback_pointer->severity_level) { init_event(&event, diff --git a/source_code/new_log.h b/source_code/new_log.h index 84c5413..1f1c9d0 100644 --- a/source_code/new_log.h +++ b/source_code/new_log.h @@ -16,7 +16,7 @@ #include #include -#define LOG_VERSION "r:180.26.1" +#define LOG_VERSION "r:2.26.180.1" typedef struct log_event_struct