Make lexical token STRING new based.
The STRING lexical token was malloc based, but then was passed to routines that are expecting a new based result. This patch standardizes on a new/delete based approach.
This commit is contained in:
parent
7ccc9d4484
commit
f2f7933708
|
|
@ -168,12 +168,12 @@ S [afpnumkKMGT]
|
|||
<CSTRING>\\\\ { yymore(); /* Catch \\, which is a \ escaping itself */ }
|
||||
<CSTRING>\\\" { yymore(); /* Catch \", which is an escaped quote */ }
|
||||
<CSTRING>\n { BEGIN(0);
|
||||
yylval.text = strdup(yytext);
|
||||
yylval.text = strdupnew(yytext);
|
||||
VLerror(yylloc, "Missing close quote of string.");
|
||||
yylloc.first_line += 1;
|
||||
return STRING; }
|
||||
<CSTRING>\" { BEGIN(0);
|
||||
yylval.text = strdup(yytext);
|
||||
yylval.text = strdupnew(yytext);
|
||||
yylval.text[strlen(yytext)-1] = 0;
|
||||
return STRING; }
|
||||
<CSTRING>. { yymore(); }
|
||||
|
|
|
|||
8
parse.y
8
parse.y
|
|
@ -685,8 +685,8 @@ description
|
|||
| KK_attribute '(' IDENTIFIER ',' STRING ',' STRING ')'
|
||||
{ perm_string tmp3 = lex_strings.make($3);
|
||||
pform_set_type_attrib(tmp3, $5, $7);
|
||||
delete[]$3;
|
||||
delete $5;
|
||||
delete[] $3;
|
||||
delete[] $5;
|
||||
}
|
||||
;
|
||||
|
||||
|
|
@ -2301,8 +2301,8 @@ module_item
|
|||
{ perm_string tmp3 = lex_strings.make($3);
|
||||
perm_string tmp5 = lex_strings.make($5);
|
||||
pform_set_attrib(tmp3, tmp5, $7);
|
||||
delete[]$3;
|
||||
delete $5;
|
||||
delete[] $3;
|
||||
delete[] $5;
|
||||
}
|
||||
| KK_attribute '(' error ')' ';'
|
||||
{ yyerror(@1, "error: Malformed $attribute parameter list."); }
|
||||
|
|
|
|||
4
pform.cc
4
pform.cc
|
|
@ -1696,7 +1696,7 @@ void pform_set_attrib(perm_string name, perm_string key, char*value)
|
|||
curg->attributes[key] = new PEString(value);
|
||||
|
||||
} else {
|
||||
free(value);
|
||||
delete[] value;
|
||||
VLerror("Unable to match name for setting attribute.");
|
||||
|
||||
}
|
||||
|
|
@ -1712,7 +1712,7 @@ void pform_set_type_attrib(perm_string name, const string&key,
|
|||
map<perm_string,PUdp*>::const_iterator udp = pform_primitives.find(name);
|
||||
if (udp == pform_primitives.end()) {
|
||||
VLerror("type name is not (yet) defined.");
|
||||
free(value);
|
||||
delete[] value;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue