summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2022-12-10 14:10:32 -0800
committerAlan Coopersmith <alan.coopersmith@oracle.com>2022-12-11 15:36:06 -0800
commit2ac6a7f029d8855fbb4e8024aab0511727ac3a67 (patch)
treee358d01442ad5e619d9f328a79c9309cf6ff6672
parent8d85bd1e2f9473958b235caf7af9913b518f73dd (diff)
Replace uFree() with direct free() calls
All these wrappers did was mess with types and add a test for NULL pointers that isn't needed in C89 and later. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--compat.c6
-rw-r--r--geometry.c30
-rw-r--r--indicators.c12
-rw-r--r--keycodes.c6
-rw-r--r--keytypes.c8
-rw-r--r--listing.c4
-rw-r--r--misc.c2
-rw-r--r--parseutils.c20
-rw-r--r--symbols.c32
-rw-r--r--utils.c9
-rw-r--r--utils.h3
-rw-r--r--xkbpath.c8
12 files changed, 64 insertions, 76 deletions
diff --git a/compat.c b/compat.c
index 2efa5dc..5475a75 100644
--- a/compat.c
+++ b/compat.c
@@ -134,7 +134,7 @@ static void
ClearCompatInfo(CompatInfo * info, XkbDescPtr xkb)
{
if (info->name != NULL)
- uFree(info->name);
+ free(info->name);
info->name = NULL;
info->dflt.defs.defined = 0;
info->dflt.defs.merge = MergeAugment;
@@ -426,7 +426,7 @@ HandleIncludeCompatMap(IncludeStmt * stmt,
if (stmt->stmt != NULL)
{
if (included.name != NULL)
- uFree(included.name);
+ free(included.name);
included.name = stmt->stmt;
stmt->stmt = NULL;
}
@@ -881,6 +881,6 @@ CompileCompatMap(XkbFile * file,
return True;
}
if (info.interps != NULL)
- uFree(info.interps);
+ free(info.interps);
return False;
}
diff --git a/geometry.c b/geometry.c
index 237e730..cbacba6 100644
--- a/geometry.c
+++ b/geometry.c
@@ -292,12 +292,12 @@ FreeProperties(PropertyInfo * pi, GeometryInfo * info)
for (tmp = pi; tmp != NULL; tmp = next)
{
if (tmp->name)
- uFree(tmp->name);
+ free(tmp->name);
if (tmp->value)
- uFree(tmp->value);
+ free(tmp->value);
tmp->name = tmp->value = NULL;
next = (PropertyInfo *) tmp->defs.next;
- uFree(tmp);
+ free(tmp);
}
return;
}
@@ -353,7 +353,7 @@ FreeKeys(KeyInfo * key, RowInfo * row, GeometryInfo * info)
{
ClearKeyInfo(tmp);
next = (KeyInfo *) tmp->defs.next;
- uFree(tmp);
+ free(tmp);
}
return;
}
@@ -409,7 +409,7 @@ FreeRows(RowInfo * row, SectionInfo * section, GeometryInfo * info)
{
ClearRowInfo(tmp, info);
next = (RowInfo *) tmp->defs.next;
- uFree(tmp);
+ free(tmp);
}
return;
}
@@ -528,7 +528,7 @@ FreeDoodads(DoodadInfo * di, SectionInfo * si, GeometryInfo * info)
{
next = (DoodadInfo *) tmp->defs.next;
ClearDoodadInfo(tmp);
- uFree(tmp);
+ free(tmp);
}
return;
}
@@ -618,7 +618,7 @@ FreeSections(SectionInfo * si, GeometryInfo * info)
{
ClearSectionInfo(tmp, info);
next = (SectionInfo *) tmp->defs.next;
- uFree(tmp);
+ free(tmp);
}
return;
}
@@ -643,19 +643,19 @@ FreeShapes(ShapeInfo * si, GeometryInfo * info)
{
if (tmp->outlines[i].points != NULL)
{
- uFree(tmp->outlines[i].points);
+ free(tmp->outlines[i].points);
tmp->outlines[i].num_points = 0;
tmp->outlines[i].points = NULL;
}
}
- uFree(tmp->outlines);
+ free(tmp->outlines);
tmp->szOutlines = 0;
tmp->nOutlines = 0;
tmp->outlines = NULL;
tmp->primary = tmp->approx = NULL;
}
next = (ShapeInfo *) tmp->defs.next;
- uFree(tmp);
+ free(tmp);
}
return;
}
@@ -677,7 +677,7 @@ static void
ClearGeometryInfo(GeometryInfo * info)
{
if (info->name)
- uFree(info->name);
+ free(info->name);
info->name = NULL;
if (info->props)
FreeProperties(info->props, info);
@@ -751,7 +751,7 @@ AddProperty(GeometryInfo * info, PropertyInfo * new)
new->value);
}
if (old->value)
- uFree(old->value);
+ free(old->value);
old->value = uStringDup(new->value);
return True;
}
@@ -1353,7 +1353,7 @@ HandleIncludeGeometry(IncludeStmt * stmt, XkbDescPtr xkb, GeometryInfo * info,
if (stmt->stmt != NULL)
{
if (included.name != NULL)
- uFree(included.name);
+ free(included.name);
included.name = stmt->stmt;
stmt->stmt = NULL;
}
@@ -3454,7 +3454,7 @@ VerifyOverlayInfo(XkbGeometryPtr geom,
while ((oi->keys != NULL) && (oi->keys->sectionRow == _GOK_UnknownRow))
{
next = (OverlayKeyInfo *) oi->keys->defs.next;
- uFree(oi->keys);
+ free(oi->keys);
oi->keys = next;
oi->nKeys--;
}
@@ -3465,7 +3465,7 @@ VerifyOverlayInfo(XkbGeometryPtr geom,
{
ki->defs.next = next->defs.next;
oi->nKeys--;
- uFree(next);
+ free(next);
next = (OverlayKeyInfo *) ki->defs.next;
}
}
diff --git a/indicators.c b/indicators.c
index 0e82d4a..995788b 100644
--- a/indicators.c
+++ b/indicators.c
@@ -415,7 +415,7 @@ CopyIndicatorMapDefs(XkbFileInfo * result, LEDInfo * leds,
last = led;
}
else
- uFree(led);
+ free(led);
}
else
{
@@ -431,7 +431,7 @@ CopyIndicatorMapDefs(XkbFileInfo * result, LEDInfo * leds,
im->ctrls = led->ctrls;
if (xkb->names != NULL)
xkb->names->indicators[led->indicator - 1] = led->name;
- uFree(led);
+ free(led);
}
}
if (unboundRtrn != NULL)
@@ -501,7 +501,7 @@ BindIndicators(XkbFileInfo * result,
if (force)
{
unbound = next;
- uFree(led);
+ free(led);
}
else
{
@@ -526,7 +526,7 @@ BindIndicators(XkbFileInfo * result,
led->indicator = _LED_NotBound;
if (force)
{
- uFree(led);
+ free(led);
unbound = next;
}
else
@@ -555,7 +555,7 @@ BindIndicators(XkbFileInfo * result,
else
unbound = next;
led->defs.next = NULL;
- uFree(led);
+ free(led);
}
}
}
@@ -568,7 +568,7 @@ BindIndicators(XkbFileInfo * result,
for (led = unbound; led != NULL; led = next)
{
next = (LEDInfo *) led->defs.next;
- uFree(led);
+ free(led);
}
}
return True;
diff --git a/keycodes.c b/keycodes.c
index b6efdd1..9603376 100644
--- a/keycodes.c
+++ b/keycodes.c
@@ -206,7 +206,7 @@ AddIndicatorName(KeyNamesInfo * info, IndicatorNameInfo * new)
}
}
}
- uFree(old);
+ free(old);
}
}
}
@@ -271,7 +271,7 @@ static void
ClearKeyNamesInfo(KeyNamesInfo * info)
{
if (info->name != NULL)
- uFree(info->name);
+ free(info->name);
info->name = NULL;
info->computedMax = info->explicitMax = info->explicitMin = -1;
info->computedMin = 256;
@@ -518,7 +518,7 @@ HandleIncludeKeycodes(IncludeStmt * stmt, XkbDescPtr xkb, KeyNamesInfo * info)
if (stmt->stmt != NULL)
{
if (included.name != NULL)
- uFree(included.name);
+ free(included.name);
included.name = stmt->stmt;
stmt->stmt = NULL;
}
diff --git a/keytypes.c b/keytypes.c
index 707ee6f..8f6d5c7 100644
--- a/keytypes.c
+++ b/keytypes.c
@@ -204,12 +204,12 @@ FreeKeyTypeInfo(KeyTypeInfo * type)
{
if (type->entries != NULL)
{
- uFree(type->entries);
+ free(type->entries);
type->entries = NULL;
}
if (type->lvlNames != NULL)
{
- uFree(type->lvlNames);
+ free(type->lvlNames);
type->lvlNames = NULL;
}
if (type->preserve != NULL)
@@ -225,7 +225,7 @@ FreeKeyTypesInfo(KeyTypesInfo * info)
{
info->dpy = NULL;
if (info->name)
- uFree(info->name);
+ free(info->name);
info->name = NULL;
if (info->types)
{
@@ -421,7 +421,7 @@ HandleIncludeKeyTypes(IncludeStmt * stmt,
if (stmt->stmt != NULL)
{
if (included.name != NULL)
- uFree(included.name);
+ free(included.name);
included.name = stmt->stmt;
stmt->stmt = NULL;
}
diff --git a/listing.c b/listing.c
index 795389b..f8b1186 100644
--- a/listing.c
+++ b/listing.c
@@ -318,13 +318,13 @@ AddDirectory(char *head, char *ptrn, char *rest, char *map)
(head ? head : ""), (head ? "/" : ""), filename);
if (stat(tmp, &sbuf) < 0)
{
- uFree(tmp);
+ free(tmp);
continue;
}
if (((rest != NULL) && (!S_ISDIR(sbuf.st_mode))) ||
((map != NULL) && (S_ISDIR(sbuf.st_mode))))
{
- uFree(tmp);
+ free(tmp);
continue;
}
if (S_ISDIR(sbuf.st_mode))
diff --git a/misc.c b/misc.c
index f2e87c7..d249a3c 100644
--- a/misc.c
+++ b/misc.c
@@ -252,7 +252,7 @@ ClearCommonInfo(CommonInfo * cmn)
for (this = cmn; this != NULL; this = next)
{
next = this->next;
- uFree(this);
+ free(this);
}
}
return NULL;
diff --git a/parseutils.c b/parseutils.c
index 76876fb..3299245 100644
--- a/parseutils.c
+++ b/parseutils.c
@@ -528,7 +528,7 @@ KeyDeclMerge(KeyDef * into, KeyDef * from)
into->expr =
(ExprDef *) AppendStmt(&into->expr->common, &from->expr->common);
from->expr = NULL;
- uFree(from);
+ free(from);
return into;
}
@@ -595,8 +595,8 @@ OverlayKeyCreate(char *under, char *over)
};
strncpy(key->over, over, XkbKeyNameLength);
strncpy(key->under, under, XkbKeyNameLength);
- uFree(over);
- uFree(under);
+ free(over);
+ free(under);
}
return key;
}
@@ -762,7 +762,7 @@ IncludeCreate(char *str, unsigned merge)
if (first)
first->stmt = stmt;
else if (stmt)
- uFree(stmt);
+ free(stmt);
return first;
BAIL:
ERROR("Illegal include statement \"%s\"\n", stmt);
@@ -771,19 +771,19 @@ IncludeCreate(char *str, unsigned merge)
{
incl = first->next;
if (first->file)
- uFree(first->file);
+ free(first->file);
if (first->map)
- uFree(first->map);
+ free(first->map);
if (first->modifier)
- uFree(first->modifier);
+ free(first->modifier);
if (first->path)
- uFree(first->path);
+ free(first->path);
first->file = first->map = first->path = NULL;
- uFree(first);
+ free(first);
first = incl;
}
if (stmt)
- uFree(stmt);
+ free(stmt);
return NULL;
}
diff --git a/symbols.c b/symbols.c
index 310ad07..75adbaf 100644
--- a/symbols.c
+++ b/symbols.c
@@ -124,10 +124,10 @@ FreeKeyInfo(KeyInfo * info)
info->numLevels[i] = 0;
info->types[i] = None;
if (info->syms[i] != NULL)
- uFree(info->syms[i]);
+ free(info->syms[i]);
info->syms[i] = NULL;
if (info->acts[i] != NULL)
- uFree(info->acts[i]);
+ free(info->acts[i]);
info->acts[i] = NULL;
}
info->dfltType = None;
@@ -257,7 +257,7 @@ static void
FreeSymbolsInfo(SymbolsInfo * info)
{
if (info->name)
- uFree(info->name);
+ free(info->name);
info->name = NULL;
if (info->keys)
{
@@ -265,7 +265,7 @@ FreeSymbolsInfo(SymbolsInfo * info)
{
FreeKeyInfo(&info->keys[i]);
}
- uFree(info->keys);
+ free(info->keys);
info->keys = NULL;
}
if (info->modMap)
@@ -444,13 +444,13 @@ MergeKeyGroups(SymbolsInfo * info,
}
}
if ((into->syms[group] != NULL) && (resultSyms != into->syms[group]))
- uFree(into->syms[group]);
+ free(into->syms[group]);
if ((from->syms[group] != NULL) && (resultSyms != from->syms[group]))
- uFree(from->syms[group]);
+ free(from->syms[group]);
if ((into->acts[group] != NULL) && (resultActs != into->acts[group]))
- uFree(into->acts[group]);
+ free(into->acts[group]);
if ((from->acts[group] != NULL) && (resultActs != from->acts[group]))
- uFree(from->acts[group]);
+ free(from->acts[group]);
into->numLevels[group] = resultWidth;
into->syms[group] = resultSyms;
from->syms[group] = NULL;
@@ -476,9 +476,9 @@ MergeKeys(SymbolsInfo * info, KeyInfo * into, KeyInfo * from)
if (into->numLevels[i] != 0)
{
if (into->syms[i])
- uFree(into->syms[i]);
+ free(into->syms[i]);
if (into->acts[i])
- uFree(into->acts[i]);
+ free(into->acts[i]);
}
}
*into = *from;
@@ -740,7 +740,7 @@ MergeIncludedSymbols(SymbolsInfo * into, SymbolsInfo * from,
if (!AddModMapEntry(into, mm))
into->errorCount++;
next = (ModMapEntry *) mm->defs.next;
- uFree(mm);
+ free(mm);
}
from->modMap = NULL;
}
@@ -788,7 +788,7 @@ HandleIncludeSymbols(IncludeStmt * stmt,
if (stmt->stmt != NULL)
{
if (included.name != NULL)
- uFree(included.name);
+ free(included.name);
included.name = stmt->stmt;
stmt->stmt = NULL;
}
@@ -1534,10 +1534,10 @@ SetExplicitGroup(SymbolsInfo * info, KeyInfo * key)
{
key->numLevels[i] = 0;
if (key->syms[i] != NULL)
- uFree(key->syms[i]);
+ free(key->syms[i]);
key->syms[i] = (KeySym *) NULL;
if (key->acts[i] != NULL)
- uFree(key->acts[i]);
+ free(key->acts[i]);
key->acts[i] = (XkbAction *) NULL;
key->types[i] = (Atom) 0;
}
@@ -1924,10 +1924,10 @@ PrepareKeyDef(KeyInfo * key)
{
key->numLevels[i] = 0;
if (key->syms[i] != NULL)
- uFree(key->syms[i]);
+ free(key->syms[i]);
key->syms[i] = (KeySym *) NULL;
if (key->acts[i] != NULL)
- uFree(key->acts[i]);
+ free(key->acts[i]);
key->acts[i] = (XkbAction *) NULL;
key->types[i] = (Atom) 0;
}
diff --git a/utils.c b/utils.c
index 120ef13..fcf7a8c 100644
--- a/utils.c
+++ b/utils.c
@@ -53,15 +53,6 @@ uRecalloc(void *old, size_t nOld, size_t nNew, size_t itemSize)
}
#endif
-/***====================================================================***/
-
-void
-uFree(Opaque ptr)
-{
- if (ptr != (Opaque) NULL)
- free((char *) ptr);
- return;
-}
/***====================================================================***/
/*** PRINT FUNCTIONS ***/
diff --git a/utils.h b/utils.h
index 1d33396..517ff39 100644
--- a/utils.h
+++ b/utils.h
@@ -90,9 +90,6 @@ extern void *uRecalloc(void * /* old */ ,
);
#endif
-extern void uFree(Opaque /* ptr */
- );
-
/***====================================================================***/
extern Boolean uSetErrorFile(char * /* name */
diff --git a/xkbpath.c b/xkbpath.c
index 0310872..1e2b243 100644
--- a/xkbpath.c
+++ b/xkbpath.c
@@ -123,7 +123,7 @@ XkbParseIncludeMap(char **str_inout, char **file_rtrn, char **map_rtrn,
}
else if (str[0] == '(')
{
- uFree(*extra_data);
+ free(*extra_data);
return False;
}
else
@@ -134,8 +134,8 @@ XkbParseIncludeMap(char **str_inout, char **file_rtrn, char **map_rtrn,
tmp = strchr(str, ')');
if ((tmp == NULL) || (tmp[1] != '\0'))
{
- uFree(*file_rtrn);
- uFree(*extra_data);
+ free(*file_rtrn);
+ free(*extra_data);
return False;
}
*tmp++ = '\0';
@@ -184,7 +184,7 @@ XkbClearIncludePath(void)
{
if (includePath[i] != NULL)
{
- uFree(includePath[i]);
+ free(includePath[i]);
includePath[i] = NULL;
}
}