From 5655379ce89ab55f25a536972aaa310480de9432 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Sat, 10 Dec 2022 14:23:11 -0800 Subject: Remove unnecessary checks for NULL pointers before calling free() Not needed in C89 and later Signed-off-by: Alan Coopersmith --- keytypes.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) (limited to 'keytypes.c') diff --git a/keytypes.c b/keytypes.c index 8f6d5c7..74f0d26 100644 --- a/keytypes.c +++ b/keytypes.c @@ -202,16 +202,12 @@ InitKeyTypesInfo(KeyTypesInfo * info, XkbDescPtr xkb, KeyTypesInfo * from) static void FreeKeyTypeInfo(KeyTypeInfo * type) { - if (type->entries != NULL) - { - free(type->entries); - type->entries = NULL; - } - if (type->lvlNames != NULL) - { - free(type->lvlNames); - type->lvlNames = NULL; - } + free(type->entries); + type->entries = NULL; + + free(type->lvlNames); + type->lvlNames = NULL; + if (type->preserve != NULL) { ClearCommonInfo(&type->preserve->defs); @@ -224,8 +220,7 @@ static void FreeKeyTypesInfo(KeyTypesInfo * info) { info->dpy = NULL; - if (info->name) - free(info->name); + free(info->name); info->name = NULL; if (info->types) { @@ -420,8 +415,7 @@ HandleIncludeKeyTypes(IncludeStmt * stmt, (*hndlr) (rtrn, xkb, newMerge, &included); if (stmt->stmt != NULL) { - if (included.name != NULL) - free(included.name); + free(included.name); included.name = stmt->stmt; stmt->stmt = NULL; } -- cgit v1.2.3