xfree86: Get rid of xstrdup when argument is definitely non-NULL

ditto for XFree86

Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
This commit is contained in:
Mikhail Gusarov 2010-06-04 17:01:42 +07:00
parent 416d228481
commit e4570f5db5
3 changed files with 14 additions and 14 deletions

View File

@ -277,16 +277,16 @@ configureInputSection (void)
mouse->inp_identifier = "Mouse0"; mouse->inp_identifier = "Mouse0";
mouse->inp_driver = "mouse"; mouse->inp_driver = "mouse";
mouse->inp_option_lst = mouse->inp_option_lst =
xf86addNewOption(mouse->inp_option_lst, xstrdup("Protocol"), xf86addNewOption(mouse->inp_option_lst, strdup("Protocol"),
xstrdup(DFLT_MOUSE_PROTO)); strdup(DFLT_MOUSE_PROTO));
#ifndef __SCO__ #ifndef __SCO__
mouse->inp_option_lst = mouse->inp_option_lst =
xf86addNewOption(mouse->inp_option_lst, xstrdup("Device"), xf86addNewOption(mouse->inp_option_lst, strdup("Device"),
xstrdup(DFLT_MOUSE_DEV)); strdup(DFLT_MOUSE_DEV));
#endif #endif
mouse->inp_option_lst = mouse->inp_option_lst =
xf86addNewOption(mouse->inp_option_lst, xstrdup("ZAxisMapping"), xf86addNewOption(mouse->inp_option_lst, strdup("ZAxisMapping"),
xstrdup("4 5 6 7")); strdup("4 5 6 7"));
ptr = (XF86ConfInputPtr)xf86addListItem((glp)ptr, (glp)mouse); ptr = (XF86ConfInputPtr)xf86addListItem((glp)ptr, (glp)mouse);
return ptr; return ptr;
} }
@ -389,7 +389,7 @@ configureDeviceSection (int screennum)
" ### <string>: \"String\", <freq>: \"<f> Hz/kHz/MHz\",\n" " ### <string>: \"String\", <freq>: \"<f> Hz/kHz/MHz\",\n"
" ### <percent>: \"<f>%\"\n" " ### <percent>: \"<f>%\"\n"
" ### [arg]: arg optional\n"; " ### [arg]: arg optional\n";
ptr->dev_comment = xstrdup(descrip); ptr->dev_comment = strdup(descrip);
if (ptr->dev_comment) { if (ptr->dev_comment) {
for (p = DevToConfig[screennum].GDev.options; for (p = DevToConfig[screennum].GDev.options;
p->name != NULL; p++) { p->name != NULL; p++) {
@ -440,7 +440,7 @@ configureLayoutSection (void)
iptr->iref_option_lst = NULL; iptr->iref_option_lst = NULL;
iptr->iref_inputdev_str = "Mouse0"; iptr->iref_inputdev_str = "Mouse0";
iptr->iref_option_lst = 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) ptr->lay_input_lst = (XF86ConfInputrefPtr)
xf86addListItem ((glp) ptr->lay_input_lst, (glp) iptr); xf86addListItem ((glp) ptr->lay_input_lst, (glp) iptr);
} }
@ -453,7 +453,7 @@ configureLayoutSection (void)
iptr->iref_option_lst = NULL; iptr->iref_option_lst = NULL;
iptr->iref_inputdev_str = "Keyboard0"; iptr->iref_inputdev_str = "Keyboard0";
iptr->iref_option_lst = 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) ptr->lay_input_lst = (XF86ConfInputrefPtr)
xf86addListItem ((glp) ptr->lay_input_lst, (glp) iptr); xf86addListItem ((glp) ptr->lay_input_lst, (glp) iptr);
} }
@ -626,7 +626,7 @@ configureDDCMonitorSection (int screennum)
ptr); ptr);
if (ConfiguredMonitor->features.dpms) { 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; return ptr;

View File

@ -209,7 +209,7 @@ LookupStrOption(pointer optlist, const char *name, char *deflt, Bool markUsed)
if (ParseOptionValue(-1, optlist, &o, markUsed)) if (ParseOptionValue(-1, optlist, &o, markUsed))
deflt = o.value.str; deflt = o.value.str;
if (deflt) if (deflt)
return xstrdup(deflt); return strdup(deflt);
else else
return NULL; return NULL;
} }

View File

@ -135,7 +135,7 @@ InitPathList(const char *path)
if (!path) if (!path)
return defaultPathList; return defaultPathList;
fullpath = xstrdup(path); fullpath = strdup(path);
if (!fullpath) if (!fullpath)
return NULL; return NULL;
elem = strtok(fullpath, ","); elem = strtok(fullpath, ",");
@ -353,7 +353,7 @@ InitSubdirs(const char **subdirlist)
sprintf(subdirs[i], "%s%s%s/", *s, slash, osname); sprintf(subdirs[i], "%s%s%s/", *s, slash, osname);
i++; i++;
/* path as given */ /* path as given */
subdirs[i] = xstrdup(*s); subdirs[i] = strdup(*s);
i++; i++;
s++; s++;
if (indefault && !s) { if (indefault && !s) {
@ -1246,7 +1246,7 @@ LoaderGetCanonicalName(const char *modname, PatternPtr patterns)
} }
/* If there is no match, return the whole name minus the leading path */ /* If there is no match, return the whole name minus the leading path */
return xstrdup(s); return strdup(s);
} }
/* /*