Skip to content

Commit fe031a8

Browse files
committed
Fix 'duk' bytecode loading
1 parent 3595ccc commit fe031a8

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

examples/cmdline/duk_cmdline.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,9 @@ static duk_ret_t wrapped_compile_execute(duk_context *ctx, void *udata) {
239239

240240
if (src_data != NULL && src_len >= 2 && src_data[0] == (char) 0xff) {
241241
/* Bytecode. */
242-
duk_push_lstring(ctx, src_data, src_len);
243-
duk_to_buffer(ctx, -1, NULL);
242+
void *buf;
243+
buf = duk_push_fixed_buffer(ctx, src_len);
244+
memcpy(buf, (const void *) src_data, src_len);
244245
duk_load_function(ctx);
245246
} else {
246247
/* Source code. */

0 commit comments

Comments
 (0)