summaryrefslogtreecommitdiff
path: root/geometry.c
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2022-12-10 14:23:11 -0800
committerAlan Coopersmith <alan.coopersmith@oracle.com>2022-12-11 15:36:06 -0800
commit5655379ce89ab55f25a536972aaa310480de9432 (patch)
treeaa9cffb76485caf32da96d8d689f5a0ce6ab6c11 /geometry.c
parent2ac6a7f029d8855fbb4e8024aab0511727ac3a67 (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 'geometry.c')
-rw-r--r--geometry.c15
1 files changed, 5 insertions, 10 deletions
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;
}