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/flexdef.h | |
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/flexdef.h')
-rw-r--r-- | src/flexdef.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/flexdef.h b/src/flexdef.h index ede6a93..066f804 100644 --- a/src/flexdef.h +++ b/src/flexdef.h @@ -857,8 +857,8 @@ extern void check_char PROTO ((int c)); /* Replace upper-case letter to lower-case. */ extern unsigned char clower PROTO ((int)); -/* Returns a dynamically allocated copy of a string. */ -extern char *copy_string PROTO ((const char *)); +/* strdup() that fails fatally on allocation failures. */ +extern char *xstrdup(const char *); /* Returns a dynamically allocated copy of a (potentially) unsigned string. */ extern unsigned char *copy_unsigned_string PROTO ((unsigned char *)); |