Skip to content

Commit c740aa0

Browse files
committed
Fix zero-length gnu_printf format string warning
``` src/quickjs/quickjs.c: In function ‘JS_ReadString’: src/quickjs/quickjs.c:34274:26: warning: zero-length gnu_printf format string [-Wformat-zero-length] 34274 | bc_read_trace(s, ""); // hex dump and indentation | ^~ src/quickjs/quickjs.c: In function ‘JS_ReadFunctionBytecode’: src/quickjs/quickjs.c:34334:30: warning: zero-length gnu_printf format string [-Wformat-zero-length] 34334 | bc_read_trace(s, ""); // hex dump + indent ``` Ref: #502
1 parent ad834a1 commit c740aa0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

quickjs.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -6529,7 +6529,7 @@ static void build_backtrace(JSContext *ctx, JSValue error_obj,
65296529
line_num1 = find_line_num(ctx, b,
65306530
sf->cur_pc - b->byte_code_buf - 1,
65316531
&col_num1);
6532-
atom_str = JS_AtomToCString(ctx, b->filename);
6532+
atom_str = b->filename ? JS_AtomToCString(ctx, b->filename) : NULL;
65336533
dbuf_printf(&dbuf, " (%s", atom_str ? atom_str : "<null>");
65346534
JS_FreeCString(ctx, atom_str);
65356535
if (line_num1 != -1)

0 commit comments

Comments
 (0)