]> Nishi Git Mirror - serenade.git/commitdiff
windows sucks
authornishi <nishi@0f02c867-ac3d-714e-8a88-971ba1f6efcf>
Mon, 29 Apr 2024 06:37:59 +0000 (06:37 +0000)
committernishi <nishi@0f02c867-ac3d-714e-8a88-971ba1f6efcf>
Mon, 29 Apr 2024 06:37:59 +0000 (06:37 +0000)
git-svn-id: file:///raid/svn-main/nishi-serenade/trunk@79 0f02c867-ac3d-714e-8a88-971ba1f6efcf

Serenade/interpreter.c

index 3e1ae4c23160844442a33cd0fa303c6974c5d612..f485d793b4ca10b6264ed124403f270b39345114 100644 (file)
@@ -214,7 +214,7 @@ struct sn_interpreter_kv* sn_set_variable(struct sn_interpreter* sn, const char*
        if(!global) {
                for(i = 0; sn->local_variables[i] != NULL; i++) {
                        if(strcmp(sn->local_variables[i]->key, name) == 0) {
-                               sn->local_variables[i]->value = gen;
+                               sn->local_variables[i]->value = sn_generic_dup(gen);
                                replaced = true;
                                return sn->local_variables[i];
                        }
@@ -229,7 +229,7 @@ struct sn_interpreter_kv* sn_set_variable(struct sn_interpreter* sn, const char*
                        }
                        sn->local_variables[i] = malloc(sizeof(struct sn_generic));
                        sn->local_variables[i]->key = sn_strdup(name);
-                       sn->local_variables[i]->value = gen;
+                       sn->local_variables[i]->value = sn_generic_dup(gen);
                        sn->local_variables[i]->handler = NULL;
                        if(gen != NULL && gen->type == SN_TYPE_FUNCTION) sn->local_variables[i]->handler = gen->handler;
                        sn->local_variables[i + 1] = NULL;