allow dumping of empty buffer

This commit is contained in:
Frank Morgner
2013-02-26 01:03:09 +01:00
parent db088810ff
commit 00d160b77a

View File

@@ -95,11 +95,11 @@ void _bin_log(sc_context_t *ctx, int type, const char *file, int line,
else else
buf[0] = 0; buf[0] = 0;
sc_do_log(ctx, type, file, line, func, sc_do_log(ctx, type, file, line, func,
"\n%s (%u byte%s):\n%s", "\n%s (%u byte%s)%s%s",
label, (unsigned int) len, len==1?"":"s", buf); label, (unsigned int) len, len==1?"":"s", len==0?"":":\n", buf);
} else { } else {
fprintf(f, "%s (%u byte%s):\n%s\n", fprintf(f, "%s (%u byte%s)%s%s\n",
label, (unsigned int) len, len==1?"":"s", sc_dump_hex(data, len)); label, (unsigned int) len, len==1?"":"s", len==0?"":":\n", sc_dump_hex(data, len));
} }
} }