aboutsummaryrefslogtreecommitdiff
path: root/libX11
diff options
context:
space:
mode:
Diffstat (limited to 'libX11')
-rw-r--r--libX11/src/GetHints.c2
-rw-r--r--libX11/src/GetWMProto.c2
-rw-r--r--libX11/src/xkb/XKBAlloc.c3
-rw-r--r--libX11/src/xkb/XKBExtDev.c6
-rw-r--r--libX11/src/xkb/XKBGAlloc.c6
-rw-r--r--libX11/src/xkb/XKBGeom.c11
-rw-r--r--libX11/src/xkb/XKBMAlloc.c92
-rw-r--r--libX11/src/xkb/XKBNames.c4
-rw-r--r--libX11/src/xkb/XKBRdBuf.c4
-rw-r--r--libX11/src/xlibi18n/ICWrap.c10
-rw-r--r--libX11/src/xlibi18n/XDefaultOMIF.c36
-rw-r--r--libX11/src/xlibi18n/lcFile.c19
-rw-r--r--libX11/src/xlibi18n/lcGeneric.c10
-rw-r--r--libX11/src/xlibi18n/lcPrTxt.c3
-rw-r--r--libX11/src/xlibi18n/lcPublic.c20
-rw-r--r--libX11/src/xlibi18n/lcWrap.c3
16 files changed, 96 insertions, 135 deletions
diff --git a/libX11/src/GetHints.c b/libX11/src/GetHints.c
index 513b4b090..f2e1d5676 100644
--- a/libX11/src/GetHints.c
+++ b/libX11/src/GetHints.c
@@ -258,7 +258,7 @@ Status XGetCommand (
return (0);
}
- if (tp.value) Xfree (tp.value);
+ Xfree (tp.value);
*argvp = argv;
*argcp = argc;
return 1;
diff --git a/libX11/src/GetWMProto.c b/libX11/src/GetWMProto.c
index 4e9f12c22..cc1618d86 100644
--- a/libX11/src/GetWMProto.c
+++ b/libX11/src/GetWMProto.c
@@ -77,7 +77,7 @@ Status XGetWMProtocols (
return False;
if (actual_type != XA_ATOM || actual_format != 32) {
- if (data) Xfree (data);
+ Xfree (data);
return False;
}
diff --git a/libX11/src/xkb/XKBAlloc.c b/libX11/src/xkb/XKBAlloc.c
index 5cfef0fb8..50a5764d6 100644
--- a/libX11/src/xkb/XKBAlloc.c
+++ b/libX11/src/xkb/XKBAlloc.c
@@ -442,8 +442,7 @@ XkbAllocDeviceInfo(unsigned deviceSpec, unsigned nButtons, unsigned szLeds)
devi->sz_leds = szLeds;
devi->leds = _XkbTypedCalloc(szLeds, XkbDeviceLedInfoRec);
if (!devi->leds) {
- if (devi->btn_acts)
- _XkbFree(devi->btn_acts);
+ _XkbFree(devi->btn_acts);
_XkbFree(devi);
return NULL;
}
diff --git a/libX11/src/xkb/XKBExtDev.c b/libX11/src/xkb/XKBExtDev.c
index 4065dcd0e..b9710f86b 100644
--- a/libX11/src/xkb/XKBExtDev.c
+++ b/libX11/src/xkb/XKBExtDev.c
@@ -194,8 +194,8 @@ _XkbReadGetDeviceInfoReply(Display *dpy,
act = &devi->btn_acts[rep->firstBtnWanted];
bzero((char *) act, (rep->nBtnsWanted * sizeof(XkbAction)));
}
- if (devi->name != NULL)
- _XkbFree(devi->name);
+
+ _XkbFree(devi->name);
if (!_XkbGetReadBufferCountedString(&buf, &devi->name))
goto BAILOUT;
if (rep->nBtnsRtrn > 0) {
@@ -475,7 +475,7 @@ _InitLedStuff(SetLedStuff *stuff, unsigned wanted, XkbDeviceInfoPtr devi)
static void
_FreeLedStuff(SetLedStuff * stuff)
{
- if ((stuff->num_info > 0) && (stuff->info != NULL))
+ if (stuff->num_info > 0)
_XkbFree(stuff->info);
bzero(stuff, sizeof(SetLedStuff));
return;
diff --git a/libX11/src/xkb/XKBGAlloc.c b/libX11/src/xkb/XKBGAlloc.c
index ecac4f33c..64d47f19b 100644
--- a/libX11/src/xkb/XKBGAlloc.c
+++ b/libX11/src/xkb/XKBGAlloc.c
@@ -179,8 +179,7 @@ _XkbClearColor(char *color_in)
{
XkbColorPtr color = (XkbColorPtr) color_in;
- if (color->spec)
- _XkbFree(color->spec);
+ _XkbFree(color->spec);
return;
}
@@ -662,8 +661,7 @@ XkbAddGeomProperty(XkbGeometryPtr geom, char *name, char *value)
return NULL;
for (i = 0, prop = geom->properties; i < geom->num_properties; i++, prop++) {
if ((prop->name) && (strcmp(name, prop->name) == 0)) {
- if (prop->value)
- _XkbFree(prop->value);
+ _XkbFree(prop->value);
prop->value = strdup(value);
return prop;
}
diff --git a/libX11/src/xkb/XKBGeom.c b/libX11/src/xkb/XKBGeom.c
index c42a453e4..ea52b85f1 100644
--- a/libX11/src/xkb/XKBGeom.c
+++ b/libX11/src/xkb/XKBGeom.c
@@ -265,10 +265,9 @@ _XkbReadGeomProperties(XkbReadBufferPtr buf,
ok = _XkbGetReadBufferCountedString(buf, &name) && ok;
ok = _XkbGetReadBufferCountedString(buf, &value) && ok;
ok = ok && (XkbAddGeomProperty(geom, name, value) != NULL);
- if (name)
- _XkbFree(name);
- if (value)
- _XkbFree(value);
+
+ _XkbFree(name);
+ _XkbFree(value);
}
if (ok)
rtrn = Success;
@@ -318,8 +317,8 @@ _XkbReadGeomColors(XkbReadBufferPtr buf,
rtrn = BadLength;
else if (XkbAddGeomColor(geom, spec, geom->num_colors) == NULL)
rtrn = BadAlloc;
- if (spec)
- _XkbFree(spec);
+
+ _XkbFree(spec);
if (rtrn != Success)
return rtrn;
}
diff --git a/libX11/src/xkb/XKBMAlloc.c b/libX11/src/xkb/XKBMAlloc.c
index f27fe4ec3..0b86aa1d5 100644
--- a/libX11/src/xkb/XKBMAlloc.c
+++ b/libX11/src/xkb/XKBMAlloc.c
@@ -226,18 +226,16 @@ XkbCopyKeyType(XkbKeyTypePtr from, XkbKeyTypePtr into)
{
if ((!from) || (!into))
return BadMatch;
- if (into->map) {
- _XkbFree(into->map);
- into->map = NULL;
- }
- if (into->preserve) {
- _XkbFree(into->preserve);
- into->preserve = NULL;
- }
- if (into->level_names) {
- _XkbFree(into->level_names);
- into->level_names = NULL;
- }
+
+ _XkbFree(into->map);
+ into->map = NULL;
+
+ _XkbFree(into->preserve);
+ into->preserve = NULL;
+
+ _XkbFree(into->level_names);
+ into->level_names = NULL;
+
*into = *from;
if ((from->map) && (into->map_count > 0)) {
into->map = _XkbTypedCalloc(into->map_count, XkbKTMapEntryRec);
@@ -385,11 +383,9 @@ XkbResizeKeyType(XkbDescPtr xkb,
}
type = &xkb->map->types[type_ndx];
if (map_count == 0) {
- if (type->map != NULL)
- _XkbFree(type->map);
+ _XkbFree(type->map);
type->map = NULL;
- if (type->preserve != NULL)
- _XkbFree(type->preserve);
+ _XkbFree(type->preserve);
type->preserve = NULL;
type->map_count = 0;
}
@@ -400,8 +396,7 @@ XkbResizeKeyType(XkbDescPtr xkb,
type->map =
_XkbTypedRealloc(type->map, map_count, XkbKTMapEntryRec);
if (!type->map) {
- if (prev_map)
- _XkbFree(prev_map);
+ _XkbFree(prev_map);
return BadAlloc;
}
if (want_preserve) {
@@ -412,12 +407,11 @@ XkbResizeKeyType(XkbDescPtr xkb,
XkbModsRec);
}
if (!type->preserve) {
- if (prev_preserve)
- _XkbFree(prev_preserve);
+ _XkbFree(prev_preserve);
return BadAlloc;
}
}
- else if (type->preserve != NULL) {
+ else {
_XkbFree(type->preserve);
type->preserve = NULL;
}
@@ -430,8 +424,7 @@ XkbResizeKeyType(XkbDescPtr xkb,
type->level_names =
_XkbTypedRealloc(type->level_names, new_num_lvls, Atom);
if (!type->level_names) {
- if (prev_level_names)
- _XkbFree(prev_level_names);
+ _XkbFree(prev_level_names);
return BadAlloc;
}
}
@@ -919,19 +912,16 @@ XkbFreeClientMap(XkbDescPtr xkb, unsigned what, Bool freeMap)
XkbKeyTypePtr type;
for (i = 0, type = map->types; i < map->num_types; i++, type++) {
- if (type->map != NULL) {
- _XkbFree(type->map);
- type->map = NULL;
- }
- if (type->preserve != NULL) {
- _XkbFree(type->preserve);
- type->preserve = NULL;
- }
+ _XkbFree(type->map);
+ type->map = NULL;
+
+ _XkbFree(type->preserve);
+ type->preserve = NULL;
+
type->map_count = 0;
- if (type->level_names != NULL) {
- _XkbFree(type->level_names);
- type->level_names = NULL;
- }
+
+ _XkbFree(type->level_names);
+ type->level_names = NULL;
}
}
_XkbFree(map->types);
@@ -940,17 +930,14 @@ XkbFreeClientMap(XkbDescPtr xkb, unsigned what, Bool freeMap)
}
}
if (what & XkbKeySymsMask) {
- if (map->key_sym_map != NULL) {
- _XkbFree(map->key_sym_map);
- map->key_sym_map = NULL;
- }
- if (map->syms != NULL) {
- _XkbFree(map->syms);
- map->size_syms = map->num_syms = 0;
- map->syms = NULL;
- }
+ _XkbFree(map->key_sym_map);
+ map->key_sym_map = NULL;
+
+ _XkbFree(map->syms);
+ map->size_syms = map->num_syms = 0;
+ map->syms = NULL;
}
- if ((what & XkbModifierMapMask) && (map->modmap != NULL)) {
+ if (what & XkbModifierMapMask) {
_XkbFree(map->modmap);
map->modmap = NULL;
}
@@ -971,26 +958,23 @@ XkbFreeServerMap(XkbDescPtr xkb, unsigned what, Bool freeMap)
if (freeMap)
what = XkbAllServerInfoMask;
map = xkb->server;
- if ((what & XkbExplicitComponentsMask) && (map->explicit != NULL)) {
+ if (what & XkbExplicitComponentsMask) {
_XkbFree(map->explicit);
map->explicit = NULL;
}
if (what & XkbKeyActionsMask) {
- if (map->key_acts != NULL) {
- _XkbFree(map->key_acts);
+ _XkbFree(map->key_acts);
map->key_acts = NULL;
- }
- if (map->acts != NULL) {
- _XkbFree(map->acts);
+
+ _XkbFree(map->acts);
map->num_acts = map->size_acts = 0;
map->acts = NULL;
- }
}
- if ((what & XkbKeyBehaviorsMask) && (map->behaviors != NULL)) {
+ if (what & XkbKeyBehaviorsMask) {
_XkbFree(map->behaviors);
map->behaviors = NULL;
}
- if ((what & XkbVirtualModMapMask) && (map->vmodmap != NULL)) {
+ if (what & XkbVirtualModMapMask) {
_XkbFree(map->vmodmap);
map->vmodmap = NULL;
}
diff --git a/libX11/src/xkb/XKBNames.c b/libX11/src/xkb/XKBNames.c
index 5a3fb6f8d..6c4800c29 100644
--- a/libX11/src/xkb/XKBNames.c
+++ b/libX11/src/xkb/XKBNames.c
@@ -133,8 +133,8 @@ _XkbReadGetNamesReply(Display *dpy,
if ((nLevels[i] > 0) && (nLevels[i] != type->num_levels)) {
goto BAILOUT;
}
- if (type->level_names != NULL)
- Xfree(type->level_names);
+
+ Xfree(type->level_names);
if (nLevels[i] == 0) {
type->level_names = NULL;
continue;
diff --git a/libX11/src/xkb/XKBRdBuf.c b/libX11/src/xkb/XKBRdBuf.c
index 8e9eab238..0a29bdca4 100644
--- a/libX11/src/xkb/XKBRdBuf.c
+++ b/libX11/src/xkb/XKBRdBuf.c
@@ -167,8 +167,8 @@ _XkbFreeReadBuffer(XkbReadBufferPtr buf)
int left;
left = (int) _XkbReadBufferDataLeft(buf);
- if (buf->start != NULL)
- Xfree(buf->start);
+
+ Xfree(buf->start);
buf->size = 0;
buf->start = buf->data = NULL;
return left;
diff --git a/libX11/src/xlibi18n/ICWrap.c b/libX11/src/xlibi18n/ICWrap.c
index 2a1d0d670..8c1b4a01c 100644
--- a/libX11/src/xlibi18n/ICWrap.c
+++ b/libX11/src/xlibi18n/ICWrap.c
@@ -186,7 +186,7 @@ XSetIMValues(XIM im, ...)
va_end(var);
ret = (*im->methods->set_values) (im, args);
- if (args) Xfree(args);
+ Xfree(args);
return ret;
}
@@ -213,7 +213,7 @@ XGetIMValues(XIM im, ...)
va_end(var);
ret = (*im->methods->get_values) (im, args);
- if (args) Xfree(args);
+ Xfree(args);
return ret;
}
@@ -245,7 +245,7 @@ XCreateIC(XIM im, ...)
va_end(var);
ic = (XIC) (*im->methods->create_ic) (im, args);
- if (args) Xfree(args);
+ Xfree(args);
if (ic) {
ic->core.next = im->core.ic_chain;
im->core.ic_chain = ic;
@@ -300,7 +300,7 @@ XGetICValues(XIC ic, ...)
va_end(var);
ret = (*ic->methods->get_values) (ic, args);
- if (args) Xfree(args);
+ Xfree(args);
return ret;
}
@@ -330,7 +330,7 @@ XSetICValues(XIC ic, ...)
va_end(var);
ret = (*ic->methods->set_values) (ic, args);
- if (args) Xfree(args);
+ Xfree(args);
return ret;
}
diff --git a/libX11/src/xlibi18n/XDefaultOMIF.c b/libX11/src/xlibi18n/XDefaultOMIF.c
index 2ff6c414c..007b443a1 100644
--- a/libX11/src/xlibi18n/XDefaultOMIF.c
+++ b/libX11/src/xlibi18n/XDefaultOMIF.c
@@ -369,8 +369,8 @@ init_core_part(
return True;
err:
- if (font_name_list)
- Xfree(font_name_list);
+
+ Xfree(font_name_list);
Xfree(font_struct_list);
return False;
@@ -638,14 +638,10 @@ destroy_oc(
XOCGenericPart *gen = XOC_GENERIC(oc);
XFontStruct **font_list, *font;
- if (gen->font_set)
- Xfree(gen->font_set);
-
- if (oc->core.base_name_list)
- Xfree(oc->core.base_name_list);
- if (oc->core.font_info.font_name_list)
- XFreeStringList(oc->core.font_info.font_name_list);
+ Xfree(gen->font_set);
+ Xfree(oc->core.base_name_list);
+ XFreeStringList(oc->core.font_info.font_name_list);
if ((font_list = oc->core.font_info.font_struct_list)) {
if ((font = *font_list)) {
@@ -657,14 +653,12 @@ destroy_oc(
Xfree(oc->core.font_info.font_struct_list);
}
- if (oc->core.missing_list.charset_list)
- XFreeStringList(oc->core.missing_list.charset_list);
+
+ XFreeStringList(oc->core.missing_list.charset_list);
#ifdef notdef
- if (oc->core.res_name)
- Xfree(oc->core.res_name);
- if (oc->core.res_class)
- Xfree(oc->core.res_class);
+ Xfree(oc->core.res_name);
+ Xfree(oc->core.res_class);
#endif
Xfree(oc);
@@ -1045,7 +1039,6 @@ close_om(
if (data->font_data) {
for (font_data = data->font_data, count = data->font_data_count;
count-- > 0 ; font_data++) {
- if (font_data->name)
Xfree(font_data->name);
}
Xfree(data->font_data);
@@ -1053,17 +1046,16 @@ close_om(
Xfree(gen->data);
}
- if (om->core.res_name)
- Xfree(om->core.res_name);
- if (om->core.res_class)
- Xfree(om->core.res_class);
+
+ Xfree(om->core.res_name);
+ Xfree(om->core.res_class);
+
if (om->core.required_charset.charset_list)
XFreeStringList(om->core.required_charset.charset_list);
else
Xfree((char*)om->core.required_charset.charset_list);
- if (om->core.orientation_list.orientation)
- Xfree(om->core.orientation_list.orientation);
+ Xfree(om->core.orientation_list.orientation);
Xfree(om);
return 1;
diff --git a/libX11/src/xlibi18n/lcFile.c b/libX11/src/xlibi18n/lcFile.c
index c3ea02ead..f74147496 100644
--- a/libX11/src/xlibi18n/lcFile.c
+++ b/libX11/src/xlibi18n/lcFile.c
@@ -554,7 +554,7 @@ _XlcResolveLocaleName(
break;
}
}
- if (nlc_name) Xfree(nlc_name);
+ Xfree(nlc_name);
if (name == NULL) {
/* vendor locale name == Xlocale name, no expansion of alias */
@@ -672,19 +672,18 @@ _XlcLocaleDirName(char *dir_name, size_t dir_len, const char *lc_name)
target_name = NULL;
}
}
- if (nlc_name) Xfree(nlc_name);
+ Xfree(nlc_name);
if (target_name == NULL)
/* vendor locale name == Xlocale name, no expansion of alias */
snprintf(dir_name, dir_len, "%s/%s", args[0], lc_name);
else
snprintf(dir_name, dir_len, "%s/%s", target_dir, target_name);
+
Xfree(target_name);
+ Xfree (last_dir_name);
+ Xfree (last_lc_name);
- if (last_dir_name != 0)
- Xfree (last_dir_name);
- if (last_lc_name != 0)
- Xfree (last_lc_name);
last_dir_len = strlen (dir_name) + 1;
last_dir_name = Xmalloc (last_dir_len);
strcpy (last_dir_name, dir_name);
@@ -751,7 +750,7 @@ _XlcLocaleLibDirName(char *dir_name, size_t dir_len, const char *lc_name)
target_name = NULL;
}
}
- if (nlc_name) Xfree(nlc_name);
+ Xfree(nlc_name);
if (target_name == NULL)
/* vendor locale name == Xlocale name, no expansion of alias */
@@ -759,11 +758,9 @@ _XlcLocaleLibDirName(char *dir_name, size_t dir_len, const char *lc_name)
else
snprintf(dir_name, dir_len, "%s/%s", target_dir, target_name);
Xfree(target_name);
+ Xfree (last_dir_name);
+ Xfree (last_lc_name);
- if (last_dir_name != 0)
- Xfree (last_dir_name);
- if (last_lc_name != 0)
- Xfree (last_lc_name);
last_dir_len = strlen (dir_name) + 1;
last_dir_name = Xmalloc (last_dir_len);
strcpy (last_dir_name, dir_name);
diff --git a/libX11/src/xlibi18n/lcGeneric.c b/libX11/src/xlibi18n/lcGeneric.c
index 13405a65b..ba8dd7028 100644
--- a/libX11/src/xlibi18n/lcGeneric.c
+++ b/libX11/src/xlibi18n/lcGeneric.c
@@ -260,8 +260,8 @@ add_parse_list(
err:
Xfree(str);
- if (new)
- Xfree(new);
+
+ Xfree(new);
return False;
}
@@ -274,12 +274,10 @@ free_charset(
ParseInfo *parse_info;
int num;
- if (gen->mb_parse_table)
- Xfree(gen->mb_parse_table);
+ Xfree(gen->mb_parse_table);
if ((num = gen->mb_parse_list_num) > 0) {
for (parse_info = gen->mb_parse_list; num-- > 0; parse_info++) {
- if ((*parse_info)->encoding)
- Xfree((*parse_info)->encoding);
+ Xfree((*parse_info)->encoding);
Xfree(*parse_info);
}
Xfree(gen->mb_parse_list);
diff --git a/libX11/src/xlibi18n/lcPrTxt.c b/libX11/src/xlibi18n/lcPrTxt.c
index 47d11f096..72fc2b927 100644
--- a/libX11/src/xlibi18n/lcPrTxt.c
+++ b/libX11/src/xlibi18n/lcPrTxt.c
@@ -283,8 +283,7 @@ _XwcFreeStringList(
wchar_t **list)
{
if (list) {
- if (*list)
- Xfree(*list);
+ Xfree(*list);
Xfree(list);
}
}
diff --git a/libX11/src/xlibi18n/lcPublic.c b/libX11/src/xlibi18n/lcPublic.c
index 46c652e2b..8e817a8cc 100644
--- a/libX11/src/xlibi18n/lcPublic.c
+++ b/libX11/src/xlibi18n/lcPublic.c
@@ -255,16 +255,14 @@ static void
destroy_core(
XLCd lcd)
{
- if (lcd->core) {
- if (lcd->core->name)
+ if (lcd) {
+ if (lcd->core) {
Xfree(lcd->core->name);
- Xfree(lcd->core);
+ Xfree(lcd->core);
+ }
+ Xfree(lcd->methods);
+ Xfree(lcd);
}
-
- if (lcd->methods)
- Xfree(lcd->methods);
-
- Xfree(lcd);
}
static void
@@ -275,10 +273,8 @@ destroy(
_XlcDestroyLocaleDataBase(lcd);
- if (pub->siname)
- Xfree(pub->siname);
- if (pub->encoding_name)
- Xfree(pub->encoding_name);
+ Xfree(pub->siname);
+ Xfree(pub->encoding_name);
destroy_core(lcd);
}
diff --git a/libX11/src/xlibi18n/lcWrap.c b/libX11/src/xlibi18n/lcWrap.c
index 034bd3c0d..382426082 100644
--- a/libX11/src/xlibi18n/lcWrap.c
+++ b/libX11/src/xlibi18n/lcWrap.c
@@ -86,8 +86,7 @@ XSetLocaleModifiers(
user_mods = getenv("XMODIFIERS");
mapped_mods = (*lcd->methods->map_modifiers) (lcd, user_mods, modifiers);
if (mapped_mods) {
- if (lcd->core->modifiers)
- Xfree(lcd->core->modifiers);
+ Xfree(lcd->core->modifiers);
lcd->core->modifiers = mapped_mods;
}
return mapped_mods;