From: Wolfgang (Blub) Bumiller Date: Tue, 21 Aug 2012 08:08:17 +0000 (+0200) Subject: don't _move_ values out of immediates, it causes NULL strings to be code-generated X-Git-Tag: 0.1-rc1~128 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=92e8f08df31395e3e7a1394a3d6ef62cebf8ac77;p=xonotic%2Fgmqcc.git don't _move_ values out of immediates, it causes NULL strings to be code-generated --- diff --git a/parser.c b/parser.c index b0448bf..9d46159 100644 --- 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); } }