Skip to content

Commit 16e7acc

Browse files
committed
fixup!
1 parent a8a567f commit 16e7acc

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

qjs.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,18 @@ extern const uint32_t qjsc_repl_size;
4848
extern const uint8_t qjsc_standalone[];
4949
extern const uint32_t qjsc_standalone_size;
5050

51+
// Must match standalone.js
52+
#define TRAILER_SIZE 12
53+
static const char trailer_magic[] = "quickjs2";
54+
static const int trailer_magic_size = sizeof(trailer_magic) - 1;
55+
static const int trailer_size = TRAILER_SIZE;
56+
5157
static int qjs__argc;
5258
static char **qjs__argv;
5359

5460

5561
static BOOL is_standalone(const char *exe)
5662
{
57-
// Must match standalone.js
58-
static const char trailer_magic[] = "quickjs2";
59-
static const int trailer_magic_size = sizeof(trailer_magic) - 1;
60-
static const int trailer_size = 12; /* 8 bytes for the trailer magic + 4 bytes for the offset. */
61-
6263
FILE *exe_f = fopen(exe, "rb");
6364
if (!exe_f) {
6465
perror(exe);
@@ -67,7 +68,7 @@ static BOOL is_standalone(const char *exe)
6768
if (fseek(exe_f, -trailer_size, SEEK_END) < 0) {
6869
exit(1);
6970
}
70-
uint8_t buf[trailer_size];
71+
uint8_t buf[TRAILER_SIZE];
7172
if (fread(buf, 1, trailer_size, exe_f) != trailer_size) {
7273
perror("fread exe trailer");
7374
exit(1);

0 commit comments

Comments
 (0)