提交 d7bba01a 编写于 作者: B Behdad Esfahbod

Only print class name in debug output if there's one available

上级 85f73fa8
...@@ -514,8 +514,6 @@ _hb_debug_msg_va (const char *what, ...@@ -514,8 +514,6 @@ _hb_debug_msg_va (const char *what,
if (!_hb_debug (level, max_level)) if (!_hb_debug (level, max_level))
return; return;
static const char bars[] = "││││││││││││││││││││││││││││││││││││││││";
fprintf (stderr, "%-10s", what ? what : ""); fprintf (stderr, "%-10s", what ? what : "");
if (obj) if (obj)
...@@ -523,19 +521,23 @@ _hb_debug_msg_va (const char *what, ...@@ -523,19 +521,23 @@ _hb_debug_msg_va (const char *what,
else else
fprintf (stderr, " %*s ", (unsigned int) (2 * sizeof (void *)), ""); fprintf (stderr, " %*s ", (unsigned int) (2 * sizeof (void *)), "");
if (indented) if (indented) {
static const char bars[] = "││││││││││││││││││││││││││││││││││││││││";
fprintf (stderr, "%2d %s├%s", fprintf (stderr, "%2d %s├%s",
level, level,
bars + sizeof (bars) - 1 - MIN ((unsigned int) sizeof (bars), 3 * level), bars + sizeof (bars) - 1 - MIN ((unsigned int) sizeof (bars), 3 * level),
level_dir ? (level_dir > 0 ? "╮" : "╯") : "╴"); level_dir ? (level_dir > 0 ? "╮" : "╯") : "╴");
else } else
fprintf (stderr, " ├╴"); fprintf (stderr, " ├╴");
if (func) { if (func) {
/* If there's a class name, just write that. */ /* If there's a class name, just write that. */
const char *dotdot = strstr (func, "::"); const char *dotdot = strstr (func, "::");
const char *space = strchr (func, ' ');
if (space && dotdot && space < dotdot)
func = space + 1;
unsigned int func_len = dotdot ? dotdot - func : strlen (func); unsigned int func_len = dotdot ? dotdot - func : strlen (func);
fprintf (stderr, "%*s: ", func_len, func); fprintf (stderr, "%.*s: ", func_len, func);
} }
if (message) if (message)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册