[PATCH libX11 3/3] no need to check argument for _XkbFree()

walter harms wharms at bfs.de
Mon Apr 11 16:26:52 UTC 2016



simplify code by removing unneeded checks

Signed-off-by: walter harms <wharms at bfs.de>

---
 src/xkb/XKBAlloc.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/src/xkb/XKBAlloc.c b/src/xkb/XKBAlloc.c
index a675555..5577342 100644
--- a/src/xkb/XKBAlloc.c
+++ b/src/xkb/XKBAlloc.c
@@ -215,24 +215,22 @@ XkbFreeNames(XkbDescPtr xkb, unsigned which, Bool freeMap)

             type = map->types;
             for (i = 0; i < map->num_types; i++, type++) {
-                if (type->level_names != NULL) {
                     _XkbFree(type->level_names);
                     type->level_names = NULL;
-                }
             }
         }
     }
-    if ((which & XkbKeyNamesMask) && (names->keys != NULL)) {
+    if (which & XkbKeyNamesMask) {
         _XkbFree(names->keys);
         names->keys = NULL;
         names->num_keys = 0;
     }
-    if ((which & XkbKeyAliasesMask) && (names->key_aliases)) {
+    if (which & XkbKeyAliasesMask) {
         _XkbFree(names->key_aliases);
         names->key_aliases = NULL;
         names->num_key_aliases = 0;
     }
-    if ((which & XkbRGNamesMask) && (names->radio_groups)) {
+    if (which & XkbRGNamesMask) {
         _XkbFree(names->radio_groups);
         names->radio_groups = NULL;
         names->num_rg = 0;
-- 
2.1.4



More information about the xorg-devel mailing list