commit 556ae5103bc7a5ee0f11ee275c22ebba1dcc67df
parent 27d7e12d8a29f12c7cdbf396bbeda793447fb369
Author: Bor Grošelj Simić <bor.groseljsimic@telemach.net>
Date: Wed, 15 Dec 2021 05:07:46 +0100
emit.c: fix a bug with unprintable chars in strings
A double comma was emitted if the string ended with something
unprintable.
Signed-off-by: Bor Grošelj Simić <bor.groseljsimic@telemach.net>
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/emit.c b/src/emit.c
@@ -241,7 +241,7 @@ emit_data_string(const char *str, size_t sz, FILE *out)
q = false;
fprintf(out, "\", ");
}
- fprintf(out, "b %d, ", str[i]);
+ fprintf(out, "b %d%s", str[i], i + 1 < sz ? ", " : "");
} else {
if (!q) {
q = true;