diff options
author | Tom Smeding <tom.smeding@gmail.com> | 2020-07-13 22:08:04 +0200 |
---|---|---|
committer | Tom Smeding <tom.smeding@gmail.com> | 2020-07-13 22:08:04 +0200 |
commit | 61b283f2e9a8343267ffd0280bacc1369075b763 (patch) | |
tree | f94f98204136ee213c7b9c3d7d6589f48040d3bc /weechat | |
parent | 84d31554ecf6840905e18aef33ef7a195174f800 (diff) |
weechat: Proper namespacing of symbols
Symbol clash in dynamic libraries is a thing.
Diffstat (limited to 'weechat')
-rw-r--r-- | weechat/debug.c | 20 | ||||
-rw-r--r-- | weechat/debug.h | 6 | ||||
-rw-r--r-- | weechat/net.h | 6 |
3 files changed, 22 insertions, 10 deletions
diff --git a/weechat/debug.c b/weechat/debug.c index c0353da..dbd1d91 100644 --- a/weechat/debug.c +++ b/weechat/debug.c @@ -5,7 +5,7 @@ #include "debug.h" -static FILE *g_dfile; +static FILE *tomsg_dfile; void debug_init(void) { const char *home = getenv("HOME"); @@ -17,28 +17,30 @@ void debug_init(void) { if (!fname) return; // okay, fine, no debug file sprintf(fname, "%s%s", home, suffix); - g_dfile = fopen(fname, "a"); - if (!g_dfile) { - g_dfile = NULL; + tomsg_dfile = fopen(fname, "a"); + if (!tomsg_dfile) { + tomsg_dfile = NULL; return; // fine! } + free(fname); + // Disable buffering - setvbuf(g_dfile, NULL, _IONBF, 0); + setvbuf(tomsg_dfile, NULL, _IONBF, 0); - fprintf(g_dfile, "--------\n"); + fprintf(tomsg_dfile, "--------\n"); } void debug_deinit(void) { - if (g_dfile) fclose(g_dfile); + if (tomsg_dfile) fclose(tomsg_dfile); } __attribute__((format (printf, 1, 2))) void debugf(const char *restrict format, ...) { - if (!g_dfile) return; + if (!tomsg_dfile) return; va_list ap; va_start(ap, format); - vfprintf(g_dfile, format, ap); + vfprintf(tomsg_dfile, format, ap); va_end(ap); } diff --git a/weechat/debug.h b/weechat/debug.h index 95117a9..d552010 100644 --- a/weechat/debug.h +++ b/weechat/debug.h @@ -1,8 +1,12 @@ #pragma once -void debug_init(void); +#define debug_init tomsg__debug_init +#define debug_deinit tomsg__debug_deinit +#define debugf tomsg__debugf + +void debug_init(void); void debug_deinit(void); __attribute__((format (printf, 1, 2))) diff --git a/weechat/net.h b/weechat/net.h index 7f4e9da..63636e7 100644 --- a/weechat/net.h +++ b/weechat/net.h @@ -4,6 +4,12 @@ #include "global.h" +#define net_set_push_callback tomsg__net_set_push_callback +#define net_set_history_callback tomsg__net_set_history_callback +#define net_sendf tomsg__net_sendf +#define net_handle_recv tomsg__net_handle_recv + + enum net_response_type{ NET_OK, // - NET_NUMBER, // number |