aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/lib/X11/PrOfId.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/PrOfId.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/PrOfId.c')
-rw-r--r--nx-X11/lib/X11/PrOfId.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/nx-X11/lib/X11/PrOfId.c b/nx-X11/lib/X11/PrOfId.c
index 831f17ab9..a96d28cec 100644
--- a/nx-X11/lib/X11/PrOfId.c
+++ b/nx-X11/lib/X11/PrOfId.c
@@ -66,7 +66,6 @@ XcmsPrefixOfFormat(
*/
{
XcmsColorSpace **papColorSpaces;
- char *prefix;
/*
* First try Device-Independent color spaces
@@ -75,10 +74,7 @@ XcmsPrefixOfFormat(
if (papColorSpaces != NULL) {
while (*papColorSpaces != NULL) {
if ((*papColorSpaces)->id == id) {
- prefix = (char *)Xmalloc((strlen((*papColorSpaces)->prefix) +
- 1) * sizeof(char));
- strcpy(prefix, (*papColorSpaces)->prefix);
- return(prefix);
+ return strdup((*papColorSpaces)->prefix);
}
papColorSpaces++;
}
@@ -91,10 +87,7 @@ XcmsPrefixOfFormat(
if (papColorSpaces != NULL) {
while (*papColorSpaces != NULL) {
if ((*papColorSpaces)->id == id) {
- prefix = (char *)Xmalloc((strlen((*papColorSpaces)->prefix) +
- 1) * sizeof(char));
- strcpy(prefix, (*papColorSpaces)->prefix);
- return(prefix);
+ return strdup((*papColorSpaces)->prefix);
}
papColorSpaces++;
}