Only printout class name in tracing, if one is available
authorBehdad Esfahbod <behdad@behdad.org>
Fri, 11 May 2012 00:40:42 +0000 (02:40 +0200)
committerBehdad Esfahbod <behdad@behdad.org>
Fri, 11 May 2012 00:40:42 +0000 (02:40 +0200)
Makes debug output much more pleasant.

src/hb-private.hh

index dd2c465..1f7ba11 100644 (file)
@@ -531,8 +531,12 @@ _hb_debug_msg_va (const char *what,
   else
     fprintf (stderr, "   ├╴");
 
-  if (func)
-    fprintf (stderr, "%s: ", func);
+  if (func) {
+    /* If there's a class name, just write that. */
+    const char *dotdot = strstr (func, "::");
+    unsigned int func_len = dotdot ? dotdot - func : strlen (func);
+    fprintf (stderr, "%*s: ", func_len, func);
+  }
 
   if (message)
     vfprintf (stderr, message, ap);