summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorwalter harms <wharms@bfs.de>2014-06-07 15:17:27 +0200
committerPeter Hutterer <peter.hutterer@who-t.net>2014-06-17 10:54:16 +1000
commit602d7f5030fe93b2fe7f29fb7310deb6f50cb6df (patch)
tree37d94bc0d9a036277a428879ba69f1c6607190a1 /src
parentd81fed46144d089bdfa1d916a28dffc9ebffe1e4 (diff)
libX11: rm redundante NULL checks
This patch removes the last remaining NULL checks for Xfree() Signed-off-by: Harms <wharms@bfs,de> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'src')
-rw-r--r--src/GetWMProto.c2
-rw-r--r--src/xkb/XKBGAlloc.c6
-rw-r--r--src/xlibi18n/ICWrap.c10
-rw-r--r--src/xlibi18n/XDefaultOMIF.c36
-rw-r--r--src/xlibi18n/lcFile.c19
-rw-r--r--src/xlibi18n/lcGeneric.c10
-rw-r--r--src/xlibi18n/lcPrTxt.c3
-rw-r--r--src/xlibi18n/lcPublic.c20
-rw-r--r--src/xlibi18n/lcWrap.c3
9 files changed, 44 insertions, 65 deletions
diff --git a/src/GetWMProto.c b/src/GetWMProto.c
index 4e9f12c2..cc1618d8 100644
--- a/src/GetWMProto.c
+++ b/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/src/xkb/XKBGAlloc.c b/src/xkb/XKBGAlloc.c
index 63bb2db3..6326c8d4 100644
--- a/src/xkb/XKBGAlloc.c
+++ b/src/xkb/XKBGAlloc.c
@@ -177,8 +177,7 @@ _XkbClearColor(char *color_in)
{
XkbColorPtr color = (XkbColorPtr) color_in;
- if (color->spec)
- _XkbFree(color->spec);
+ _XkbFree(color->spec);
return;
}
@@ -660,8 +659,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/src/xlibi18n/ICWrap.c b/src/xlibi18n/ICWrap.c
index 2a1d0d67..8c1b4a01 100644
--- a/src/xlibi18n/ICWrap.c
+++ b/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/src/xlibi18n/XDefaultOMIF.c b/src/xlibi18n/XDefaultOMIF.c
index a06f69a1..1a707c84 100644
--- a/src/xlibi18n/XDefaultOMIF.c
+++ b/src/xlibi18n/XDefaultOMIF.c
@@ -367,8 +367,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;
@@ -636,14 +636,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)) {
@@ -655,14 +651,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);
@@ -1043,7 +1037,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);
@@ -1051,17 +1044,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/src/xlibi18n/lcFile.c b/src/xlibi18n/lcFile.c
index bf890845..e43ac2c0 100644
--- a/src/xlibi18n/lcFile.c
+++ b/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/src/xlibi18n/lcGeneric.c b/src/xlibi18n/lcGeneric.c
index 20c455c1..1c78a95c 100644
--- a/src/xlibi18n/lcGeneric.c
+++ b/src/xlibi18n/lcGeneric.c
@@ -259,8 +259,8 @@ add_parse_list(
err:
Xfree(str);
- if (new)
- Xfree(new);
+
+ Xfree(new);
return False;
}
@@ -273,12 +273,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/src/xlibi18n/lcPrTxt.c b/src/xlibi18n/lcPrTxt.c
index 47d11f09..72fc2b92 100644
--- a/src/xlibi18n/lcPrTxt.c
+++ b/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/src/xlibi18n/lcPublic.c b/src/xlibi18n/lcPublic.c
index 39ec0829..98a7435f 100644
--- a/src/xlibi18n/lcPublic.c
+++ b/src/xlibi18n/lcPublic.c
@@ -254,16 +254,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
@@ -274,10 +272,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/src/xlibi18n/lcWrap.c b/src/xlibi18n/lcWrap.c
index 034bd3c0..38242608 100644
--- a/src/xlibi18n/lcWrap.c
+++ b/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;