Permalink
Browse files

Don't use vasprintf on PLATFORM_ANDROID.

This allows sanely using g_log() within signal handlers.
  • Loading branch information...
1 parent 6870a59 commit d703e86b4b32802383ccd40776b79fef294b7a0b @jonpryor jonpryor committed Aug 30, 2011
Showing with 7 additions and 9 deletions.
  1. +7 −9 eglib/src/goutput.c
View
@@ -112,28 +112,26 @@ g_log_set_fatal_mask (const gchar *log_domain, GLogLevelFlags fatal_mask)
void
g_logv (const gchar *log_domain, GLogLevelFlags log_level, const gchar *format, va_list args)
{
+#if PLATFORM_ANDROID
+ __android_log_vprint (to_android_priority (log_level), log_domain, format, args);
+#else
char *msg;
vasprintf (&msg, format, args);
-#if PLATFORM_ANDROID
- __android_log_print (to_android_priority (log_level),
- /* TODO: provide a proper app name */
- "mono", "%s%s%s",
- log_domain != NULL ? log_domain : "",
- log_domain != NULL ? ": " : "",
- msg);
-#else
printf ("%s%s%s\n",
log_domain != NULL ? log_domain : "",
log_domain != NULL ? ": " : "",
msg);
-#endif
free (msg);
if (log_level & fatal){
fflush (stdout);
fflush (stderr);
abort ();
}
+#endif
+ if (log_level & fatal){
+ abort ();
+ }
}
void

0 comments on commit d703e86

Please sign in to comment.