diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2022-12-10 14:23:11 -0800 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2022-12-11 15:36:06 -0800 |
commit | 5655379ce89ab55f25a536972aaa310480de9432 (patch) | |
tree | aa9cffb76485caf32da96d8d689f5a0ce6ab6c11 /symbols.c | |
parent | 2ac6a7f029d8855fbb4e8024aab0511727ac3a67 (diff) |
Remove unnecessary checks for NULL pointers before calling free()
Not needed in C89 and later
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Diffstat (limited to 'symbols.c')
-rw-r--r-- | symbols.c | 30 |
1 files changed, 10 insertions, 20 deletions
@@ -123,11 +123,9 @@ FreeKeyInfo(KeyInfo * info) { info->numLevels[i] = 0; info->types[i] = None; - if (info->syms[i] != NULL) - free(info->syms[i]); + free(info->syms[i]); info->syms[i] = NULL; - if (info->acts[i] != NULL) - free(info->acts[i]); + free(info->acts[i]); info->acts[i] = NULL; } info->dfltType = None; @@ -256,8 +254,7 @@ InitSymbolsInfo(SymbolsInfo * info, XkbDescPtr xkb) static void FreeSymbolsInfo(SymbolsInfo * info) { - if (info->name) - free(info->name); + free(info->name); info->name = NULL; if (info->keys) { @@ -475,10 +472,8 @@ MergeKeys(SymbolsInfo * info, KeyInfo * into, KeyInfo * from) { if (into->numLevels[i] != 0) { - if (into->syms[i]) - free(into->syms[i]); - if (into->acts[i]) - free(into->acts[i]); + free(into->syms[i]); + free(into->acts[i]); } } *into = *from; @@ -787,8 +782,7 @@ HandleIncludeSymbols(IncludeStmt * stmt, (*hndlr) (rtrn, xkb, MergeOverride, &included); if (stmt->stmt != NULL) { - if (included.name != NULL) - free(included.name); + free(included.name); included.name = stmt->stmt; stmt->stmt = NULL; } @@ -1533,11 +1527,9 @@ SetExplicitGroup(SymbolsInfo * info, KeyInfo * key) for (int i = 1; i < XkbNumKbdGroups; i++) { key->numLevels[i] = 0; - if (key->syms[i] != NULL) - free(key->syms[i]); + free(key->syms[i]); key->syms[i] = (KeySym *) NULL; - if (key->acts[i] != NULL) - free(key->acts[i]); + free(key->acts[i]); key->acts[i] = (XkbAction *) NULL; key->types[i] = (Atom) 0; } @@ -1923,11 +1915,9 @@ PrepareKeyDef(KeyInfo * key) for (i = lastGroup; i > 0; i--) { key->numLevels[i] = 0; - if (key->syms[i] != NULL) - free(key->syms[i]); + free(key->syms[i]); key->syms[i] = (KeySym *) NULL; - if (key->acts[i] != NULL) - free(key->acts[i]); + free(key->acts[i]); key->acts[i] = (XkbAction *) NULL; key->types[i] = (Atom) 0; } |