Skip to content

Commit 0992588

Browse files
committed
py/frozenmod: Make frozen module content be 0-terminated.
To allow simple zero-terminated lexers.
1 parent ed584e2 commit 0992588

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

py/frozenmod.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ mp_lexer_t *mp_find_frozen_module(const char *str, int len) {
4646
mp_lexer_t *lex = mp_lexer_new_from_str_len(MP_QSTR_, s, *sz_ptr, 0);
4747
return lex;
4848
}
49-
s += l + 1 + *sz_ptr++;
49+
s += (l + 1) + (*sz_ptr++ + 1);
5050
}
5151
return NULL;
5252
}

tools/make-frozen.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,5 +55,5 @@ def module_name(f):
5555
data = data[1:]
5656
data = data[1:-1]
5757
data = data.replace('"', '\\"')
58-
print('"%s"' % data)
58+
print('"%s\\0"' % data)
5959
print("};")

0 commit comments

Comments
 (0)