Drop malloc wrappers
authorKristian Høgsberg <krh@bitplanet.net>
Mon, 28 Jun 2010 10:58:01 +0000 (06:58 -0400)
committerKristian Høgsberg <krh@bitplanet.net>
Mon, 28 Jun 2010 10:58:01 +0000 (06:58 -0400)
12 files changed:
src/xkbcomp/compat.c
src/xkbcomp/expr.c
src/xkbcomp/geometry.c
src/xkbcomp/indicators.c
src/xkbcomp/keycodes.c
src/xkbcomp/keytypes.c
src/xkbcomp/misc.c
src/xkbcomp/parseutils.c
src/xkbcomp/symbols.c
src/xkbcomp/utils.c
src/xkbcomp/utils.h
src/xkbcomp/xkbpath.c

index 5c8d7df..cfa7508 100644 (file)
@@ -140,7 +140,7 @@ ClearCompatInfo(CompatInfo * info, XkbcDescPtr xkb)
     register int i;
 
     if (info->name != NULL)
-        uFree(info->name);
+        free(info->name);
     info->name = NULL;
     info->dflt.defs.defined = 0;
     info->dflt.defs.merge = MergeAugment;
@@ -429,7 +429,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;
         }
@@ -882,6 +882,6 @@ CompileCompatMap(XkbFile *file, XkbcDescPtr xkb, unsigned merge,
         return True;
     }
     if (info.interps != NULL)
-        uFree(info.interps);
+        free(info.interps);
     return False;
 }
index ca66a26..0de20cc 100644 (file)
@@ -767,7 +767,7 @@ ExprResolveString(ExprDef * expr,
             int len;
             char *new;
             len = strlen(leftRtrn.str) + strlen(rightRtrn.str) + 1;
-            new = (char *) uAlloc(len);
+            new = (char *) malloc(len);
             if (new)
             {
                 sprintf(new, "%s%s", leftRtrn.str, rightRtrn.str);
index 8182d66..eb7d142 100644 (file)
@@ -294,12 +294,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;
 }
@@ -410,7 +410,7 @@ FreeRows(RowInfo * row, SectionInfo * section, GeometryInfo * info)
     {
         ClearRowInfo(tmp, info);
         next = (RowInfo *) tmp->defs.next;
-        uFree(tmp);
+        free(tmp);
     }
     return;
 }
@@ -529,7 +529,7 @@ FreeDoodads(DoodadInfo * di, SectionInfo * si, GeometryInfo * info)
     {
         next = (DoodadInfo *) tmp->defs.next;
         ClearDoodadInfo(tmp);
-        uFree(tmp);
+        free(tmp);
     }
     return;
 }
@@ -619,7 +619,7 @@ FreeSections(SectionInfo * si, GeometryInfo * info)
     {
         ClearSectionInfo(tmp, info);
         next = (SectionInfo *) tmp->defs.next;
-        uFree(tmp);
+        free(tmp);
     }
     return;
 }
@@ -644,19 +644,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;
 }
@@ -678,7 +678,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);
@@ -752,7 +752,7 @@ AddProperty(GeometryInfo * info, PropertyInfo * new)
                         new->value);
             }
             if (old->value)
-                uFree(old->value);
+                free(old->value);
             old->value = _XkbDupString(new->value);
             return True;
         }
@@ -1348,7 +1348,7 @@ HandleIncludeGeometry(IncludeStmt * stmt, XkbcDescPtr xkb, GeometryInfo * info,
         if (stmt->stmt != NULL)
         {
             if (included.name != NULL)
-                uFree(included.name);
+                free(included.name);
             included.name = stmt->stmt;
             stmt->stmt = NULL;
         }
@@ -3277,7 +3277,7 @@ FontFromParts(uint32_t fontTok,
     totalSize =
         strlen(FONT_TEMPLATE) + strlen(font) + strlen(weight) + strlen(slant);
     totalSize += strlen(setWidth) + strlen(variant) + strlen(encoding);
-    rtrn = uCalloc(totalSize, 1);
+    rtrn = calloc(totalSize, 1);
     if (rtrn)
         sprintf(rtrn, FONT_TEMPLATE, font, weight, slant, setWidth, variant,
                 size, encoding);
@@ -3430,7 +3430,7 @@ VerifyOverlayInfo(XkbcGeometryPtr 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--;
     }
@@ -3441,7 +3441,7 @@ VerifyOverlayInfo(XkbcGeometryPtr geom,
         {
             ki->defs.next = next->defs.next;
             oi->nKeys--;
-            uFree(next);
+            free(next);
             next = (OverlayKeyInfo *) ki->defs.next;
         }
     }
index 8b3da44..28b7932 100644 (file)
@@ -412,7 +412,7 @@ CopyIndicatorMapDefs(XkbcDescPtr xkb, LEDInfo *leds, LEDInfo **unboundRtrn)
                 last = led;
             }
             else
-                uFree(led);
+                free(led);
         }
         else
         {
@@ -428,7 +428,7 @@ CopyIndicatorMapDefs(XkbcDescPtr xkb, LEDInfo *leds, LEDInfo **unboundRtrn)
             im->ctrls = led->ctrls;
             if (xkb->names != NULL)
                 xkb->names->indicators[led->indicator - 1] = led->name;
-            uFree(led);
+            free(led);
         }
     }
     if (unboundRtrn != NULL)
@@ -497,7 +497,7 @@ BindIndicators(XkbcDescPtr xkb, Bool force, LEDInfo *unbound,
             if (force)
             {
                 unbound = next;
-                uFree(led);
+                free(led);
             }
             else
             {
@@ -522,7 +522,7 @@ BindIndicators(XkbcDescPtr xkb, Bool force, LEDInfo *unbound,
                 led->indicator = _LED_NotBound;
                 if (force)
                 {
-                    uFree(led);
+                    free(led);
                     unbound = next;
                 }
                 else
@@ -551,7 +551,7 @@ BindIndicators(XkbcDescPtr xkb, Bool force, LEDInfo *unbound,
                 else
                     unbound = next;
                 led->defs.next = NULL;
-                uFree(led);
+                free(led);
             }
         }
     }
@@ -564,7 +564,7 @@ BindIndicators(XkbcDescPtr xkb, Bool force, LEDInfo *unbound,
         for (led = unbound; led != NULL; led = next)
         {
             next = (LEDInfo *) led->defs.next;
-            uFree(led);
+            free(led);
         }
     }
     return True;
index b137f59..acffbf1 100644 (file)
@@ -211,7 +211,7 @@ AddIndicatorName(KeyNamesInfo * info, IndicatorNameInfo * new)
                         }
                     }
                 }
-                uFree(old);
+                free(old);
             }
         }
     }
@@ -276,7 +276,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;
@@ -523,7 +523,7 @@ HandleIncludeKeycodes(IncludeStmt * stmt, XkbcDescPtr xkb, KeyNamesInfo * info)
         if (stmt->stmt != NULL)
         {
             if (included.name != NULL)
-                uFree(included.name);
+                free(included.name);
             included.name = stmt->stmt;
             stmt->stmt = NULL;
         }
index 984c8da..35a7e07 100644 (file)
@@ -203,12 +203,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)
@@ -223,7 +223,7 @@ static void
 FreeKeyTypesInfo(KeyTypesInfo * info)
 {
     if (info->name)
-        uFree(info->name);
+        free(info->name);
     info->name = NULL;
     if (info->types)
     {
@@ -420,7 +420,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;
         }
index dc9a504..e8f4e7e 100644 (file)
@@ -227,7 +227,7 @@ ClearCommonInfo(CommonInfo * cmn)
         for (this = cmn; this != NULL; this = next)
         {
             next = this->next;
-            uFree(this);
+            free(this);
         }
     }
     return NULL;
index e3a7e04..575a1f8 100644 (file)
@@ -488,7 +488,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;
 }
 
@@ -552,9 +552,9 @@ OverlayKeyCreate(char *under, char *over)
         strncpy(key->over, over, XkbKeyNameLength);
         strncpy(key->under, under, XkbKeyNameLength);
         if (over)
-            uFree(over);
+            free(over);
         if (under)
-            uFree(under);
+            free(under);
     }
     return key;
 }
@@ -706,7 +706,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);
@@ -715,19 +715,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;
 }
 
index 80c5a25..3e8c5d5 100644 (file)
@@ -133,10 +133,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;
@@ -273,7 +273,7 @@ FreeSymbolsInfo(SymbolsInfo * info)
     register int i;
 
     if (info->name)
-        uFree(info->name);
+        free(info->name);
     info->name = NULL;
     if (info->keys)
     {
@@ -281,7 +281,7 @@ FreeSymbolsInfo(SymbolsInfo * info)
         {
             FreeKeyInfo(&info->keys[i]);
         }
-        uFree(info->keys);
+        free(info->keys);
         info->keys = NULL;
     }
     if (info->modMap)
@@ -459,13 +459,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;
@@ -492,9 +492,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;
@@ -755,7 +755,7 @@ MergeIncludedSymbols(SymbolsInfo * into, SymbolsInfo * from,
             if (!AddModMapEntry(into, mm))
                 into->errorCount++;
             next = (ModMapEntry *) mm->defs.next;
-            uFree(mm);
+            free(mm);
         }
         from->modMap = NULL;
     }
@@ -803,7 +803,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;
         }
@@ -1564,10 +1564,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] = (uint32_t *) NULL;
             if (key->acts[i] != NULL)
-                uFree(key->acts[i]);
+                free(key->acts[i]);
             key->acts[i] = (XkbcAction *) NULL;
             key->types[i] = (uint32_t) 0;
         }
@@ -1931,10 +1931,10 @@ PrepareKeyDef(KeyInfo * key)
         {
             key->numLevels[i] = 0;
             if (key->syms[i] != NULL)
-                uFree(key->syms[i]);
+                free(key->syms[i]);
             key->syms[i] = (uint32_t *) NULL;
             if (key->acts[i] != NULL)
-                uFree(key->acts[i]);
+                free(key->acts[i]);
             key->acts[i] = (XkbcAction *) NULL;
             key->types[i] = (uint32_t) 0;
         }
index c12e356..8249806 100644 (file)
 #include       <stdlib.h>
 #include       <stdarg.h>
 
-/***====================================================================***/
-
-void *
-uAlloc(unsigned size)
-{
-    return ((void *) malloc(size));
-}
-
-/***====================================================================***/
-
 void *
-uCalloc(unsigned n, unsigned size)
-{
-    return ((void *) calloc(n, size));
-}
-
-/***====================================================================***/
-
-void *
-uRealloc(void * old, unsigned newSize)
-{
-    if (old == NULL)
-        return ((void *) malloc(newSize));
-    else
-        return ((void *) realloc((char *) old, newSize));
-}
-
-/***====================================================================***/
-
-void *
-uRecalloc(void * old, unsigned nOld, unsigned nNew, unsigned itemSize)
+recalloc(void * old, unsigned nOld, unsigned nNew, unsigned itemSize)
 {
     char *rtrn;
 
@@ -78,16 +49,6 @@ uRecalloc(void * old, unsigned nOld, unsigned nNew, unsigned itemSize)
 }
 
 /***====================================================================***/
-
-void
-uFree(void * ptr)
-{
-    if (ptr != (void *) NULL)
-        free((char *) ptr);
-    return;
-}
-
-/***====================================================================***/
 /***                  FUNCTION ENTRY TRACKING                           ***/
 /***====================================================================***/
 
index 49c8c75..50c1e14 100644 (file)
@@ -66,30 +66,18 @@ typedef int Comparison;
 /***====================================================================***/
 
 extern void *
-uAlloc(unsigned size);
+recalloc(void * old, unsigned nOld, unsigned nNew, unsigned newSize);
 
-extern void *
-uCalloc(unsigned n, unsigned  size);
-
-extern void *
-uRealloc(void * old, unsigned newSize);
-
-extern void *
-uRecalloc(void * old, unsigned nOld, unsigned nNew, unsigned newSize);
-
-extern void
-uFree(void * ptr);
-
-#define        uTypedAlloc(t)          ((t *)uAlloc((unsigned)sizeof(t)))
-#define        uTypedCalloc(n,t)       ((t *)uCalloc((unsigned)n,(unsigned)sizeof(t)))
-#define        uTypedRealloc(pO,n,t)   ((t *)uRealloc((void *)pO,((unsigned)n)*sizeof(t)))
-#define        uTypedRecalloc(pO,o,n,t) ((t *)uRecalloc((void *)pO,((unsigned)o),((unsigned)n),sizeof(t)))
+#define        uTypedAlloc(t)          ((t *)malloc((unsigned)sizeof(t)))
+#define        uTypedCalloc(n,t)       ((t *)calloc((unsigned)n,(unsigned)sizeof(t)))
+#define        uTypedRealloc(pO,n,t)   ((t *)realloc((void *)pO,((unsigned)n)*sizeof(t)))
+#define        uTypedRecalloc(pO,o,n,t) ((t *)recalloc((void *)pO,((unsigned)o),((unsigned)n),sizeof(t)))
 #if (defined mdHasAlloca) && (mdHasAlloca)
 #define        uTmpAlloc(n)    ((void *)alloca((unsigned)n))
 #define        uTmpFree(p)
 #else
-#define        uTmpAlloc(n)    uAlloc(n)
-#define        uTmpFree(p)     uFree(p)
+#define        uTmpAlloc(n)    malloc(n)
+#define        uTmpFree(p)     free(p)
 #endif
 
 /***====================================================================***/
index b67ac46..92f71aa 100644 (file)
@@ -129,7 +129,7 @@ XkbParseIncludeMap(char **str_inout, char **file_rtrn, char **map_rtrn,
         }
         else if (str[0] == '(')
         {
-            uFree(*extra_data);
+            free(*extra_data);
             return False;
         }
         else
@@ -140,8 +140,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';
@@ -199,7 +199,7 @@ XkbClearIncludePath(void)
         {
             if (includePath[i] != NULL)
             {
-                uFree(includePath[i]);
+                free(includePath[i]);
                 includePath[i] = NULL;
             }
         }