diff options
author | Cyril Brulebois <kibi@debian.org> | 2010-11-10 16:06:10 +0100 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2010-11-11 08:22:59 +1000 |
commit | 99275ad2fa99778afaefc54b62c8638afc59e755 (patch) | |
tree | 19e6b6373fe5bd3850c42dc69ff085689807f19c /xkb | |
parent | 9e999d18b004b8ead9c6c5d79b4a3d4bbf0e3152 (diff) |
Remove superfluous if(p!=NULL) checks around free(p); p=NULL;
This patch has been generated by the following Coccinelle semantic patch:
@@
expression E;
@@
- if (E != NULL) {
- free(E);
(
- E = NULL;
|
- E = 0;
)
- }
+ free(E);
+ E = NULL;
Signed-off-by: Cyril Brulebois <kibi@debian.org>
Reviewed-by: Mikhail Gusarov <dottedmag@dottedmag.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'xkb')
-rw-r--r-- | xkb/XKBAlloc.c | 6 | ||||
-rw-r--r-- | xkb/XKBGAlloc.c | 30 | ||||
-rw-r--r-- | xkb/XKBMAlloc.c | 34 |
3 files changed, 24 insertions, 46 deletions
diff --git a/xkb/XKBAlloc.c b/xkb/XKBAlloc.c index c52e091da..bffd60fce 100644 --- a/xkb/XKBAlloc.c +++ b/xkb/XKBAlloc.c @@ -212,10 +212,8 @@ XkbNamesPtr names; register XkbKeyTypePtr type; type= map->types; for (i=0;i<map->num_types;i++,type++) { - if (type->level_names!=NULL) { - free(type->level_names); - type->level_names= NULL; - } + free(type->level_names); + type->level_names = NULL; } } } diff --git a/xkb/XKBGAlloc.c b/xkb/XKBGAlloc.c index d1adea34e..3ec9edab8 100644 --- a/xkb/XKBGAlloc.c +++ b/xkb/XKBGAlloc.c @@ -50,10 +50,8 @@ _XkbFreeGeomLeafElems( Bool freeAll, { if ((freeAll)||(*elems==NULL)) { *num_inout= *sz_inout= 0; - if (*elems!=NULL) { - free(*elems); - *elems= NULL; - } + free(*elems); + *elems = NULL; return; } @@ -373,22 +371,16 @@ XkbDoodadPtr doodad= (XkbDoodadPtr)doodad_in; switch (doodad->any.type) { case XkbTextDoodad: { - if (doodad->text.text!=NULL) { - free(doodad->text.text); - doodad->text.text= NULL; - } - if (doodad->text.font!=NULL) { - free(doodad->text.font); - doodad->text.font= NULL; - } + free(doodad->text.text); + doodad->text.text = NULL; + free(doodad->text.font); + doodad->text.font = NULL; } break; case XkbLogoDoodad: { - if (doodad->logo.logo_name!=NULL) { - free(doodad->logo.logo_name); - doodad->logo.logo_name= NULL; - } + free(doodad->logo.logo_name); + doodad->logo.logo_name = NULL; } break; } @@ -434,10 +426,8 @@ XkbFreeGeometry(XkbGeometryPtr geom,unsigned which,Bool freeMap) if ((which&XkbGeomKeyAliasesMask)&&(geom->key_aliases!=NULL)) XkbFreeGeomKeyAliases(geom,0,geom->num_key_aliases,TRUE); if (freeMap) { - if (geom->label_font!=NULL) { - free(geom->label_font); - geom->label_font= NULL; - } + free(geom->label_font); + geom->label_font = NULL; free(geom); } return; diff --git a/xkb/XKBMAlloc.c b/xkb/XKBMAlloc.c index 6b186c1ad..e85a8af95 100644 --- a/xkb/XKBMAlloc.c +++ b/xkb/XKBMAlloc.c @@ -321,9 +321,9 @@ KeyCode matchingKeys[XkbMaxKeyCount],nMatchingKeys; return BadAlloc; } } - else if (type->preserve!=NULL) { + else { free(type->preserve); - type->preserve= NULL; + type->preserve = NULL; } type->map_count= map_count; } @@ -807,19 +807,13 @@ XkbClientMapPtr map; register int i; XkbKeyTypePtr type; for (i=0,type=map->types;i<map->num_types;i++,type++) { - if (type->map!=NULL) { - free(type->map); - type->map= NULL; - } - if (type->preserve!=NULL) { - free(type->preserve); - type->preserve= NULL; - } + free(type->map); + type->map = NULL; + free(type->preserve); + type->preserve = NULL; type->map_count= 0; - if (type->level_names!=NULL) { - free(type->level_names); - type->level_names= NULL; - } + free(type->level_names); + type->level_names = NULL; } } free(map->types); @@ -828,10 +822,8 @@ XkbClientMapPtr map; } } if (what&XkbKeySymsMask) { - if (map->key_sym_map!=NULL) { - free(map->key_sym_map); - map->key_sym_map= NULL; - } + free(map->key_sym_map); + map->key_sym_map = NULL; if (map->syms!=NULL) { free(map->syms); map->size_syms= map->num_syms= 0; @@ -864,10 +856,8 @@ XkbServerMapPtr map; map->explicit= NULL; } if (what&XkbKeyActionsMask) { - if (map->key_acts!=NULL) { - free(map->key_acts); - map->key_acts= NULL; - } + free(map->key_acts); + map->key_acts = NULL; if (map->acts!=NULL) { free(map->acts); map->num_acts= map->size_acts= 0; |