summaryrefslogtreecommitdiff
path: root/src/parse.y
diff options
context:
space:
mode:
authorMichael McConville <mmcconville@mykolab.com>2015-12-02 11:32:42 -0500
committerWill Estes <westes575@gmail.com>2015-12-02 14:39:09 -0500
commit399e94f904b913a4093295426820ab89fc3cd24f (patch)
treeac04185a0167975ba0b6ba6265a5a11e1e536761 /src/parse.y
parent9ba6e5283efd2fe454d3bc92eca960b3ebd91294 (diff)
Made string copying more standard.
copy_string() was a clone of the stdlib's strdup(). For safety, simplicity, and speed, we should use that instead. We introduce xstrdup() which wraps strdup() in a failure upon memory allocation errors.
Diffstat (limited to 'src/parse.y')
-rw-r--r--src/parse.y12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/parse.y b/src/parse.y
index 6e7246c..9bec1ee 100644
--- a/src/parse.y
+++ b/src/parse.y
@@ -193,19 +193,19 @@ optionlist : optionlist option
option : OPT_OUTFILE '=' NAME
{
- outfilename = copy_string( nmstr );
+ outfilename = xstrdup(nmstr);
did_outfilename = 1;
}
| OPT_EXTRA_TYPE '=' NAME
- { extra_type = copy_string( nmstr ); }
+ { extra_type = xstrdup(nmstr); }
| OPT_PREFIX '=' NAME
- { prefix = copy_string( nmstr ); }
+ { prefix = xstrdup(nmstr); }
| OPT_YYCLASS '=' NAME
- { yyclass = copy_string( nmstr ); }
+ { yyclass = xstrdup(nmstr); }
| OPT_HEADER '=' NAME
- { headerfilename = copy_string( nmstr ); }
+ { headerfilename = xstrdup(nmstr); }
| OPT_TABLES '=' NAME
- { tablesext = true; tablesfilename = copy_string( nmstr ); }
+ { tablesext = true; tablesfilename = xstrdup(nmstr); }
;
sect2 : sect2 scon initforrule flexrule '\n'