compile: Use apfl_string_move_into_new_gc_string

This commit is contained in:
Laria 2022-04-23 22:46:27 +02:00
parent bb89b2ae49
commit 24c283c85f

View file

@ -5,9 +5,9 @@
#include "apfl.h"
#include "compile.h"
#include "bytecode.h"
#include "resizable.h"
#include "strings.h"
#define DEBUG_COMPILING 1
@ -115,13 +115,12 @@ ilist_put_string(struct instruction_list *ilist, struct apfl_string *string)
static bool
string_move_into_new(struct compiler *compiler, struct apfl_string **out, struct apfl_string *in)
{
struct apfl_string *str = apfl_gc_new_string(compiler->gc);
struct apfl_string *str = apfl_string_move_into_new_gc_string(compiler->gc, in);
if (str == NULL) {
compiler->error = apfl_error_simple(APFL_ERR_MALLOC_FAILED);
return false;
}
*str = apfl_string_move(in);
*out = str;
return true;
}