diff options
author | Michael McConville <mmcconville@mykolab.com> | 2015-12-02 11:32:42 -0500 |
---|---|---|
committer | Will Estes <westes575@gmail.com> | 2015-12-02 14:39:09 -0500 |
commit | 399e94f904b913a4093295426820ab89fc3cd24f (patch) | |
tree | ac04185a0167975ba0b6ba6265a5a11e1e536761 /src/tables.c | |
parent | 9ba6e5283efd2fe454d3bc92eca960b3ebd91294 (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/tables.c')
-rw-r--r-- | src/tables.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/tables.c b/src/tables.c index ef49ad0..62a9dcc 100644 --- a/src/tables.c +++ b/src/tables.c @@ -90,8 +90,8 @@ int yytbl_hdr_init (struct yytbl_hdr *th, const char *version_str, th->th_hsize += yypad64 (th->th_hsize); th->th_ssize = 0; // Not known at this point. th->th_flags = 0; - th->th_version = copy_string (version_str); - th->th_name = copy_string (name); + th->th_version = xstrdup(version_str); + th->th_name = xstrdup(name); return 0; } |