diff options
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/plugin-int.h | 2 | ||||
-rw-r--r-- | src/plugins/plugin.c | 36 |
2 files changed, 8 insertions, 30 deletions
diff --git a/src/plugins/plugin-int.h b/src/plugins/plugin-int.h index ee7c442..03040d1 100644 --- a/src/plugins/plugin-int.h +++ b/src/plugins/plugin-int.h @@ -33,7 +33,7 @@ #include "plugin-def.h" #include "../analysis/content.h" #include "../common/bits.h" -#include "../gui/panels/log.h" +#include "../core/logs.h" diff --git a/src/plugins/plugin.c b/src/plugins/plugin.c index 3d1350d..d1e90c8 100644 --- a/src/plugins/plugin.c +++ b/src/plugins/plugin.c @@ -664,43 +664,21 @@ void g_plugin_module_log_simple_message(const GPluginModule *plugin, LogMessageT void g_plugin_module_log_variadic_message(const GPluginModule *plugin, LogMessageType type, const char *fmt, ...) { - size_t len; /* Taille tampon disponible */ - char *buffer; /* Tampon du msg reconstitué */ - int ret; /* Bilan d'une impression */ - char *ptr; /* Nouvelle allocation */ va_list ap; /* Liste d'arguments variable */ + char *buffer; /* Tampon du msg reconstitué */ - len = VARIADIC_LOG_BUFSIZE; - buffer = calloc(len, sizeof(char)); + va_start(ap, fmt); + buffer = build_variadic_message(fmt, ap); + va_end(ap); - while (buffer != NULL) + if (buffer != NULL) { - va_start(ap, fmt); - ret = vsnprintf(buffer, len, fmt, ap); - va_end(ap); - - if (ret >= 0 && ret < len) break; - - else - { - if (ret > -1) len += 1; /* glibc 2.1 */ - else len *= 2; /* glibc 2.0 */ + g_plugin_module_log_simple_message(plugin, type, buffer); - if ((ptr = realloc(buffer, len)) == NULL) - { - free(buffer); - buffer = NULL; - } - else buffer = ptr; - - } + free(buffer); } - g_plugin_module_log_simple_message(plugin, type, buffer); - - free(buffer); - } |