Skip to content

Commit 3d155e1

Browse files
committed
Adding intermediate wrap_our_vprintf wrapper to allow for the va_list to be properly setup before calling our_vprintf. Also fixed some code formatting.
1 parent 35471ea commit 3d155e1

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

mono/eglib/goutput.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -276,23 +276,31 @@ g_set_printerr_handler (GPrintFunc func)
276276
return old;
277277
}
278278

279+
void wrap_our_vprintf(const gchar *format, ...)
280+
{
281+
va_list args;
282+
va_start (args, format);
283+
our_vprintf (format, args);
284+
va_end (args);
285+
}
286+
279287
static void
280288
unity_vprintf_GPrintFunc_adapter (const gchar *string)
281289
{
282-
our_vprintf("%s", string);
290+
wrap_our_vprintf ("%s", string);
283291
}
284292

285293
static void
286294
unity_vprintf_GLogFunc_adapter (const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer user_data)
287295
{
288-
our_vprintf("%s", message);
296+
wrap_our_vprintf ("%s", message);
289297
}
290298

291299
// Redirect all stdout output to unity vprintf function
292300
void set_vprintf_func(vprintf_func func)
293301
{
294302
our_vprintf = func;
295-
g_set_print_handler(unity_vprintf_GPrintFunc_adapter);
296-
g_log_set_default_handler(unity_vprintf_GLogFunc_adapter, NULL);
303+
g_set_print_handler (unity_vprintf_GPrintFunc_adapter);
304+
g_log_set_default_handler (unity_vprintf_GLogFunc_adapter, NULL);
297305
}
298306

0 commit comments

Comments
 (0)