summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2010-06-11 10:08:13 -0700
committerKeith Packard <keithp@keithp.com>2010-06-11 10:08:13 -0700
commita41d6e9bffbe56cfa1c3b84388a3d9f5a982f1a9 (patch)
tree35bd9d1971fe0dd7d4b94cb90aadcfa12c57f574
parent7e8f1001217326cc451974bacf25275420c4bb4e (diff)
parentf4190feb25ecc3d8278decc8bf28a5ef0e568942 (diff)
Merge remote branch 'dottedmag/for-keithp'
-rw-r--r--config/config.c4
-rw-r--r--config/dbus.c8
-rw-r--r--config/hal.c14
-rw-r--r--config/udev.c6
-rw-r--r--dix/dixfonts.c2
-rw-r--r--exa/exa_glyphs.c12
-rw-r--r--glx/glxcmds.c2
-rw-r--r--glx/glxscreens.c6
-rw-r--r--hw/dmx/input/dmxinputinit.c4
-rw-r--r--hw/dmx/input/usb-keyboard.c2
-rw-r--r--hw/kdrive/ephyr/ephyrhostvideo.c6
-rw-r--r--hw/kdrive/ephyr/hostx.c25
-rw-r--r--hw/kdrive/src/kinput.c12
-rw-r--r--hw/xfree86/common/xf86Configure.c20
-rw-r--r--hw/xfree86/common/xf86Option.c2
-rw-r--r--hw/xfree86/loader/loadmod.c6
-rw-r--r--hw/xfree86/modes/xf86Cursors.c7
-rw-r--r--hw/xfree86/os-support/bus/Sbus.c6
-rw-r--r--hw/xquartz/GL/indirect.c12
-rw-r--r--hw/xwin/InitOutput.c13
-rwxr-xr-xhw/xwin/glx/indirect.c6
-rw-r--r--hw/xwin/winconfig.c4
-rw-r--r--record/record.c4
-rw-r--r--xkb/XKBGAlloc.c18
-rw-r--r--xkb/XKBMAlloc.c18
-rw-r--r--xkb/ddxList.c5
-rw-r--r--xkb/ddxLoad.c7
-rw-r--r--xkb/xkb.c21
-rw-r--r--xkb/xkbInit.c6
-rw-r--r--xkb/xkbUtils.c12
30 files changed, 119 insertions, 151 deletions
diff --git a/config/config.c b/config/config.c
index 65ef67987..d86f7c649 100644
--- a/config/config.c
+++ b/config/config.c
@@ -133,7 +133,7 @@ add_option(InputOption **options, const char *key, const char *value)
*options = calloc(sizeof(**options), 1);
if (!*options) /* Yeesh. */
return;
- (*options)->key = xstrdup(key);
- (*options)->value = xstrdup(value);
+ (*options)->key = strdup(key);
+ (*options)->value = strdup(value);
(*options)->next = NULL;
}
diff --git a/config/dbus.c b/config/dbus.c
index b67fddb3e..34e3caade 100644
--- a/config/dbus.c
+++ b/config/dbus.c
@@ -86,8 +86,8 @@ add_device(DBusMessage *message, DBusMessage *reply, DBusError *error)
return BadAlloc;
}
- options->key = xstrdup("_source");
- options->value = xstrdup("client/dbus");
+ options->key = strdup("_source");
+ options->value = strdup("client/dbus");
if (!options->key || !options->value) {
ErrorF("[config/dbus] couldn't allocate first key/value pair\n");
ret = BadAlloc;
@@ -120,7 +120,7 @@ add_device(DBusMessage *message, DBusMessage *reply, DBusError *error)
tmp);
MALFORMED_MESSAGE();
}
- options->key = xstrdup(tmp);
+ options->key = strdup(tmp);
if (!options->key) {
ErrorF("[config/dbus] couldn't duplicate key!\n");
ret = BadAlloc;
@@ -136,7 +136,7 @@ add_device(DBusMessage *message, DBusMessage *reply, DBusError *error)
dbus_message_iter_get_basic(&subiter, &tmp);
if (!tmp)
MALFORMED_MESSAGE();
- options->value = xstrdup(tmp);
+ options->value = strdup(tmp);
if (!options->value) {
ErrorF("[config/dbus] couldn't duplicate option!\n");
ret = BadAlloc;
diff --git a/config/hal.c b/config/hal.c
index 8f9aeb8d3..b70488bf3 100644
--- a/config/hal.c
+++ b/config/hal.c
@@ -81,7 +81,7 @@ get_prop_string(LibHalContext *hal_ctx, const char *udi, const char *name)
prop = libhal_device_get_property_string(hal_ctx, udi, name, NULL);
LogMessageVerb(X_INFO, 10, "config/hal: getting %s on %s returned %s\n", name, udi, prop ? prop : "(null)");
if (prop) {
- ret = xstrdup(prop);
+ ret = strdup(prop);
libhal_free_string(prop);
}
else {
@@ -156,13 +156,13 @@ device_added(LibHalContext *hal_ctx, const char *udi)
LogMessage(X_WARNING,"config/hal: no driver or path specified for %s\n", udi);
goto unwind;
}
- attrs.device = xstrdup(path);
+ attrs.device = strdup(path);
name = get_prop_string(hal_ctx, udi, "info.product");
if (!name)
- name = xstrdup("(unnamed)");
+ name = strdup("(unnamed)");
else
- attrs.product = xstrdup(name);
+ attrs.product = strdup(name);
attrs.vendor = get_prop_string(hal_ctx, udi, "info.vendor");
hal_tags = get_prop_string(hal_ctx, udi, "input.tags");
@@ -211,8 +211,8 @@ device_added(LibHalContext *hal_ctx, const char *udi)
goto unwind;
}
- options->key = xstrdup("_source");
- options->value = xstrdup("server/hal");
+ options->key = strdup("_source");
+ options->value = strdup("server/hal");
if (!options->key || !options->value) {
LogMessage(X_ERROR, "config/hal: couldn't allocate first key/value pair\n");
goto unwind;
@@ -387,7 +387,7 @@ device_added(LibHalContext *hal_ctx, const char *udi)
for (; dev; dev = dev->next){
free(dev->config_info);
- dev->config_info = xstrdup(config_info);
+ dev->config_info = strdup(config_info);
}
unwind:
diff --git a/config/udev.c b/config/udev.c
index 16c462455..993449075 100644
--- a/config/udev.c
+++ b/config/udev.c
@@ -86,8 +86,8 @@ device_added(struct udev_device *udev_device)
if (!options)
return;
- options->key = xstrdup("_source");
- options->value = xstrdup("server/udev");
+ options->key = strdup("_source");
+ options->value = strdup("server/udev");
if (!options->key || !options->value)
goto unwind;
@@ -197,7 +197,7 @@ device_added(struct udev_device *udev_device)
for (; dev; dev = dev->next) {
free(dev->config_info);
- dev->config_info = xstrdup(config_info);
+ dev->config_info = strdup(config_info);
}
unwind:
diff --git a/dix/dixfonts.c b/dix/dixfonts.c
index 6c90fb9d2..b51ad841f 100644
--- a/dix/dixfonts.c
+++ b/dix/dixfonts.c
@@ -1836,7 +1836,7 @@ SetDefaultFontPath(char *path)
if (!start) {
temp_path = Xprintf("%s%sbuilt-ins", path, *path ? "," : "");
} else {
- temp_path = xstrdup(path);
+ temp_path = strdup(path);
}
if (!temp_path)
return BadAlloc;
diff --git a/exa/exa_glyphs.c b/exa/exa_glyphs.c
index b09db46b0..5c46ec901 100644
--- a/exa/exa_glyphs.c
+++ b/exa/exa_glyphs.c
@@ -127,15 +127,11 @@ exaUnrealizeGlyphCaches(ScreenPtr pScreen,
cache->picture = NULL;
}
- if (cache->hashEntries) {
- free(cache->hashEntries);
- cache->hashEntries = NULL;
- }
+ free(cache->hashEntries);
+ cache->hashEntries = NULL;
- if (cache->glyphs) {
- free(cache->glyphs);
- cache->glyphs = NULL;
- }
+ free(cache->glyphs);
+ cache->glyphs = NULL;
cache->glyphCount = 0;
}
}
diff --git a/glx/glxcmds.c b/glx/glxcmds.c
index 1d3be4921..9e5b2139e 100644
--- a/glx/glxcmds.c
+++ b/glx/glxcmds.c
@@ -2433,7 +2433,7 @@ int __glXDisp_ClientInfo(__GLXclientState *cl, GLbyte *pc)
cl->GLClientminorVersion = req->minor;
free(cl->GLClientextensions);
buf = (const char *)(req+1);
- cl->GLClientextensions = xstrdup(buf);
+ cl->GLClientextensions = strdup(buf);
return Success;
}
diff --git a/glx/glxscreens.c b/glx/glxscreens.c
index a5b61df9f..8515e14d5 100644
--- a/glx/glxscreens.c
+++ b/glx/glxscreens.c
@@ -356,9 +356,9 @@ void __glXScreenInit(__GLXscreen *pGlxScreen, ScreenPtr pScreen)
return;
pGlxScreen->pScreen = pScreen;
- pGlxScreen->GLextensions = xstrdup(GLServerExtensions);
- pGlxScreen->GLXvendor = xstrdup(GLXServerVendorName);
- pGlxScreen->GLXextensions = xstrdup(GLXServerExtensions);
+ pGlxScreen->GLextensions = strdup(GLServerExtensions);
+ pGlxScreen->GLXvendor = strdup(GLXServerVendorName);
+ pGlxScreen->GLXextensions = strdup(GLXServerExtensions);
/* All GLX providers must support all of the functionality required for at
* least GLX 1.2. If the provider supports a higher version, the GLXminor
diff --git a/hw/dmx/input/dmxinputinit.c b/hw/dmx/input/dmxinputinit.c
index b2e16fba4..83a2abbb8 100644
--- a/hw/dmx/input/dmxinputinit.c
+++ b/hw/dmx/input/dmxinputinit.c
@@ -885,7 +885,7 @@ static void dmxInputScanForExtensions(DMXInputInfo *dmxInput, int doXI)
&& dmxL->deviceId < 0) {
dmxL->deviceId = devices[i].id;
dmxL->deviceName = (devices[i].name
- ? xstrdup(devices[i].name)
+ ? strdup(devices[i].name)
: NULL);
}
}
@@ -918,7 +918,7 @@ static void dmxInputScanForExtensions(DMXInputInfo *dmxInput, int doXI)
dmxLocal->sendsCore = FALSE;
dmxLocal->deviceId = devices[i].id;
dmxLocal->deviceName = (devices[i].name
- ? xstrdup(devices[i].name)
+ ? strdup(devices[i].name)
: NULL);
}
}
diff --git a/hw/dmx/input/usb-keyboard.c b/hw/dmx/input/usb-keyboard.c
index dc575fef7..9db1adbfc 100644
--- a/hw/dmx/input/usb-keyboard.c
+++ b/hw/dmx/input/usb-keyboard.c
@@ -439,6 +439,6 @@ void kbdUSBGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info)
kbdUSBGetMap(pDev, &info->keySyms, info->modMap);
info->focusClass = 1;
info->kbdFeedbackClass = 1;
- info->names.keycodes = xstrdup("powerpcps2");
+ info->names.keycodes = strdup("powerpcps2");
info->force = 1;
}
diff --git a/hw/kdrive/ephyr/ephyrhostvideo.c b/hw/kdrive/ephyr/ephyrhostvideo.c
index 38927b02d..9dde768c8 100644
--- a/hw/kdrive/ephyr/ephyrhostvideo.c
+++ b/hw/kdrive/ephyr/ephyrhostvideo.c
@@ -831,10 +831,8 @@ out:
XFreeGC (dpy, gc) ;
gc = NULL ;
}
- if (rects) {
- free (rects) ;
- rects = NULL ;
- }
+ free(rects);
+ rects = NULL;
EPHYR_LOG ("leave\n") ;
return is_ok ;
}
diff --git a/hw/kdrive/ephyr/hostx.c b/hw/kdrive/ephyr/hostx.c
index 38ee06d25..2ebeca958 100644
--- a/hw/kdrive/ephyr/hostx.c
+++ b/hw/kdrive/ephyr/hostx.c
@@ -669,11 +669,8 @@ hostx_screen_init (EphyrScreenInfo screen,
}
else
{
- if (host_screen->ximg->data)
- {
- free(host_screen->ximg->data);
- host_screen->ximg->data = NULL;
- }
+ free(host_screen->ximg->data);
+ host_screen->ximg->data = NULL;
XDestroyImage(host_screen->ximg);
}
@@ -1160,10 +1157,8 @@ out:
XFree (visuals) ;
visuals = NULL;
}
- if (host_visuals) {
- free (host_visuals) ;
- host_visuals = NULL;
- }
+ free(host_visuals);
+ host_visuals = NULL;
EPHYR_LOG ("leave\n") ;
return is_ok ;
@@ -1292,10 +1287,8 @@ hostx_set_window_bounding_rectangles (int a_window,
rects, a_num_rects, ShapeSet, YXBanded) ;
is_ok = TRUE ;
- if (rects) {
- free (rects) ;
- rects = NULL ;
- }
+ free(rects);
+ rects = NULL;
EPHYR_LOG ("leave\n") ;
return is_ok;
}
@@ -1329,10 +1322,8 @@ hostx_set_window_clipping_rectangles (int a_window,
rects, a_num_rects, ShapeSet, YXBanded) ;
is_ok = TRUE ;
- if (rects) {
- free (rects) ;
- rects = NULL ;
- }
+ free(rects);
+ rects = NULL;
EPHYR_LOG ("leave\n") ;
return is_ok;
}
diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c
index 402475884..80a1458b1 100644
--- a/hw/kdrive/src/kinput.c
+++ b/hw/kdrive/src/kinput.c
@@ -919,7 +919,7 @@ KdAddConfigKeyboard (char *keyboard)
if (!new)
return BadAlloc;
- new->line = xstrdup(keyboard);
+ new->line = strdup(keyboard);
new->next = NULL;
for (prev = &kdConfigKeyboards; *prev; prev = &(*prev)->next);
@@ -987,7 +987,7 @@ KdAddConfigPointer (char *pointer)
if (!new)
return BadAlloc;
- new->line = xstrdup(pointer);
+ new->line = strdup(pointer);
new->next = NULL;
for (prev = &kdConfigPointers; *prev; prev = &(*prev)->next);
@@ -1067,11 +1067,11 @@ KdGetOptions (InputOption **options, char *string)
newopt->key = (char *)malloc(tam_key);
strncpy(newopt->key, string, tam_key);
newopt->key[tam_key] = '\0';
- newopt->value = xstrdup(strchr(string, '=') + 1);
+ newopt->value = strdup(strchr(string, '=') + 1);
}
else
{
- newopt->key = xstrdup(string);
+ newopt->key = strdup(string);
newopt->value = NULL;
}
newopt->next = NULL;
@@ -1147,7 +1147,7 @@ KdParseKeyboard (char *arg)
if (strcmp (save, "auto") == 0)
ki->driverPrivate = NULL;
else
- ki->driverPrivate = xstrdup(save);
+ ki->driverPrivate = strdup(save);
if (delim != ',')
{
@@ -1243,7 +1243,7 @@ KdParsePointer (char *arg)
if (strcmp(save, "auto") == 0)
pi->driverPrivate = NULL;
else
- pi->driverPrivate = xstrdup(save);
+ pi->driverPrivate = strdup(save);
if (delim != ',')
{
diff --git a/hw/xfree86/common/xf86Configure.c b/hw/xfree86/common/xf86Configure.c
index 2f93bb13b..822d76737 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 91a67186f..aa6ea3011 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/loader/loadmod.c b/hw/xfree86/loader/loadmod.c
index 496244312..615e8c691 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, ",");
@@ -353,7 +353,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) {
@@ -1246,7 +1246,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);
}
/*
diff --git a/hw/xfree86/modes/xf86Cursors.c b/hw/xfree86/modes/xf86Cursors.c
index 5842a613c..038f1c89c 100644
--- a/hw/xfree86/modes/xf86Cursors.c
+++ b/hw/xfree86/modes/xf86Cursors.c
@@ -659,11 +659,8 @@ xf86_cursors_fini (ScreenPtr screen)
xf86DestroyCursorInfoRec (xf86_config->cursor_info);
xf86_config->cursor_info = NULL;
}
- if (xf86_config->cursor_image)
- {
- free(xf86_config->cursor_image);
- xf86_config->cursor_image = NULL;
- }
+ free(xf86_config->cursor_image);
+ xf86_config->cursor_image = NULL;
if (xf86_config->cursor)
{
FreeCursor (xf86_config->cursor, None);
diff --git a/hw/xfree86/os-support/bus/Sbus.c b/hw/xfree86/os-support/bus/Sbus.c
index 9ccc2898f..7829d803f 100644
--- a/hw/xfree86/os-support/bus/Sbus.c
+++ b/hw/xfree86/os-support/bus/Sbus.c
@@ -191,10 +191,8 @@ sparcPromClose(void)
close(promFd);
promFd = -1;
}
- if (promOpio) {
- free(promOpio);
- promOpio = NULL;
- }
+ free(promOpio);
+ promOpio = NULL;
promOpenCount = 0;
}
diff --git a/hw/xquartz/GL/indirect.c b/hw/xquartz/GL/indirect.c
index f769ff2ec..3e8d730f2 100644
--- a/hw/xquartz/GL/indirect.c
+++ b/hw/xquartz/GL/indirect.c
@@ -595,12 +595,12 @@ static __GLXscreen * __glXAquaScreenProbe(ScreenPtr pScreen) {
__glXScreenInit(&screen->base, pScreen);
- screen->base.GLXversion = xstrdup("1.4");
- screen->base.GLXextensions = xstrdup("GLX_SGIX_fbconfig "
- "GLX_SGIS_multisample "
- "GLX_ARB_multisample "
- "GLX_EXT_visual_info "
- "GLX_EXT_import_context ");
+ screen->base.GLXversion = strdup("1.4");
+ screen->base.GLXextensions = strdup("GLX_SGIX_fbconfig "
+ "GLX_SGIS_multisample "
+ "GLX_ARB_multisample "
+ "GLX_EXT_visual_info "
+ "GLX_EXT_import_context ");
/*We may be able to add more GLXextensions at a later time. */
diff --git a/hw/xwin/InitOutput.c b/hw/xwin/InitOutput.c
index 1ab059f72..73cc263bd 100644
--- a/hw/xwin/InitOutput.c
+++ b/hw/xwin/InitOutput.c
@@ -275,11 +275,8 @@ ddxGiveUp (void)
}
/* Free concatenated command line */
- if (g_pszCommandLine)
- {
- free (g_pszCommandLine);
- g_pszCommandLine = NULL;
- }
+ free(g_pszCommandLine);
+ g_pszCommandLine = NULL;
/* Remove our keyboard hook if it is installed */
winRemoveKeyboardHookLL ();
@@ -441,7 +438,7 @@ winFixupPaths (void)
int comment_block = FALSE;
/* get defautl fontpath */
- char *fontpath = xstrdup(defaultFontPath);
+ char *fontpath = strdup(defaultFontPath);
size_t size = strlen(fontpath);
/* read all lines */
@@ -528,7 +525,7 @@ winFixupPaths (void)
/* cleanup */
fclose(fontdirs);
- defaultFontPath = xstrdup(fontpath);
+ defaultFontPath = strdup(fontpath);
free(fontpath);
changed_fontpath = TRUE;
font_from = X_CONFIG;
@@ -600,7 +597,7 @@ winFixupPaths (void)
}
}
- defaultFontPath = xstrdup(newfp);
+ defaultFontPath = strdup(newfp);
free(newfp);
changed_fontpath = TRUE;
}
diff --git a/hw/xwin/glx/indirect.c b/hw/xwin/glx/indirect.c
index 5e0e917bc..8ec40da33 100755
--- a/hw/xwin/glx/indirect.c
+++ b/hw/xwin/glx/indirect.c
@@ -676,7 +676,7 @@ glxWinScreenProbe(ScreenPtr pScreen)
fbConfigsDump(screen->base.numFBConfigs, screen->base.fbconfigs);
// Override the GL extensions string set by __glXScreenInit()
- screen->base.GLextensions = xstrdup(gl_extensions);
+ screen->base.GLextensions = strdup(gl_extensions);
// Generate the GLX extensions string (overrides that set by __glXScreenInit())
{
@@ -706,13 +706,13 @@ glxWinScreenProbe(ScreenPtr pScreen)
if (screen->has_WGL_ARB_multisample)
{
- screen->base.GLXversion = xstrdup("1.4");
+ screen->base.GLXversion = strdup("1.4");
screen->base.GLXmajor = 1;
screen->base.GLXminor = 4;
}
else
{
- screen->base.GLXversion = xstrdup("1.3");
+ screen->base.GLXversion = strdup("1.3");
screen->base.GLXmajor = 1;
screen->base.GLXminor = 3;
}
diff --git a/hw/xwin/winconfig.c b/hw/xwin/winconfig.c
index ab49aaa7a..a88b6f1cf 100644
--- a/hw/xwin/winconfig.c
+++ b/hw/xwin/winconfig.c
@@ -583,7 +583,7 @@ winConfigFiles ()
else if (filesptr != NULL && filesptr->file_fontpath)
{
from = X_CONFIG;
- defaultFontPath = xstrdup (filesptr->file_fontpath);
+ defaultFontPath = strdup (filesptr->file_fontpath);
}
winMsg (from, "FontPath set to \"%s\"\n", defaultFontPath);
@@ -630,7 +630,7 @@ winSetStrOption (pointer optlist, const char *name, char *deflt)
if (ParseOptionValue (-1, optlist, &o))
deflt = o.value.str;
if (deflt)
- return xstrdup (deflt);
+ return strdup (deflt);
else
return NULL;
}
diff --git a/record/record.c b/record/record.c
index 53bdfec71..4117a5a02 100644
--- a/record/record.c
+++ b/record/record.c
@@ -2520,8 +2520,6 @@ RecordDeleteContext(pointer value, XID id)
}
}
- free(pContext);
-
/* remove context from AllContexts list */
if (-1 != (i = RecordFindContextOnAllContexts(pContext)))
@@ -2533,6 +2531,8 @@ RecordDeleteContext(pointer value, XID id)
ppAllContexts = NULL;
}
}
+ free(pContext);
+
return Success;
} /* RecordDeleteContext */
diff --git a/xkb/XKBGAlloc.c b/xkb/XKBGAlloc.c
index 796931cf4..d1adea34e 100644
--- a/xkb/XKBGAlloc.c
+++ b/xkb/XKBGAlloc.c
@@ -114,10 +114,8 @@ register char *ptr;
}
if (freeAll) {
(*num_inout)= (*sz_inout)= 0;
- if (*elems) {
- free(*elems);
- *elems= NULL;
- }
+ free(*elems);
+ *elems = NULL;
}
else if (first+count>=(*num_inout))
*num_inout= first;
@@ -137,14 +135,10 @@ _XkbClearProperty(char *prop_in)
{
XkbPropertyPtr prop= (XkbPropertyPtr)prop_in;
- if (prop->name) {
- free(prop->name);
- prop->name= NULL;
- }
- if (prop->value) {
- free(prop->value);
- prop->value= NULL;
- }
+ free(prop->name);
+ prop->name = NULL;
+ free(prop->value);
+ prop->value = NULL;
return;
}
diff --git a/xkb/XKBMAlloc.c b/xkb/XKBMAlloc.c
index 197523f57..6b186c1ad 100644
--- a/xkb/XKBMAlloc.c
+++ b/xkb/XKBMAlloc.c
@@ -221,18 +221,12 @@ XkbCopyKeyType(XkbKeyTypePtr from,XkbKeyTypePtr into)
{
if ((!from)||(!into))
return BadMatch;
- if (into->map) {
- free(into->map);
- into->map= NULL;
- }
- if (into->preserve) {
- free(into->preserve);
- into->preserve= NULL;
- }
- if (into->level_names) {
- free(into->level_names);
- into->level_names= NULL;
- }
+ free(into->map);
+ into->map = NULL;
+ free(into->preserve);
+ into->preserve = NULL;
+ free(into->level_names);
+ into->level_names = NULL;
*into= *from;
if ((from->map)&&(into->map_count>0)) {
into->map= calloc(into->map_count, sizeof(XkbKTMapEntryRec));
diff --git a/xkb/ddxList.c b/xkb/ddxList.c
index eee388749..2256424d0 100644
--- a/xkb/ddxList.c
+++ b/xkb/ddxList.c
@@ -208,10 +208,7 @@ char tmpname[PATH_MAX];
return BadImplementation;
}
list->nFound[what]= 0;
- if (buf) {
- free(buf);
- buf = NULL;
- }
+ free(buf);
buf = malloc(PATH_MAX * sizeof(char));
if (!buf)
return BadAlloc;
diff --git a/xkb/ddxLoad.c b/xkb/ddxLoad.c
index b1d629436..5e6ab8770 100644
--- a/xkb/ddxLoad.c
+++ b/xkb/ddxLoad.c
@@ -103,7 +103,7 @@ Win32System(const char *cmdline)
STARTUPINFO si;
PROCESS_INFORMATION pi;
DWORD dwExitCode;
- char *cmd = xstrdup(cmdline);
+ char *cmd = strdup(cmdline);
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
@@ -235,6 +235,11 @@ XkbDDXCompileKeymapByNames( XkbDescPtr xkb,
xkm_output_dir, keymap);
free(xkbbasedirflag);
+
+ if (!buf) {
+ LogMessage(X_ERROR, "XKB: Could not invoke xkbcomp: not enough memory\n");
+ return FALSE;
+ }
#ifndef WIN32
out= Popen(buf,"w");
diff --git a/xkb/xkb.c b/xkb/xkb.c
index cbb46c62f..bd73e9a8e 100644
--- a/xkb/xkb.c
+++ b/xkb/xkb.c
@@ -5510,10 +5510,8 @@ ProcXkbListComponents(ClientPtr client)
if ((XkbPaddedSize(len)/4)!=stuff->length)
return BadLength;
if ((status=XkbDDXList(dev,&list,client))!=Success) {
- if (list.pool) {
- free(list.pool);
- list.pool= NULL;
- }
+ free(list.pool);
+ list.pool = NULL;
return status;
}
memset(&rep, 0, sizeof(xkbListComponentsReply));
@@ -5886,11 +5884,16 @@ ProcXkbGetKbdByName(ClientPtr client)
XkbFreeKeyboard(new,XkbAllComponentsMask,TRUE);
new= NULL;
}
- if (names.keycodes) { free(names.keycodes); names.keycodes= NULL; }
- if (names.types) { free(names.types); names.types= NULL; }
- if (names.compat) { free(names.compat); names.compat= NULL; }
- if (names.symbols) { free(names.symbols); names.symbols= NULL; }
- if (names.geometry) { free(names.geometry); names.geometry= NULL; }
+ free(names.keycodes);
+ names.keycodes = NULL;
+ free(names.types);
+ names.types = NULL;
+ free(names.compat);
+ names.compat = NULL;
+ free(names.symbols);
+ names.symbols = NULL;
+ free(names.geometry);
+ names.geometry = NULL;
return Success;
}
diff --git a/xkb/xkbInit.c b/xkb/xkbInit.c
index bd58243ca..fbf8f14b8 100644
--- a/xkb/xkbInit.c
+++ b/xkb/xkbInit.c
@@ -635,10 +635,8 @@ unwind_key:
void
XkbFreeInfo(XkbSrvInfoPtr xkbi)
{
- if (xkbi->radioGroups) {
- free(xkbi->radioGroups);
- xkbi->radioGroups= NULL;
- }
+ free(xkbi->radioGroups);
+ xkbi->radioGroups = NULL;
if (xkbi->mouseKeyTimer) {
TimerFree(xkbi->mouseKeyTimer);
xkbi->mouseKeyTimer= NULL;
diff --git a/xkb/xkbUtils.c b/xkb/xkbUtils.c
index 72dd546d4..3344e5088 100644
--- a/xkb/xkbUtils.c
+++ b/xkb/xkbUtils.c
@@ -1761,15 +1761,15 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst)
if (sdoodad->any.type == XkbTextDoodad) {
if (sdoodad->text.text)
ddoodad->text.text =
- xstrdup(sdoodad->text.text);
+ strdup(sdoodad->text.text);
if (sdoodad->text.font)
ddoodad->text.font =
- xstrdup(sdoodad->text.font);
+ strdup(sdoodad->text.font);
}
else if (sdoodad->any.type == XkbLogoDoodad) {
if (sdoodad->logo.logo_name)
ddoodad->logo.logo_name =
- xstrdup(sdoodad->logo.logo_name);
+ strdup(sdoodad->logo.logo_name);
}
}
dsection->overlays = NULL;
@@ -1832,14 +1832,14 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst)
memcpy(ddoodad , sdoodad, sizeof(XkbDoodadRec));
if (sdoodad->any.type == XkbTextDoodad) {
if (sdoodad->text.text)
- ddoodad->text.text = xstrdup(sdoodad->text.text);
+ ddoodad->text.text = strdup(sdoodad->text.text);
if (sdoodad->text.font)
- ddoodad->text.font = xstrdup(sdoodad->text.font);
+ ddoodad->text.font = strdup(sdoodad->text.font);
}
else if (sdoodad->any.type == XkbLogoDoodad) {
if (sdoodad->logo.logo_name)
ddoodad->logo.logo_name =
- xstrdup(sdoodad->logo.logo_name);
+ strdup(sdoodad->logo.logo_name);
}
}