summaryrefslogtreecommitdiff
path: root/src/plugins/plugin.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/plugin.c')
-rw-r--r--src/plugins/plugin.c36
1 files changed, 7 insertions, 29 deletions
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);
-
}