eval.c: Don't create copy of already refcounted string
This commit is contained in:
parent
5f8462fe34
commit
8df0991415
1 changed files with 2 additions and 14 deletions
16
src/eval.c
16
src/eval.c
|
|
@ -531,23 +531,11 @@ match_pattern_from_var_or_member(
|
|||
next:
|
||||
switch (var_or_member->type) {
|
||||
case APFL_EXPR_ASSIGNABLE_VAR_OR_MEMBER_VAR:
|
||||
if ((pattern->value.varname = apfl_string_copy_into_new_refcounted(
|
||||
ctx->allocator,
|
||||
apfl_string_view_from(var_or_member->var)
|
||||
)) == NULL) {
|
||||
result = MATCH_FATAL_ERROR;
|
||||
goto fail;
|
||||
}
|
||||
pattern->value.varname = apfl_refcounted_string_incref(var_or_member->var);
|
||||
return MATCH_OK;
|
||||
case APFL_EXPR_ASSIGNABLE_VAR_OR_MEMBER_DOT:
|
||||
str_value.type = VALUE_STRING;
|
||||
if ((str_value.string = apfl_string_copy_into_new_refcounted(
|
||||
ctx->allocator,
|
||||
apfl_string_view_from(var_or_member->dot.rhs)
|
||||
)) == NULL) {
|
||||
result = MATCH_FATAL_ERROR;
|
||||
goto fail;
|
||||
}
|
||||
str_value.string = apfl_refcounted_string_incref(var_or_member->dot.rhs);
|
||||
|
||||
if (!apfl_resizable_append(
|
||||
ctx->allocator,
|
||||
|
|
|
|||
Loading…
Reference in a new issue