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 --- geometry.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'geometry.c') diff --git a/geometry.c b/geometry.c index cbacba6..032872a 100644 --- a/geometry.c +++ b/geometry.c @@ -291,10 +291,8 @@ FreeProperties(PropertyInfo * pi, GeometryInfo * info) } for (tmp = pi; tmp != NULL; tmp = next) { - if (tmp->name) - free(tmp->name); - if (tmp->value) - free(tmp->value); + free(tmp->name); + free(tmp->value); tmp->name = tmp->value = NULL; next = (PropertyInfo *) tmp->defs.next; free(tmp); @@ -676,8 +674,7 @@ InitGeometryInfo(GeometryInfo * info, unsigned fileID, unsigned merge) static void ClearGeometryInfo(GeometryInfo * info) { - if (info->name) - free(info->name); + free(info->name); info->name = NULL; if (info->props) FreeProperties(info->props, info); @@ -750,8 +747,7 @@ AddProperty(GeometryInfo * info, PropertyInfo * new) ACTION("Ignoring \"%s\", using \"%s\"\n", old->value, new->value); } - if (old->value) - free(old->value); + free(old->value); old->value = uStringDup(new->value); return True; } @@ -1352,8 +1348,7 @@ HandleIncludeGeometry(IncludeStmt * stmt, XkbDescPtr xkb, GeometryInfo * info, (*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; } -- cgit v1.2.3