Skip to content
Snippets Groups Projects
Commit 09925888 authored by Paul Sokolovsky's avatar Paul Sokolovsky
Browse files

py/frozenmod: Make frozen module content be 0-terminated.

To allow simple zero-terminated lexers.
parent ed584e2f
No related branches found
No related tags found
No related merge requests found
...@@ -46,7 +46,7 @@ mp_lexer_t *mp_find_frozen_module(const char *str, int len) { ...@@ -46,7 +46,7 @@ mp_lexer_t *mp_find_frozen_module(const char *str, int len) {
mp_lexer_t *lex = mp_lexer_new_from_str_len(MP_QSTR_, s, *sz_ptr, 0); mp_lexer_t *lex = mp_lexer_new_from_str_len(MP_QSTR_, s, *sz_ptr, 0);
return lex; return lex;
} }
s += l + 1 + *sz_ptr++; s += (l + 1) + (*sz_ptr++ + 1);
} }
return NULL; return NULL;
} }
......
...@@ -55,5 +55,5 @@ for f, st in modules: ...@@ -55,5 +55,5 @@ for f, st in modules:
data = data[1:] data = data[1:]
data = data[1:-1] data = data[1:-1]
data = data.replace('"', '\\"') data = data.replace('"', '\\"')
print('"%s"' % data) print('"%s\\0"' % data)
print("};") print("};")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment