summaryrefslogtreecommitdiff
path: root/hw/xfree86/loader/loadmod.c
diff options
context:
space:
mode:
authorMikhail Gusarov <dottedmag@dottedmag.net>2010-05-06 01:44:06 +0700
committerMikhail Gusarov <dottedmag@dottedmag.net>2010-05-13 00:22:37 +0700
commit3f3ff971ecff9936cebafc813af9193b97bba89c (patch)
treefdbbad794a42488b7ffe41eed7aba4e498335f55 /hw/xfree86/loader/loadmod.c
parent96c7ab27c383ec767f62a7a11e5fd76f86363fbc (diff)
Replace X-allocation functions with their C89 counterparts
The only remaining X-functions used in server are XNF*, the rest is converted to plain alloc/calloc/realloc/free/strdup. X* functions are still exported from server and x* macros are still defined in header file, so both ABI and API are not affected by this change. Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'hw/xfree86/loader/loadmod.c')
-rw-r--r--hw/xfree86/loader/loadmod.c66
1 files changed, 33 insertions, 33 deletions
diff --git a/hw/xfree86/loader/loadmod.c b/hw/xfree86/loader/loadmod.c
index 5b175a546..871bfdac5 100644
--- a/hw/xfree86/loader/loadmod.c
+++ b/hw/xfree86/loader/loadmod.c
@@ -104,9 +104,9 @@ FreeStringList(char **paths)
return;
for (p = paths; *p; p++)
- xfree(*p);
+ free(*p);
- xfree(paths);
+ free(paths);
}
static char **defaultPathList = NULL;
@@ -147,19 +147,19 @@ InitPathList(const char *path)
if (addslash)
len++;
save = list;
- list = xrealloc(list, (n + 2) * sizeof(char *));
+ list = realloc(list, (n + 2) * sizeof(char *));
if (!list) {
if (save) {
save[n] = NULL;
FreeStringList(save);
}
- xfree(fullpath);
+ free(fullpath);
return NULL;
}
- list[n] = xalloc(len + 1);
+ list[n] = malloc(len + 1);
if (!list[n]) {
FreeStringList(list);
- xfree(fullpath);
+ free(fullpath);
return NULL;
}
strcpy(list[n], elem);
@@ -173,7 +173,7 @@ InitPathList(const char *path)
}
if (list)
list[n] = NULL;
- xfree(fullpath);
+ free(fullpath);
return list;
}
@@ -244,7 +244,7 @@ InitPatterns(const char **patternlist)
for (i = 0, s = patternlist; *s; i++, s++)
if (*s == DEFAULT_LIST)
i += sizeof(stdPatterns) / sizeof(stdPatterns[0]) - 1 - 1;
- patterns = xalloc((i + 1) * sizeof(PatternRec));
+ patterns = malloc((i + 1) * sizeof(PatternRec));
if (!patterns) {
return NULL;
}
@@ -274,7 +274,7 @@ static void
FreePatterns(PatternPtr patterns)
{
if (patterns && patterns != stdPatterns)
- xfree(patterns);
+ free(patterns);
}
static const char **
@@ -290,7 +290,7 @@ InitSubdirs(const char **subdirlist)
Bool indefault;
if (subdirlist == NULL) {
- subdirlist = tmp_subdirlist = xalloc(2 * sizeof(char *));
+ subdirlist = tmp_subdirlist = malloc(2 * sizeof(char *));
if (subdirlist == NULL)
return NULL;
subdirlist[0] = DEFAULT_LIST;
@@ -316,15 +316,15 @@ InitSubdirs(const char **subdirlist)
strstr(*s, "..")) {
xf86Msg(X_ERROR, "InitSubdirs: Bad subdir: \"%s\"\n", *s);
if (tmp_subdirlist)
- xfree(tmp_subdirlist);
+ free(tmp_subdirlist);
return NULL;
}
}
}
- subdirs = xalloc((i * 2 + 1) * sizeof(char *));
+ subdirs = malloc((i * 2 + 1) * sizeof(char *));
if (!subdirs) {
if (tmp_subdirlist)
- xfree(tmp_subdirlist);
+ free(tmp_subdirlist);
return NULL;
}
i = 0;
@@ -344,12 +344,12 @@ InitSubdirs(const char **subdirlist)
} else
slash = "";
len += oslen + 2;
- if (!(subdirs[i] = xalloc(len))) {
+ if (!(subdirs[i] = malloc(len))) {
while (--i >= 0)
- xfree(subdirs[i]);
- xfree(subdirs);
+ free(subdirs[i]);
+ free(subdirs);
if (tmp_subdirlist)
- xfree(tmp_subdirlist);
+ free(tmp_subdirlist);
return NULL;
}
/* tack on the OS name */
@@ -368,7 +368,7 @@ InitSubdirs(const char **subdirlist)
subdirs[i] = NULL;
}
if (tmp_subdirlist)
- xfree(tmp_subdirlist);
+ free(tmp_subdirlist);
return (const char **)subdirs;
}
@@ -379,8 +379,8 @@ FreeSubdirs(const char **subdirs)
if (subdirs) {
for (s = subdirs; *s; s++)
- xfree(*s);
- xfree(subdirs);
+ free(*s);
+ free(subdirs);
}
}
@@ -465,7 +465,7 @@ FindModule(const char *module, const char *dirname, const char **subdirlist,
FreeSubdirs(subdirs);
if (dirpath != dirname)
- xfree(dirpath);
+ free(dirpath);
return name;
}
@@ -527,7 +527,7 @@ LoaderListDirs(const char **subdirlist, const char **patternlist)
match[1].rm_so != -1) {
len = match[1].rm_eo - match[1].rm_so;
save = listing;
- listing = xrealloc(listing,
+ listing = realloc(listing,
(n + 2) * sizeof(char *));
if (!listing) {
if (save) {
@@ -539,7 +539,7 @@ LoaderListDirs(const char **subdirlist, const char **patternlist)
FreePatterns(patterns);
return NULL;
}
- listing[n] = xalloc(len + 1);
+ listing[n] = malloc(len + 1);
if (!listing[n]) {
FreeStringList(listing);
FreePathList(pathlist);
@@ -780,7 +780,7 @@ LoadSubModule(pointer _parent, const char *module,
static ModuleDescPtr
NewModuleDesc(const char *name)
{
- ModuleDescPtr mdp = xalloc(sizeof(ModuleDesc));
+ ModuleDescPtr mdp = malloc(sizeof(ModuleDesc));
if (mdp) {
mdp->child = NULL;
@@ -944,7 +944,7 @@ doLoadModule(const char *module, const char *path, const char **subdirlist,
* now check if the special data object <modulename>ModuleData is
* present.
*/
- p = xalloc(strlen(name) + strlen("ModuleData") + 1);
+ p = malloc(strlen(name) + strlen("ModuleData") + 1);
if (!p) {
if (errmaj)
*errmaj = LDR_NOMEM;
@@ -1021,9 +1021,9 @@ doLoadModule(const char *module, const char *path, const char **subdirlist,
LoadModule_exit:
FreePathList(pathlist);
FreePatterns(patterns);
- xfree(found);
- xfree(name);
- xfree(p);
+ free(found);
+ free(name);
+ free(p);
return ret;
}
@@ -1099,8 +1099,8 @@ UnloadModuleOrDriver(ModuleDescPtr mod)
UnloadModuleOrDriver(mod->child);
if (mod->sib)
UnloadModuleOrDriver(mod->sib);
- xfree(mod->name);
- xfree(mod);
+ free(mod->name);
+ free(mod);
}
void
@@ -1122,8 +1122,8 @@ UnloadSubModule(pointer _mod)
if (mod->child)
UnloadModuleOrDriver(mod->child);
- xfree(mod->name);
- xfree(mod);
+ free(mod->name);
+ free(mod);
}
static void
@@ -1241,7 +1241,7 @@ LoaderGetCanonicalName(const char *modname, PatternPtr patterns)
for (p = patterns; p->pattern; p++)
if (regexec(&p->rex, s, 2, match, 0) == 0 && match[1].rm_so != -1) {
len = match[1].rm_eo - match[1].rm_so;
- str = xalloc(len + 1);
+ str = malloc(len + 1);
if (!str)
return NULL;
strncpy(str, s + match[1].rm_so, len);