Drop more malloc/free wrappers
authorKristian Høgsberg <krh@bitplanet.net>
Wed, 30 Jun 2010 20:56:24 +0000 (16:56 -0400)
committerKristian Høgsberg <krh@bitplanet.net>
Wed, 30 Jun 2010 20:56:24 +0000 (16:56 -0400)
src/XKBcommonint.h
src/alloc.c
src/atom.c
src/galloc.c
src/malloc.c
src/maprules.c
src/text.c
src/xkbcomp/listing.c
src/xkbcomp/xkbcomp.c

index aa702ea..4e899ab 100644 (file)
@@ -35,25 +35,11 @@ authorization from the authors.
 #define False 0
 #endif
 
-#ifdef MALLOC_0_RETURNS_NULL
-# define Xmalloc(size) malloc(((size) == 0 ? 1 : (size)))
-# define Xrealloc(ptr, size) realloc((ptr), ((size) == 0 ? 1 : (size)))
-# define Xcalloc(nelem, elsize) calloc(((nelem) == 0 ? 1 : (nelem)), (elsize))
-#else
-# define Xmalloc(size) malloc((size))
-# define Xrealloc(ptr, size) realloc((ptr), (size))
-# define Xcalloc(nelem, elsize) calloc((nelem), (elsize))
-#endif
-
-#define _XkbAlloc(s)            Xmalloc((s))
-#define _XkbCalloc(n,s)         Xcalloc((n),(s))
-#define _XkbRealloc(o,s)        Xrealloc((o),(s))
-#define _XkbTypedAlloc(t)       ((t *)Xmalloc(sizeof(t)))
-#define _XkbTypedCalloc(n,t)    ((t *)Xcalloc((n),sizeof(t)))
+#define _XkbTypedAlloc(t)       ((t *)malloc(sizeof(t)))
+#define _XkbTypedCalloc(n,t)    ((t *)calloc((n),sizeof(t)))
 #define _XkbTypedRealloc(o,n,t) \
-    ((o)?(t *)Xrealloc((o),(n)*sizeof(t)):_XkbTypedCalloc(n,t))
+    ((o)?(t *)realloc((o),(n)*sizeof(t)):_XkbTypedCalloc(n,t))
 #define _XkbClearElems(a,f,l,t) bzero(&(a)[f],((l)-(f)+1)*sizeof(t))
-#define _XkbFree(p)             free((p))
 
 #define _XkbDupString(s)        ((s) ? strdup(s) : NULL)
 #define _XkbStrCaseCmp          strcasecmp
index f49457f..355d10d 100644 (file)
@@ -54,7 +54,7 @@ XkbcAllocCompatMap(XkbcDescPtr xkb, unsigned which, unsigned nSI)
         compat->sym_interpret = _XkbTypedRealloc(compat->sym_interpret,
                                                  nSI, XkbcSymInterpretRec);
         if (!compat->sym_interpret) {
-            _XkbFree(prev_interpret);
+            free(prev_interpret);
             compat->size_si = compat->num_si = 0;
             return BadAlloc;
         }
@@ -73,7 +73,7 @@ XkbcAllocCompatMap(XkbcDescPtr xkb, unsigned which, unsigned nSI)
     if (nSI > 0) {
         compat->sym_interpret = _XkbTypedCalloc(nSI, XkbcSymInterpretRec);
         if (!compat->sym_interpret) {
-            _XkbFree(compat);
+            free(compat);
             return BadAlloc;
         }
     }
@@ -103,13 +103,13 @@ XkbcFreeCompatMap(XkbcDescPtr xkb, unsigned which, Bool freeMap)
 
     if (which & XkbSymInterpMask) {
         if (compat->sym_interpret && (compat->size_si > 0))
-            _XkbFree(compat->sym_interpret);
+            free(compat->sym_interpret);
         compat->size_si = compat->num_si = 0;
         compat->sym_interpret = NULL;
     }
 
     if (freeMap) {
-        _XkbFree(compat);
+        free(compat);
         xkb->compat = NULL;
     }
 }
@@ -168,7 +168,7 @@ XkbcAllocNames(XkbcDescPtr xkb, unsigned which, int nTotalRG, int nTotalAliases)
                 _XkbClearElems(names->key_aliases, names->num_key_aliases,
                                nTotalAliases - 1, XkbKeyAliasRec);
             else
-                _XkbFree(prev_aliases);
+                free(prev_aliases);
         }
 
         if (!names->key_aliases) {
@@ -191,7 +191,7 @@ XkbcAllocNames(XkbcDescPtr xkb, unsigned which, int nTotalRG, int nTotalAliases)
                 _XkbClearElems(names->radio_groups, names->num_rg,
                                nTotalRG - 1, uint32_t);
             else
-                _XkbFree(prev_radio_groups);
+                free(prev_radio_groups);
         }
 
         if (!names->radio_groups)
@@ -224,7 +224,7 @@ XkbcFreeNames(XkbcDescPtr xkb, unsigned which, Bool freeMap)
 
             for (i = 0; i < map->num_types; i++, type++) {
                 if (type->level_names) {
-                    _XkbFree(type->level_names);
+                    free(type->level_names);
                     type->level_names = NULL;
                 }
             }
@@ -232,25 +232,25 @@ XkbcFreeNames(XkbcDescPtr xkb, unsigned which, Bool freeMap)
     }
 
     if ((which & XkbKeyNamesMask) && names->keys) {
-        _XkbFree(names->keys);
+        free(names->keys);
         names->keys = NULL;
         names->num_keys = 0;
     }
 
     if ((which & XkbKeyAliasesMask) && names->key_aliases) {
-        _XkbFree(names->key_aliases);
+        free(names->key_aliases);
         names->key_aliases = NULL;
         names->num_key_aliases = 0;
     }
 
     if ((which & XkbRGNamesMask) && names->radio_groups) {
-        _XkbFree(names->radio_groups);
+        free(names->radio_groups);
         names->radio_groups = NULL;
         names->num_rg = 0;
     }
 
     if (freeMap) {
-        _XkbFree(names);
+        free(names);
         xkb->names = NULL;
     }
 }
@@ -274,7 +274,7 @@ void
 XkbcFreeControls(XkbcDescPtr xkb, unsigned which, Bool freeMap)
 {
     if (freeMap && xkb && xkb->ctrls) {
-        _XkbFree(xkb->ctrls);
+        free(xkb->ctrls);
         xkb->ctrls = NULL;
     }
 }
@@ -298,7 +298,7 @@ void
 XkbcFreeIndicatorMaps(XkbcDescPtr xkb)
 {
     if (xkb && xkb->indicators) {
-        _XkbFree(xkb->indicators);
+        free(xkb->indicators);
         xkb->indicators = NULL;
     }
 }
@@ -338,5 +338,5 @@ XkbcFreeKeyboard(XkbcDescPtr xkb, unsigned which, Bool freeAll)
     if (which & XkbControlsMask)
         XkbcFreeControls(xkb, XkbAllControlsMask, True);
     if (freeAll)
-        _XkbFree(xkb);
+        free(xkb);
 }
index e597adb..f50b9e7 100644 (file)
@@ -110,7 +110,7 @@ XkbcInitAtoms(InternAtomFuncPtr intern, GetAtomValueFuncPtr get_atom_value)
         return;
 
     tableLength = InitialTableSize;
-    nodeTable = (NodePtr *)_XkbAlloc(InitialTableSize * sizeof(NodePtr));
+    nodeTable = (NodePtr *)malloc(InitialTableSize * sizeof(NodePtr));
     nodeTable[None] = NULL;
 }
 
@@ -188,13 +188,13 @@ _XkbcMakeAtom(const char *string, unsigned len, Bool makeit)
     if (makeit) {
         NodePtr nd;
 
-        nd = (NodePtr)_XkbAlloc(sizeof(NodeRec));
+        nd = (NodePtr)malloc(sizeof(NodeRec));
         if (!nd)
             return BAD_RESOURCE;
 
-        nd->string = (char *)_XkbAlloc(len + 1);
+        nd->string = (char *)malloc(len + 1);
         if (!nd->string) {
-            _XkbFree(nd);
+            free(nd);
             return BAD_RESOURCE;
         }
         strncpy(nd->string, string, (int)len);
@@ -203,12 +203,12 @@ _XkbcMakeAtom(const char *string, unsigned len, Bool makeit)
         if ((lastAtom + 1) >= tableLength) {
             NodePtr *table;
 
-            table = (NodePtr *)_XkbRealloc(nodeTable,
+            table = (NodePtr *)realloc(nodeTable,
                                            tableLength * 2 * sizeof(NodePtr));
             if (!table) {
                 if (nd->string != string)
-                    _XkbFree(nd->string);
-                _XkbFree(nd);
+                    free(nd->string);
+                free(nd);
                 return BAD_RESOURCE;
             }
             tableLength <<= 1;
index 94a1c0f..30be962 100644 (file)
@@ -39,7 +39,7 @@ _XkbFreeGeomLeafElems(Bool freeAll, int first, int count,
     if (freeAll || !(*elems)) {
         *num_inout = *sz_inout = 0;
         if (*elems) {
-            _XkbFree(*elems);
+            free(*elems);
             *elems = NULL;
         }
         return;
@@ -98,7 +98,7 @@ _XkbFreeGeomNonLeafElems(Bool freeAll, int first, int count,
     if (freeAll) {
         *num_inout = *sz_inout = 0;
         if (*elems) {
-            _XkbFree(*elems);
+            free(*elems);
             *elems = NULL;
         }
     }
@@ -118,11 +118,11 @@ _XkbClearProperty(char *prop_in)
     XkbcPropertyPtr prop = (XkbcPropertyPtr)prop_in;
 
     if (prop->name) {
-        _XkbFree(prop->name);
+        free(prop->name);
         prop->name = NULL;
     }
     if (prop->value) {
-        _XkbFree(prop->value);
+        free(prop->value);
         prop->value = NULL;
     }
 }
@@ -152,7 +152,7 @@ _XkbClearColor(char *color_in)
     XkbcColorPtr color = (XkbcColorPtr)color_in;
 
     if (color->spec)
-        _XkbFree(color->spec);
+        free(color->spec);
 }
 
 void
@@ -318,18 +318,18 @@ _XkbClearDoodad(char *doodad_in)
     switch (doodad->any.type) {
     case XkbTextDoodad:
         if (doodad->text.text) {
-            _XkbFree(doodad->text.text);
+            free(doodad->text.text);
             doodad->text.text = NULL;
         }
         if (doodad->text.font) {
-            _XkbFree(doodad->text.font);
+            free(doodad->text.font);
             doodad->text.font = NULL;
         }
         break;
 
     case XkbLogoDoodad:
         if (doodad->logo.logo_name) {
-            _XkbFree(doodad->logo.logo_name);
+            free(doodad->logo.logo_name);
             doodad->logo.logo_name = NULL;
         }
         break;
@@ -346,7 +346,7 @@ XkbcFreeGeomDoodads(XkbcDoodadPtr doodads, int nDoodads, Bool freeAll)
         for (i = 0, doodad = doodads; i < nDoodads; i++, doodad++)
             _XkbClearDoodad((char *)doodad);
         if (freeAll)
-            _XkbFree(doodads);
+            free(doodads);
     }
 }
 
@@ -382,10 +382,10 @@ XkbcFreeGeometry(XkbcGeometryPtr geom, unsigned which, Bool freeMap)
 
     if (freeMap) {
         if (geom->label_font) {
-            _XkbFree(geom->label_font);
+            free(geom->label_font);
             geom->label_font = NULL;
         }
-        _XkbFree(geom);
+        free(geom);
     }
 }
 
@@ -405,9 +405,9 @@ _XkbGeomAlloc(char **old, unsigned short *num, unsigned short *total,
     *total = (*num) + num_new;
 
     if (*old)
-        *old = (char *)_XkbRealloc(*old, (*total) * sz_elem);
+        *old = (char *)realloc(*old, (*total) * sz_elem);
     else
-        *old = (char *)_XkbCalloc(*total, sz_elem);
+        *old = (char *)calloc(*total, sz_elem);
     if (!(*old)) {
         *total = *num = 0;
         return BadAlloc;
@@ -616,8 +616,8 @@ register XkbcPropertyPtr prop;
     for (i=0,prop=geom->properties;i<geom->num_properties;i++,prop++) {
        if ((prop->name)&&(strcmp(name,prop->name)==0)) {
            if (prop->value)
-               _XkbFree(prop->value);
-           prop->value= (char *)_XkbAlloc(strlen(value)+1);
+               free(prop->value);
+           prop->value= (char *)malloc(strlen(value)+1);
            if (prop->value)
                strcpy(prop->value,value);
            return prop;
@@ -628,13 +628,13 @@ register XkbcPropertyPtr prop;
        return NULL;
     }
     prop= &geom->properties[geom->num_properties];
-    prop->name= (char *)_XkbAlloc(strlen(name)+1);
+    prop->name= (char *)malloc(strlen(name)+1);
     if (!name)
        return NULL;
     strcpy(prop->name,name);
-    prop->value= (char *)_XkbAlloc(strlen(value)+1);
+    prop->value= (char *)malloc(strlen(value)+1);
     if (!value) {
-       _XkbFree(prop->name);
+       free(prop->name);
        prop->name= NULL;
        return NULL;
     }
@@ -690,7 +690,7 @@ register XkbcColorPtr color;
     }
     color= &geom->colors[geom->num_colors];
     color->pixel= pixel;
-    color->spec= (char *)_XkbAlloc(strlen(spec)+1);
+    color->spec= (char *)malloc(strlen(spec)+1);
     if (!color->spec)
        return NULL;
     strcpy(color->spec,spec);
@@ -804,7 +804,7 @@ XkbcSectionPtr      section;
        return NULL;
     if ((sz_doodads>0)&&(_XkbAllocDoodads(section,sz_doodads)!=Success)) {
        if (section->rows) {
-           _XkbFree(section->rows);
+           free(section->rows);
            section->rows= NULL;
            section->sz_rows= section->num_rows= 0;
        }
index 08d419d..ac8a75b 100644 (file)
@@ -72,7 +72,7 @@ XkbcAllocClientMap(XkbcDescPtr xkb, unsigned which, unsigned nTotalTypes)
             map->types = _XkbTypedRealloc(map->types, nTotalTypes,
                                           XkbcKeyTypeRec);
             if (!map->types) {
-                _XkbFree(prev_types);
+                free(prev_types);
                 map->num_types = map->size_types = 0;
                 return BadAlloc;
             }
@@ -181,7 +181,7 @@ XkbcAllocServerMap(XkbcDescPtr xkb, unsigned which, unsigned nNewActions)
             need = map->num_acts + nNewActions;
             map->acts = _XkbTypedRealloc(map->acts, need, union xkb_action);
             if (!map->acts) {
-                _XkbFree(prev_acts);
+                free(prev_acts);
                 map->num_acts = map->size_acts = 0;
                 return BadAlloc;
             }
@@ -237,15 +237,15 @@ XkbcCopyKeyType(XkbcKeyTypePtr from, XkbcKeyTypePtr into)
         return BadMatch;
 
     if (into->map) {
-        _XkbFree(into->map);
+        free(into->map);
         into->map = NULL;
     }
     if (into->preserve) {
-       _XkbFree(into->preserve);
+       free(into->preserve);
        into->preserve= NULL;
     }
     if (into->level_names) {
-        _XkbFree(into->level_names);
+        free(into->level_names);
         into->level_names = NULL;
     }
 
@@ -320,11 +320,11 @@ XkbcResizeKeyType(XkbcDescPtr xkb, int type_ndx, int map_count,
 
     if (map_count == 0) {
         if (type->map)
-            _XkbFree(type->map);
+            free(type->map);
         type->map = NULL;
 
         if (type->preserve)
-            _XkbFree(type->preserve);
+            free(type->preserve);
         type->preserve = NULL;
 
         type->map_count = 0;
@@ -337,7 +337,7 @@ XkbcResizeKeyType(XkbcDescPtr xkb, int type_ndx, int map_count,
                                          XkbcKTMapEntryRec);
         if (!type->map) {
             if (prev_map)
-                _XkbFree(prev_map);
+                free(prev_map);
             return BadAlloc;
         }
 
@@ -349,12 +349,12 @@ XkbcResizeKeyType(XkbcDescPtr xkb, int type_ndx, int map_count,
                                                   XkbcModsRec);
             if (!type->preserve) {
                 if (prev_preserve)
-                    _XkbFree(prev_preserve);
+                    free(prev_preserve);
                 return BadAlloc;
             }
         }
         else if (type->preserve) {
-            _XkbFree(type->preserve);
+            free(type->preserve);
             type->preserve = NULL;
         }
 
@@ -368,7 +368,7 @@ XkbcResizeKeyType(XkbcDescPtr xkb, int type_ndx, int map_count,
                                              uint32_t);
         if (!type->level_names) {
             if (prev_level_names)
-                _XkbFree(prev_level_names);
+                free(prev_level_names);
             return BadAlloc;
         }
     }
@@ -455,7 +455,7 @@ XkbcResizeKeyType(XkbcDescPtr xkb, int type_ndx, int map_count,
             }
 
             type->num_levels = new_num_lvls;
-            _XkbFree(xkb->map->syms);
+            free(xkb->map->syms);
             xkb->map->syms = newSyms;
             xkb->map->num_syms = nSyms;
 
@@ -570,7 +570,7 @@ XkbcResizeKeySyms(XkbcDescPtr xkb, int key, int needed)
         nSyms += nKeySyms;
     }
 
-    _XkbFree(xkb->map->syms);
+    free(xkb->map->syms);
     xkb->map->syms = newSyms;
     xkb->map->num_syms = nSyms;
 
@@ -696,7 +696,7 @@ XkbcChangeKeycodeRange(XkbcDescPtr xkb, int minKC, int maxKC,
                                                          maxKC + 1,
                                                          XkbSymMapRec);
                 if (!xkb->map->key_sym_map) {
-                    _XkbFree(prev_key_sym_map);
+                    free(prev_key_sym_map);
                     return BadAlloc;
                 }
 
@@ -715,7 +715,7 @@ XkbcChangeKeycodeRange(XkbcDescPtr xkb, int minKC, int maxKC,
                 xkb->map->modmap = _XkbTypedRealloc(xkb->map->modmap,
                                                     maxKC + 1, unsigned char);
                 if (!xkb->map->modmap) {
-                    _XkbFree(prev_modmap);
+                    free(prev_modmap);
                     return BadAlloc;
                 }
 
@@ -736,7 +736,7 @@ XkbcChangeKeycodeRange(XkbcDescPtr xkb, int minKC, int maxKC,
                                                           maxKC + 1,
                                                           XkbBehavior);
                 if (!xkb->server->behaviors) {
-                    _XkbFree(prev_behaviors);
+                    free(prev_behaviors);
                     return BadAlloc;
                 }
 
@@ -756,7 +756,7 @@ XkbcChangeKeycodeRange(XkbcDescPtr xkb, int minKC, int maxKC,
                                                          maxKC + 1,
                                                          unsigned short);
                 if (!xkb->server->key_acts) {
-                    _XkbFree(prev_key_acts);
+                    free(prev_key_acts);
                     return BadAlloc;
                 }
 
@@ -776,7 +776,7 @@ XkbcChangeKeycodeRange(XkbcDescPtr xkb, int minKC, int maxKC,
                                                         maxKC + 1,
                                                         uint32_t);
                 if (!xkb->server->vmodmap) {
-                    _XkbFree(prev_vmodmap);
+                    free(prev_vmodmap);
                     return BadAlloc;
                 }
 
@@ -796,7 +796,7 @@ XkbcChangeKeycodeRange(XkbcDescPtr xkb, int minKC, int maxKC,
             xkb->names->keys = _XkbTypedRealloc(xkb->names->keys, maxKC + 1,
                                                 XkbKeyNameRec);
             if (!xkb->names->keys) {
-                _XkbFree(prev_keys);
+                free(prev_keys);
                 return BadAlloc;
             }
 
@@ -868,7 +868,7 @@ XkbcResizeKeyActions(XkbcDescPtr xkb, int key, int needed)
         nActs += nKeyActs;
     }
 
-    _XkbFree(xkb->server->acts);
+    free(xkb->server->acts);
     xkb->server->acts = newActs;
     xkb->server->num_acts = nActs;
 
@@ -895,21 +895,21 @@ XkbcFreeClientMap(XkbcDescPtr xkb, unsigned what, Bool freeMap)
 
                 for (i = 0, type = map->types; i < map->num_types; i++, type++) {
                     if (type->map) {
-                        _XkbFree(type->map);
+                        free(type->map);
                         type->map = NULL;
                     }
                     if (type->preserve) {
-                        _XkbFree(type->preserve);
+                        free(type->preserve);
                         type->preserve = NULL;
                     }
                     type->map_count = 0;
                     if (type->level_names) {
-                        _XkbFree(type->level_names);
+                        free(type->level_names);
                         type->level_names = NULL;
                     }
                 }
             }
-            _XkbFree(map->types);
+            free(map->types);
             map->num_types = map->size_types = 0;
             map->types = NULL;
         }
@@ -917,23 +917,23 @@ XkbcFreeClientMap(XkbcDescPtr xkb, unsigned what, Bool freeMap)
 
     if (what & XkbKeySymsMask) {
         if (map->key_sym_map) {
-            _XkbFree(map->key_sym_map);
+            free(map->key_sym_map);
             map->key_sym_map = NULL;
         }
         if (map->syms) {
-            _XkbFree(map->syms);
+            free(map->syms);
             map->size_syms = map->num_syms = 0;
             map->syms = NULL;
         }
     }
 
     if ((what & XkbModifierMapMask) && map->modmap) {
-        _XkbFree(map->modmap);
+        free(map->modmap);
         map->modmap = NULL;
     }
 
     if (freeMap) {
-        _XkbFree(xkb->map);
+        free(xkb->map);
         xkb->map = NULL;
     }
 }
@@ -951,34 +951,34 @@ XkbcFreeServerMap(XkbcDescPtr xkb, unsigned what, Bool freeMap)
     map = xkb->server;
 
     if ((what & XkbExplicitComponentsMask) && map->explicit) {
-        _XkbFree(map->explicit);
+        free(map->explicit);
         map->explicit = NULL;
     }
 
     if (what & XkbKeyActionsMask) {
         if (map->key_acts) {
-            _XkbFree(map->key_acts);
+            free(map->key_acts);
             map->key_acts = NULL;
         }
         if (map->acts) {
-            _XkbFree(map->acts);
+            free(map->acts);
             map->num_acts = map->size_acts = 0;
             map->acts = NULL;
         }
     }
 
     if ((what & XkbKeyBehaviorsMask) && map->behaviors) {
-        _XkbFree(map->behaviors);
+        free(map->behaviors);
         map->behaviors = NULL;
     }
 
     if ((what & XkbVirtualModMapMask) && map->vmodmap) {
-        _XkbFree(map->vmodmap);
+        free(map->vmodmap);
         map->vmodmap = NULL;
     }
 
     if (freeMap) {
-        _XkbFree(xkb->server);
+        free(xkb->server);
         xkb->server = NULL;
     }
 }
index 2c7156b..326ed2b 100644 (file)
@@ -86,7 +86,7 @@ static void
 FreeInputLine(InputLine *line)
 {
     if (line->line!=line->buf)
-       _XkbFree(line->line);
+       free(line->line);
     line->line_num= 1;
     line->num_line= 0;
     line->sz_line= DFLT_LINE_SIZE;
@@ -99,11 +99,11 @@ InputLineAddChar(InputLine *line,int ch)
 {
     if (line->num_line>=line->sz_line) {
        if (line->line==line->buf) {
-           line->line= (char *)_XkbAlloc(line->sz_line*2);
+           line->line= (char *)malloc(line->sz_line*2);
            memcpy(line->line,line->buf,line->sz_line);
        }
        else {
-           line->line=(char *)_XkbRealloc((char *)line->line,line->sz_line*2);
+           line->line=(char *)realloc((char *)line->line,line->sz_line*2);
        }
        line->sz_line*= 2;
     }
@@ -580,9 +580,9 @@ MakeMultiDefs(XkbRF_MultiDefsPtr mdefs, XkbRF_VarDefsPtr defs)
 static void
 FreeMultiDefs(XkbRF_MultiDefsPtr defs)
 {
-  if (defs->options) _XkbFree(defs->options);
-  if (defs->layout[1])  _XkbFree(defs->layout[1]);
-  if (defs->variant[1])  _XkbFree(defs->variant[1]);
+  if (defs->options) free(defs->options);
+  if (defs->layout[1])  free(defs->layout[1]);
+  if (defs->variant[1])  free(defs->variant[1]);
 }
 
 static void
@@ -797,7 +797,7 @@ int len, ndx;
        }
        str= index(&str[0],'%');
     }
-    name= (char *)_XkbAlloc(len+1);
+    name= (char *)malloc(len+1);
     str= orig;
     outstr= name;
     while (*str!='\0') {
@@ -847,7 +847,7 @@ int len, ndx;
     }
     *outstr++= '\0';
     if (orig!=name)
-       _XkbFree(orig);
+       free(orig);
     return name;
 }
 
@@ -1233,7 +1233,7 @@ XkbRF_RulesPtr rules;
        rules->sz_rules= szRules;
        rules->rules= _XkbTypedCalloc(rules->sz_rules,XkbRF_RuleRec);
        if (!rules->rules) {
-           _XkbFree(rules);
+           free(rules);
            return NULL;
        }
     }
@@ -1242,8 +1242,8 @@ XkbRF_RulesPtr rules;
        rules->extra= _XkbTypedCalloc(rules->sz_extra,XkbRF_DescribeVarsRec);
        if (!rules->extra) {
            if (rules->rules)
-               _XkbFree(rules->rules);
-           _XkbFree(rules);
+               free(rules->rules);
+           free(rules);
            return NULL;
        }
     }
@@ -1259,13 +1259,13 @@ register int i;
 
     for (i=0;i<var->num_desc;i++) {
        if (var->desc[i].name)
-           _XkbFree(var->desc[i].name);
+           free(var->desc[i].name);
        if (var->desc[i].desc)
-           _XkbFree(var->desc[i].desc);
+           free(var->desc[i].desc);
        var->desc[i].name= var->desc[i].desc= NULL;
     }
     if (var->desc)
-       _XkbFree(var->desc);
+       free(var->desc);
     var->desc= NULL;
     return;
 }
@@ -1287,39 +1287,39 @@ XkbRF_GroupPtr  group;
        for (i = 0; i < rules->num_extra; i++) {
            XkbRF_ClearVarDescriptions(&rules->extra[i]);
        }
-       _XkbFree(rules->extra);
+       free(rules->extra);
        rules->num_extra= rules->sz_extra= 0;
        rules->extra= NULL;
     }
     if (rules->rules) {
        for (i=0,rule=rules->rules;i<rules->num_rules;i++,rule++) {
-           if (rule->model)    _XkbFree(rule->model);
-           if (rule->layout)   _XkbFree(rule->layout);
-           if (rule->variant)  _XkbFree(rule->variant);
-           if (rule->option)   _XkbFree(rule->option);
-           if (rule->keycodes) _XkbFree(rule->keycodes);
-           if (rule->symbols)  _XkbFree(rule->symbols);
-           if (rule->types)    _XkbFree(rule->types);
-           if (rule->compat)   _XkbFree(rule->compat);
-           if (rule->geometry) _XkbFree(rule->geometry);
-           if (rule->keymap)   _XkbFree(rule->keymap);
+           if (rule->model)    free(rule->model);
+           if (rule->layout)   free(rule->layout);
+           if (rule->variant)  free(rule->variant);
+           if (rule->option)   free(rule->option);
+           if (rule->keycodes) free(rule->keycodes);
+           if (rule->symbols)  free(rule->symbols);
+           if (rule->types)    free(rule->types);
+           if (rule->compat)   free(rule->compat);
+           if (rule->geometry) free(rule->geometry);
+           if (rule->keymap)   free(rule->keymap);
            bzero((char *)rule,sizeof(XkbRF_RuleRec));
        }
-       _XkbFree(rules->rules);
+       free(rules->rules);
        rules->num_rules= rules->sz_rules= 0;
        rules->rules= NULL;
     }
 
     if (rules->groups) {
        for (i=0, group=rules->groups;i<rules->num_groups;i++,group++) {
-           if (group->name)    _XkbFree(group->name);
-           if (group->words)   _XkbFree(group->words);
+           if (group->name)    free(group->name);
+           if (group->words)   free(group->words);
        }
-       _XkbFree(rules->groups);
+       free(rules->groups);
        rules->num_groups= 0;
        rules->groups= NULL;
     }
     if (freeRules)
-       _XkbFree(rules);
+       free(rules);
     return;
 }
index 36f457b..2e9ece9 100644 (file)
@@ -74,7 +74,7 @@ XkbcVModIndexText(XkbcDescPtr xkb, unsigned ndx)
          tmp = XkbcAtomGetString(vmodNames[ndx]);
 
     if (!tmp) {
-        tmp = _XkbAlloc(20 * sizeof(char));
+        tmp = malloc(20 * sizeof(char));
         snprintf(tmp, 20, "%d", ndx);
     }
 
@@ -85,7 +85,7 @@ XkbcVModIndexText(XkbcDescPtr xkb, unsigned ndx)
     rtrn = tbGetBuffer(len);
     strncpy(rtrn, tmp, len);
 
-    _XkbFree(tmp);
+    free(tmp);
 
     return rtrn;
 }
index 9683aa5..f84e59b 100644 (file)
@@ -153,7 +153,7 @@ AddComponent(CompPair *cp, char *fileName, XkbFile *map, unsigned dirsToStrip)
         else
             cp->sz *= 2;
 
-        cp->comp = _XkbRealloc(cp->comp,
+        cp->comp = realloc(cp->comp,
                                cp->sz * sizeof(XkbComponentNameRec));
         if (!cp->comp) {
             ERROR("Failed reallocating component name list\n");
@@ -181,7 +181,7 @@ AddComponent(CompPair *cp, char *fileName, XkbFile *map, unsigned dirsToStrip)
     if (map->name) {
         size_t len = strlen(fileName) + strlen(map->name) + 3;
 
-        cp->comp[cp->num].name = _XkbAlloc(len * sizeof(char));
+        cp->comp[cp->num].name = malloc(len * sizeof(char));
         if (!cp->comp[cp->num].name) {
             ERROR("Could not allocate space for component name\n");
             return False;
@@ -439,7 +439,7 @@ GenerateComponent(XkbComponentListPtr complist, unsigned type, char *head_in,
 
     /* Trim excess component slots */
     if (cp.sz > 0 && cp.sz > cp.num) {
-        if (_XkbRealloc(cp.comp, cp.num * sizeof(XkbComponentNameRec)))
+        if (realloc(cp.comp, cp.num * sizeof(XkbComponentNameRec)))
             cp.sz = cp.num;
         else
             WARN("Could not reallocate component name list\n");
index e801a7b..88c9c91 100644 (file)
@@ -116,13 +116,13 @@ XkbComponentsFromRules(const char *rules, const XkbRF_VarDefsPtr defs)
     }
 
     if (!XkbcRF_GetComponents(loaded, defs, names)) {
-        _XkbFree(names->keymap);
-        _XkbFree(names->keycodes);
-        _XkbFree(names->types);
-        _XkbFree(names->compat);
-        _XkbFree(names->symbols);
-        _XkbFree(names->geometry);
-        _XkbFree(names);
+        free(names->keymap);
+        free(names->keycodes);
+        free(names->types);
+        free(names->compat);
+        free(names->symbols);
+        free(names->geometry);
+        free(names);
         names = NULL;
         ERROR("no components returned from XKB rules \"%s\"\n", rulesPath);
     }
@@ -161,13 +161,13 @@ XkbcCompileKeymapFromRules(const XkbRMLVOSet *rmlvo)
 
     xkb = XkbcCompileKeymapFromComponents(names);
 
-    _XkbFree(names->keymap);
-    _XkbFree(names->keycodes);
-    _XkbFree(names->types);
-    _XkbFree(names->compat);
-    _XkbFree(names->symbols);
-    _XkbFree(names->geometry);
-    _XkbFree(names);
+    free(names->keymap);
+    free(names->keycodes);
+    free(names->types);
+    free(names->compat);
+    free(names->symbols);
+    free(names->geometry);
+    free(names);
 
     return xkb;
 }