Allocate memory for string literals and identifiers dinamically.
This commit is contained in:
@@ -72,6 +72,10 @@ deserializer_init (void)
|
||||
void
|
||||
deserializer_free (void)
|
||||
{
|
||||
if (bytecode_data.strs_count > 0)
|
||||
{
|
||||
mem_heap_free_block ((uint8_t *) bytecode_data.strings[0].str);
|
||||
}
|
||||
mem_heap_free_block ((uint8_t *) bytecode_data.strings);
|
||||
mem_heap_free_block ((uint8_t *) bytecode_data.nums);
|
||||
mem_heap_free_block ((uint8_t *) bytecode_data.opcodes);
|
||||
|
||||
@@ -108,18 +108,6 @@ serializer_print_opcodes (void)
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Make lp_strings also zero-terminated. */
|
||||
void
|
||||
serializer_adjust_strings (void)
|
||||
{
|
||||
for (uint8_t i = 0; i < bytecode_data.strs_count; ++i)
|
||||
{
|
||||
ecma_length_t len = bytecode_data.strings[i].length;
|
||||
ecma_char_t *str = bytecode_data.strings[i].str;
|
||||
str[len] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
serializer_init (bool show_opcodes)
|
||||
{
|
||||
|
||||
@@ -31,7 +31,6 @@ void serializer_dump_opcode (opcode_t);
|
||||
void serializer_set_writing_position (opcode_counter_t);
|
||||
void serializer_rewrite_opcode (const opcode_counter_t, opcode_t);
|
||||
void serializer_print_opcodes (void);
|
||||
void serializer_adjust_strings (void);
|
||||
void serializer_free (void);
|
||||
|
||||
#endif // SERIALIZER_H
|
||||
|
||||
Reference in New Issue
Block a user