From 5df950e0b35207930c645e8ce0c3e9ed1c9fcea5 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sat, 25 Jan 2020 09:54:37 +0100 Subject: string view > string ref --- src/program.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/program.c') diff --git a/src/program.c b/src/program.c index dc7fe8d..78533f6 100644 --- a/src/program.c +++ b/src/program.c @@ -61,6 +61,7 @@ static TslProgramResult tsl_value_create_from_stack_value(TslProgram *self, TslS break; } case TSL_STACK_VALUE_TYPE_STRING: { + #if 0 TslString *str = GC_MALLOC_ATOMIC(sizeof(TslString)); str->data = GC_MALLOC_ATOMIC(src->data.str.size + 1); if(!str) { @@ -82,6 +83,9 @@ static TslProgramResult tsl_value_create_from_stack_value(TslProgram *self, TslS dst->data.string = str; dst->type = TSL_TYPE_STRING; + #endif + dst->data.string_ref = src->data.str; + dst->type = TSL_TYPE_STRING_REF; break; } case TSL_STACK_VALUE_TYPE_FUNCTION: { @@ -92,8 +96,8 @@ static TslProgramResult tsl_value_create_from_stack_value(TslProgram *self, TslS case TSL_STACK_VALUE_TYPE_VARIABLE: { TslValue *var; TslValue map_key; - map_key.type = TSL_TYPE_STRING_VIEW; - map_key.data.string_view = src->data.str; + map_key.type = TSL_TYPE_STRING_REF; + map_key.data.string_ref = src->data.str; var = tsl_hash_map_get(self->variables, &map_key); if(!var) { @@ -278,8 +282,8 @@ TslProgramResult tsl_program_run(TslProgram *self) { TslStackValue *stack_value = tsl_buffer_pop(&self->stack_values, sizeof(TslStackValue)); TslValue map_key; TslValue *map_value; - map_key.type = TSL_TYPE_STRING_VIEW; - map_key.data.string_view = instruction_type4->value; + map_key.type = TSL_TYPE_STRING_REF; + map_key.data.string_ref = instruction_type4->value; map_value = tsl_hash_map_get_or_create(self->variables, &map_key); cleanup_if_error(map_value); -- cgit v1.2.3