Speed up qstr loading by using the stack to store a temporary

string instead of the heap.
This commit is contained in:
Scott Shawcroft 2018-01-23 15:59:26 -08:00
parent 6560596864
commit 56bd0789af

View File

@ -124,10 +124,9 @@ STATIC size_t read_uint(mp_reader_t *reader) {
STATIC qstr load_qstr(mp_reader_t *reader) { STATIC qstr load_qstr(mp_reader_t *reader) {
size_t len = read_uint(reader); size_t len = read_uint(reader);
char *str = m_new(char, len); char str[len];
read_bytes(reader, (byte*)str, len); read_bytes(reader, (byte*)str, len);
qstr qst = qstr_from_strn(str, len); qstr qst = qstr_from_strn(str, len);
m_del(char, str, len);
return qst; return qst;
} }