[PATCH:xfs 2/2] Replace fsalloc(strlen) + strcpy with strdup
Alan Coopersmith
alan.coopersmith at oracle.com
Tue May 20 23:14:07 PDT 2014
Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
---
difs/extensions.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/difs/extensions.c b/difs/extensions.c
index eb31e76..2bb2405 100644
--- a/difs/extensions.c
+++ b/difs/extensions.c
@@ -89,14 +89,13 @@ AddExtension(
ext = (ExtensionEntry *) fsalloc(sizeof(ExtensionEntry));
if (!ext)
return ((ExtensionEntry *) 0);
- ext->name = (char *) fsalloc(strlen(name) + 1);
ext->num_aliases = 0;
ext->aliases = (char **) NULL;
+ ext->name = strdup(name);
if (!ext->name) {
fsfree(ext);
return ((ExtensionEntry *) 0);
}
- strcpy(ext->name, name);
i = NumExtensions;
newexts = (ExtensionEntry **) fsrealloc(extensions,
(i + 1) * sizeof(ExtensionEntry *));
@@ -144,10 +143,9 @@ AddExtensionAlias(char *alias, ExtensionEntry *ext)
if (!aliases)
return FALSE;
ext->aliases = aliases;
- name = (char *) fsalloc(strlen(alias) + 1);
+ name = strdup(alias);
if (!name)
return FALSE;
- strcpy(name, alias);
ext->aliases[ext->num_aliases++] = name;
return TRUE;
}
--
1.7.9.2
More information about the xorg-devel
mailing list