diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2011-04-12 22:30:45 -0700 |
---|---|---|
committer | Ulrich Sibiller <uli42@gmx.de> | 2016-10-19 21:40:25 +0200 |
commit | dde00b2f6848a38e9fdbe1e4c85373c8b12944b4 (patch) | |
tree | 070849ce4d0d19b3bb5c17ddf308023147357e7b /nx-X11/lib/X11/lcDB.c | |
parent | 7d7224d8543e85e3a34a1cddf99f3eac9aa9050b (diff) | |
download | nx-libs-dde00b2f6848a38e9fdbe1e4c85373c8b12944b4.tar.gz nx-libs-dde00b2f6848a38e9fdbe1e4c85373c8b12944b4.tar.bz2 nx-libs-dde00b2f6848a38e9fdbe1e4c85373c8b12944b4.zip |
Convert malloc(strlen()); strcpy() sets to strdup
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Backported-to-NX-by: Ulrich Sibiller <uli42@gmx.de>
Diffstat (limited to 'nx-X11/lib/X11/lcDB.c')
-rw-r--r-- | nx-X11/lib/X11/lcDB.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/nx-X11/lib/X11/lcDB.c b/nx-X11/lib/X11/lcDB.c index c11a79a6b..027d7747b 100644 --- a/nx-X11/lib/X11/lcDB.c +++ b/nx-X11/lib/X11/lcDB.c @@ -596,20 +596,18 @@ store_to_database( goto err; } - new->category = (char *)Xmalloc(strlen(parse_info.category) + 1); + new->category = strdup(parse_info.category); if (new->category == NULL) { goto err; } - strcpy(new->category, parse_info.category); if (! construct_name(name, sizeof(name))) { goto err; } - new->name = (char *)Xmalloc(strlen(name) + 1); + new->name = strdup(name); if (new->name == NULL) { goto err; } - strcpy(new->name, name); new->next = *db; new->value = parse_info.value; new->value_num = parse_info.value_num; @@ -943,10 +941,9 @@ f_default( case S_NULL: if (parse_info.category != NULL) goto err; - p = (char *)Xmalloc(strlen(wordp) + 1); + p = strdup(wordp); if (p == NULL) goto err; - strcpy(p, wordp); parse_info.category = p; parse_info.pre_state = S_CATEGORY; break; @@ -960,10 +957,9 @@ f_default( break; } } - p = (char *)Xmalloc(strlen(wordp) + 1); + p = strdup(wordp); if (p == NULL) goto err; - strcpy(p, wordp); if (parse_info.name[parse_info.nest_depth] != NULL) { Xfree(parse_info.name[parse_info.nest_depth]); } |