aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/lib/X11/lcFile.c
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2011-04-12 22:30:45 -0700
committerUlrich Sibiller <uli42@gmx.de>2016-10-19 21:40:25 +0200
commitdde00b2f6848a38e9fdbe1e4c85373c8b12944b4 (patch)
tree070849ce4d0d19b3bb5c17ddf308023147357e7b /nx-X11/lib/X11/lcFile.c
parent7d7224d8543e85e3a34a1cddf99f3eac9aa9050b (diff)
downloadnx-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/lcFile.c')
-rw-r--r--nx-X11/lib/X11/lcFile.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/nx-X11/lib/X11/lcFile.c b/nx-X11/lib/X11/lcFile.c
index e657e707f..36f0ddf5a 100644
--- a/nx-X11/lib/X11/lcFile.c
+++ b/nx-X11/lib/X11/lcFile.c
@@ -401,10 +401,7 @@ resolve_name(
from = args[1], to = args[0]; /* right to left */
}
if (! strcmp(from, lc_name)) {
- name = Xmalloc(strlen(to) + 1);
- if (name != NULL) {
- strcpy(name, to);
- }
+ name = strdup(to);
break;
}
}
@@ -557,8 +554,7 @@ _XlcResolveLocaleName(
if (name == NULL) {
/* vendor locale name == Xlocale name, no expansion of alias */
- pub->siname = Xmalloc (strlen (lc_name) + 1);
- strcpy (pub->siname, lc_name);
+ pub->siname = strdup (lc_name);
} else {
pub->siname = name;
}
@@ -707,8 +703,7 @@ _XlcLocaleDirName(char *dir_name, size_t dir_len, char *lc_name)
last_dir_len = strlen (dir_name) + 1;
last_dir_name = Xmalloc (last_dir_len);
strcpy (last_dir_name, dir_name);
- last_lc_name = Xmalloc (strlen (lc_name) + 1);
- strcpy (last_lc_name, lc_name);
+ last_lc_name = strdup (lc_name);
return dir_name;
}
@@ -806,8 +801,7 @@ _XlcLocaleLibDirName(char *dir_name, size_t dir_len, char *lc_name)
last_dir_len = strlen (dir_name) + 1;
last_dir_name = Xmalloc (last_dir_len);
strcpy (last_dir_name, dir_name);
- last_lc_name = Xmalloc (strlen (lc_name) + 1);
- strcpy (last_lc_name, lc_name);
+ last_lc_name = strdup (lc_name);
return dir_name;
}