]> git.xonotic.org Git - xonotic/gmqcc.git/commitdiff
don't _move_ values out of immediates, it causes NULL strings to be code-generated
authorWolfgang (Blub) Bumiller <blub@speed.at>
Tue, 21 Aug 2012 08:08:17 +0000 (10:08 +0200)
committerWolfgang (Blub) Bumiller <blub@speed.at>
Tue, 21 Aug 2012 08:08:17 +0000 (10:08 +0200)
parser.c

index b0448bfa8806da7feae0892752150d7e56a7678c..9d461597f0aecca2d95cd6e3d91980fb3f74124a 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -2450,8 +2450,10 @@ nextvar:
             else
             {
                 var->isconst = true;
-                memcpy(&var->constval, &cval->constval, sizeof(var->constval));
-                memset(&cval->constval, 0, sizeof(cval->constval));
+                if (cval->expression.vtype == TYPE_STRING)
+                    var->constval.vstring = parser_strdup(cval->constval.vstring);
+                else
+                    memcpy(&var->constval, &cval->constval, sizeof(var->constval));
                 ast_unref(cval);
             }
         }