[PATCH 6/8] xfree86: Get rid of xstrdup when argument is definitely non-NULL
Mikhail Gusarov
dottedmag at dottedmag.net
Fri Jun 4 03:25:03 PDT 2010
ditto for XFree86
Signed-off-by: Mikhail Gusarov <dottedmag at dottedmag.net>
---
hw/xfree86/common/xf86Configure.c | 20 ++++++++++----------
hw/xfree86/common/xf86Option.c | 2 +-
hw/xfree86/common/xf86Xinput.c | 2 +-
hw/xfree86/loader/loadmod.c | 6 +++---
4 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/hw/xfree86/common/xf86Configure.c b/hw/xfree86/common/xf86Configure.c
index 2f93bb1..822d767 100644
--- a/hw/xfree86/common/xf86Configure.c
+++ b/hw/xfree86/common/xf86Configure.c
@@ -277,16 +277,16 @@ configureInputSection (void)
mouse->inp_identifier = "Mouse0";
mouse->inp_driver = "mouse";
mouse->inp_option_lst =
- xf86addNewOption(mouse->inp_option_lst, xstrdup("Protocol"),
- xstrdup(DFLT_MOUSE_PROTO));
+ xf86addNewOption(mouse->inp_option_lst, strdup("Protocol"),
+ strdup(DFLT_MOUSE_PROTO));
#ifndef __SCO__
mouse->inp_option_lst =
- xf86addNewOption(mouse->inp_option_lst, xstrdup("Device"),
- xstrdup(DFLT_MOUSE_DEV));
+ xf86addNewOption(mouse->inp_option_lst, strdup("Device"),
+ strdup(DFLT_MOUSE_DEV));
#endif
mouse->inp_option_lst =
- xf86addNewOption(mouse->inp_option_lst, xstrdup("ZAxisMapping"),
- xstrdup("4 5 6 7"));
+ xf86addNewOption(mouse->inp_option_lst, strdup("ZAxisMapping"),
+ strdup("4 5 6 7"));
ptr = (XF86ConfInputPtr)xf86addListItem((glp)ptr, (glp)mouse);
return ptr;
}
@@ -389,7 +389,7 @@ configureDeviceSection (int screennum)
" ### <string>: \"String\", <freq>: \"<f> Hz/kHz/MHz\",\n"
" ### <percent>: \"<f>%\"\n"
" ### [arg]: arg optional\n";
- ptr->dev_comment = xstrdup(descrip);
+ ptr->dev_comment = strdup(descrip);
if (ptr->dev_comment) {
for (p = DevToConfig[screennum].GDev.options;
p->name != NULL; p++) {
@@ -440,7 +440,7 @@ configureLayoutSection (void)
iptr->iref_option_lst = NULL;
iptr->iref_inputdev_str = "Mouse0";
iptr->iref_option_lst =
- xf86addNewOption (iptr->iref_option_lst, xstrdup("CorePointer"), NULL);
+ xf86addNewOption (iptr->iref_option_lst, strdup("CorePointer"), NULL);
ptr->lay_input_lst = (XF86ConfInputrefPtr)
xf86addListItem ((glp) ptr->lay_input_lst, (glp) iptr);
}
@@ -453,7 +453,7 @@ configureLayoutSection (void)
iptr->iref_option_lst = NULL;
iptr->iref_inputdev_str = "Keyboard0";
iptr->iref_option_lst =
- xf86addNewOption (iptr->iref_option_lst, xstrdup("CoreKeyboard"), NULL);
+ xf86addNewOption (iptr->iref_option_lst, strdup("CoreKeyboard"), NULL);
ptr->lay_input_lst = (XF86ConfInputrefPtr)
xf86addListItem ((glp) ptr->lay_input_lst, (glp) iptr);
}
@@ -626,7 +626,7 @@ configureDDCMonitorSection (int screennum)
ptr);
if (ConfiguredMonitor->features.dpms) {
- ptr->mon_option_lst = xf86addNewOption(ptr->mon_option_lst, xstrdup("DPMS"), NULL);
+ ptr->mon_option_lst = xf86addNewOption(ptr->mon_option_lst, strdup("DPMS"), NULL);
}
return ptr;
diff --git a/hw/xfree86/common/xf86Option.c b/hw/xfree86/common/xf86Option.c
index 61d0dcc..a6596f0 100644
--- a/hw/xfree86/common/xf86Option.c
+++ b/hw/xfree86/common/xf86Option.c
@@ -209,7 +209,7 @@ LookupStrOption(pointer optlist, const char *name, char *deflt, Bool markUsed)
if (ParseOptionValue(-1, optlist, &o, markUsed))
deflt = o.value.str;
if (deflt)
- return xstrdup(deflt);
+ return strdup(deflt);
else
return NULL;
}
diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
index 356ddab..e12b7d9 100644
--- a/hw/xfree86/common/xf86Xinput.c
+++ b/hw/xfree86/common/xf86Xinput.c
@@ -613,7 +613,7 @@ MergeInputClasses(IDevPtr idev, InputAttributes *attrs)
/* Apply options to device with InputClass settings preferred. */
if (classdriver) {
free(idev->driver);
- idev->driver = xstrdup(classdriver);
+ idev->driver = strdup(classdriver);
if (!idev->driver) {
xf86Msg(X_ERROR, "Failed to allocate memory while merging "
"InputClass configuration");
diff --git a/hw/xfree86/loader/loadmod.c b/hw/xfree86/loader/loadmod.c
index 871bfda..bff867c 100644
--- a/hw/xfree86/loader/loadmod.c
+++ b/hw/xfree86/loader/loadmod.c
@@ -135,7 +135,7 @@ InitPathList(const char *path)
if (!path)
return defaultPathList;
- fullpath = xstrdup(path);
+ fullpath = strdup(path);
if (!fullpath)
return NULL;
elem = strtok(fullpath, ",");
@@ -356,7 +356,7 @@ InitSubdirs(const char **subdirlist)
sprintf(subdirs[i], "%s%s%s/", *s, slash, osname);
i++;
/* path as given */
- subdirs[i] = xstrdup(*s);
+ subdirs[i] = strdup(*s);
i++;
s++;
if (indefault && !s) {
@@ -1250,7 +1250,7 @@ LoaderGetCanonicalName(const char *modname, PatternPtr patterns)
}
/* If there is no match, return the whole name minus the leading path */
- return xstrdup(s);
+ return strdup(s);
}
/*
--
1.7.1
More information about the xorg-devel
mailing list