diff options
author | Mikhail Gusarov <dottedmag@dottedmag.net> | 2010-05-06 01:44:06 +0700 |
---|---|---|
committer | Mikhail Gusarov <dottedmag@dottedmag.net> | 2010-05-13 00:22:37 +0700 |
commit | 3f3ff971ecff9936cebafc813af9193b97bba89c (patch) | |
tree | fdbbad794a42488b7ffe41eed7aba4e498335f55 /xkb | |
parent | 96c7ab27c383ec767f62a7a11e5fd76f86363fbc (diff) |
Replace X-allocation functions with their C89 counterparts
The only remaining X-functions used in server are XNF*, the rest is converted to
plain alloc/calloc/realloc/free/strdup.
X* functions are still exported from server and x* macros are still defined in
header file, so both ABI and API are not affected by this change.
Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'xkb')
-rw-r--r-- | xkb/XKBAlloc.c | 54 | ||||
-rw-r--r-- | xkb/XKBGAlloc.c | 42 | ||||
-rw-r--r-- | xkb/XKBMAlloc.c | 124 | ||||
-rw-r--r-- | xkb/XKBMisc.c | 6 | ||||
-rw-r--r-- | xkb/ddxList.c | 10 | ||||
-rw-r--r-- | xkb/ddxLoad.c | 10 | ||||
-rw-r--r-- | xkb/maprules.c | 56 | ||||
-rw-r--r-- | xkb/xkb.c | 70 | ||||
-rw-r--r-- | xkb/xkbActions.c | 6 | ||||
-rw-r--r-- | xkb/xkbEvents.c | 6 | ||||
-rw-r--r-- | xkb/xkbInit.c | 62 | ||||
-rw-r--r-- | xkb/xkbLEDs.c | 24 | ||||
-rw-r--r-- | xkb/xkbUtils.c | 226 | ||||
-rw-r--r-- | xkb/xkmread.c | 6 |
14 files changed, 351 insertions, 351 deletions
diff --git a/xkb/XKBAlloc.c b/xkb/XKBAlloc.c index d40aa3345..0e3c6f4bd 100644 --- a/xkb/XKBAlloc.c +++ b/xkb/XKBAlloc.c @@ -57,10 +57,10 @@ XkbSymInterpretRec *prev_interpret; if (compat->sym_interpret==NULL) compat->num_si= 0; prev_interpret = compat->sym_interpret; - compat->sym_interpret= xrealloc(compat->sym_interpret, + compat->sym_interpret= realloc(compat->sym_interpret, nSI * sizeof(XkbSymInterpretRec)); if (compat->sym_interpret==NULL) { - xfree(prev_interpret); + free(prev_interpret); compat->size_si= compat->num_si= 0; return BadAlloc; } @@ -70,13 +70,13 @@ XkbSymInterpretRec *prev_interpret; } return Success; } - compat= xcalloc(1, sizeof(XkbCompatMapRec)); + compat= calloc(1, sizeof(XkbCompatMapRec)); if (compat==NULL) return BadAlloc; if (nSI>0) { - compat->sym_interpret= xcalloc(nSI, sizeof(XkbSymInterpretRec)); + compat->sym_interpret= calloc(nSI, sizeof(XkbSymInterpretRec)); if (!compat->sym_interpret) { - xfree(compat); + free(compat); return BadAlloc; } } @@ -102,12 +102,12 @@ register XkbCompatMapPtr compat; bzero((char *)&compat->groups[0],XkbNumKbdGroups*sizeof(XkbModsRec)); if (which&XkbSymInterpMask) { if ((compat->sym_interpret)&&(compat->size_si>0)) - xfree(compat->sym_interpret); + free(compat->sym_interpret); compat->size_si= compat->num_si= 0; compat->sym_interpret= NULL; } if (freeMap) { - xfree(compat); + free(compat); xkb->compat= NULL; } return; @@ -123,7 +123,7 @@ XkbNamesPtr names; if (xkb==NULL) return BadMatch; if (xkb->names==NULL) { - xkb->names = xcalloc(1, sizeof(XkbNamesRec)); + xkb->names = calloc(1, sizeof(XkbNamesRec)); if (xkb->names==NULL) return BadAlloc; } @@ -135,7 +135,7 @@ XkbNamesPtr names; type= xkb->map->types; for (i=0;i<xkb->map->num_types;i++,type++) { if (type->level_names==NULL) { - type->level_names= xcalloc(type->num_levels, sizeof(Atom)); + type->level_names= calloc(type->num_levels, sizeof(Atom)); if (type->level_names==NULL) return BadAlloc; } @@ -146,24 +146,24 @@ XkbNamesPtr names; (!XkbIsLegalKeycode(xkb->max_key_code))|| (xkb->max_key_code<xkb->min_key_code)) return BadValue; - names->keys= xcalloc((xkb->max_key_code+1), sizeof(XkbKeyNameRec)); + names->keys= calloc((xkb->max_key_code+1), sizeof(XkbKeyNameRec)); if (names->keys==NULL) return BadAlloc; } if ((which&XkbKeyAliasesMask)&&(nTotalAliases>0)) { if (names->key_aliases==NULL) { - names->key_aliases= xcalloc(nTotalAliases, sizeof(XkbKeyAliasRec)); + names->key_aliases= calloc(nTotalAliases, sizeof(XkbKeyAliasRec)); } else if (nTotalAliases>names->num_key_aliases) { XkbKeyAliasRec *prev_aliases = names->key_aliases; - names->key_aliases= xrealloc(names->key_aliases, + names->key_aliases= realloc(names->key_aliases, nTotalAliases * sizeof(XkbKeyAliasRec)); if (names->key_aliases!=NULL) { memset(&names->key_aliases[names->num_key_aliases], 0, (nTotalAliases - names->num_key_aliases) * sizeof(XkbKeyAliasRec)); } else { - xfree(prev_aliases); + free(prev_aliases); } } if (names->key_aliases==NULL) { @@ -174,18 +174,18 @@ XkbNamesPtr names; } if ((which&XkbRGNamesMask)&&(nTotalRG>0)) { if (names->radio_groups==NULL) { - names->radio_groups= xcalloc(nTotalRG, sizeof(Atom)); + names->radio_groups= calloc(nTotalRG, sizeof(Atom)); } else if (nTotalRG>names->num_rg) { Atom *prev_radio_groups = names->radio_groups; - names->radio_groups= xrealloc(names->radio_groups, + names->radio_groups= realloc(names->radio_groups, nTotalRG * sizeof(Atom)); if (names->radio_groups!=NULL) { memset(&names->radio_groups[names->num_rg], 0, (nTotalRG - names->num_rg) * sizeof(Atom)); } else { - xfree(prev_radio_groups); + free(prev_radio_groups); } } if (names->radio_groups==NULL) @@ -213,29 +213,29 @@ XkbNamesPtr names; type= map->types; for (i=0;i<map->num_types;i++,type++) { if (type->level_names!=NULL) { - xfree(type->level_names); + free(type->level_names); type->level_names= NULL; } } } } if ((which&XkbKeyNamesMask)&&(names->keys!=NULL)) { - xfree(names->keys); + free(names->keys); names->keys= NULL; names->num_keys= 0; } if ((which&XkbKeyAliasesMask)&&(names->key_aliases)){ - xfree(names->key_aliases); + free(names->key_aliases); names->key_aliases=NULL; names->num_key_aliases=0; } if ((which&XkbRGNamesMask)&&(names->radio_groups)) { - xfree(names->radio_groups); + free(names->radio_groups); names->radio_groups= NULL; names->num_rg= 0; } if (freeMap) { - xfree(names); + free(names); xkb->names= NULL; } return; @@ -251,7 +251,7 @@ XkbAllocControls(XkbDescPtr xkb,unsigned which) return BadMatch; if (xkb->ctrls==NULL) { - xkb->ctrls= xcalloc(1, sizeof(XkbControlsRec)); + xkb->ctrls= calloc(1, sizeof(XkbControlsRec)); if (!xkb->ctrls) return BadAlloc; } @@ -263,7 +263,7 @@ static void XkbFreeControls(XkbDescPtr xkb,unsigned which,Bool freeMap) { if (freeMap && (xkb!=NULL) && (xkb->ctrls!=NULL)) { - xfree(xkb->ctrls); + free(xkb->ctrls); xkb->ctrls= NULL; } return; @@ -277,7 +277,7 @@ XkbAllocIndicatorMaps(XkbDescPtr xkb) if (xkb==NULL) return BadMatch; if (xkb->indicators==NULL) { - xkb->indicators= xcalloc(1, sizeof(XkbIndicatorRec)); + xkb->indicators= calloc(1, sizeof(XkbIndicatorRec)); if (!xkb->indicators) return BadAlloc; } @@ -288,7 +288,7 @@ static void XkbFreeIndicatorMaps(XkbDescPtr xkb) { if ((xkb!=NULL)&&(xkb->indicators!=NULL)) { - xfree(xkb->indicators); + free(xkb->indicators); xkb->indicators= NULL; } return; @@ -301,7 +301,7 @@ XkbAllocKeyboard(void) { XkbDescRec *xkb; - xkb = xcalloc(1, sizeof(XkbDescRec)); + xkb = calloc(1, sizeof(XkbDescRec)); if (xkb) xkb->device_spec= XkbUseCoreKbd; return xkb; @@ -332,6 +332,6 @@ XkbFreeKeyboard(XkbDescPtr xkb,unsigned which,Bool freeAll) if (which&XkbControlsMask) XkbFreeControls(xkb,XkbAllControlsMask,TRUE); if (freeAll) - xfree(xkb); + free(xkb); return; } diff --git a/xkb/XKBGAlloc.c b/xkb/XKBGAlloc.c index b01005dd0..7a3659f54 100644 --- a/xkb/XKBGAlloc.c +++ b/xkb/XKBGAlloc.c @@ -51,7 +51,7 @@ _XkbFreeGeomLeafElems( Bool freeAll, if ((freeAll)||(*elems==NULL)) { *num_inout= *sz_inout= 0; if (*elems!=NULL) { - xfree(*elems); + free(*elems); *elems= NULL; } return; @@ -115,7 +115,7 @@ register char *ptr; if (freeAll) { (*num_inout)= (*sz_inout)= 0; if (*elems) { - xfree(*elems); + free(*elems); *elems= NULL; } } @@ -138,11 +138,11 @@ _XkbClearProperty(char *prop_in) XkbPropertyPtr prop= (XkbPropertyPtr)prop_in; if (prop->name) { - xfree(prop->name); + free(prop->name); prop->name= NULL; } if (prop->value) { - xfree(prop->value); + free(prop->value); prop->value= NULL; } return; @@ -184,7 +184,7 @@ _XkbClearColor(char *color_in) XkbColorPtr color= (XkbColorPtr)color_in; if (color->spec) - xfree(color->spec); + free(color->spec); return; } @@ -381,11 +381,11 @@ XkbDoodadPtr doodad= (XkbDoodadPtr)doodad_in; case XkbTextDoodad: { if (doodad->text.text!=NULL) { - xfree(doodad->text.text); + free(doodad->text.text); doodad->text.text= NULL; } if (doodad->text.font!=NULL) { - xfree(doodad->text.font); + free(doodad->text.font); doodad->text.font= NULL; } } @@ -393,7 +393,7 @@ XkbDoodadPtr doodad= (XkbDoodadPtr)doodad_in; case XkbLogoDoodad: { if (doodad->logo.logo_name!=NULL) { - xfree(doodad->logo.logo_name); + free(doodad->logo.logo_name); doodad->logo.logo_name= NULL; } } @@ -413,7 +413,7 @@ register XkbDoodadPtr doodad; _XkbClearDoodad((char *)doodad); } if (freeAll) - xfree(doodads); + free(doodads); } return; } @@ -442,10 +442,10 @@ XkbFreeGeometry(XkbGeometryPtr geom,unsigned which,Bool freeMap) XkbFreeGeomKeyAliases(geom,0,geom->num_key_aliases,TRUE); if (freeMap) { if (geom->label_font!=NULL) { - xfree(geom->label_font); + free(geom->label_font); geom->label_font= NULL; } - xfree(geom); + free(geom); } return; } @@ -469,8 +469,8 @@ _XkbGeomAlloc( void ** old, *total= (*num)+num_new; if ((*old)!=NULL) - (*old)= xrealloc((*old),(*total)*sz_elem); - else (*old)= xcalloc((*total),sz_elem); + (*old)= realloc((*old),(*total)*sz_elem); + else (*old)= calloc((*total),sz_elem); if ((*old)==NULL) { *total= *num= 0; return BadAlloc; @@ -615,7 +615,7 @@ XkbGeometryPtr geom; Status rtrn; if (xkb->geom==NULL) { - xkb->geom= xcalloc(1, sizeof(XkbGeometryRec)); + xkb->geom= calloc(1, sizeof(XkbGeometryRec)); if (!xkb->geom) return BadAlloc; } @@ -664,8 +664,8 @@ register XkbPropertyPtr prop; for (i=0,prop=geom->properties;i<geom->num_properties;i++,prop++) { if ((prop->name)&&(strcmp(name,prop->name)==0)) { if (prop->value) - xfree(prop->value); - prop->value= xalloc(strlen(value)+1); + free(prop->value); + prop->value= malloc(strlen(value)+1); if (prop->value) strcpy(prop->value,value); return prop; @@ -676,13 +676,13 @@ register XkbPropertyPtr prop; return NULL; } prop= &geom->properties[geom->num_properties]; - prop->name= xalloc(strlen(name)+1); + prop->name= malloc(strlen(name)+1); if (!name) return NULL; strcpy(prop->name,name); - prop->value= xalloc(strlen(value)+1); + prop->value= malloc(strlen(value)+1); if (!value) { - xfree(prop->name); + free(prop->name); prop->name= NULL; return NULL; } @@ -738,7 +738,7 @@ register XkbColorPtr color; } color= &geom->colors[geom->num_colors]; color->pixel= pixel; - color->spec= xalloc(strlen(spec)+1); + color->spec= malloc(strlen(spec)+1); if (!color->spec) return NULL; strcpy(color->spec,spec); @@ -852,7 +852,7 @@ XkbSectionPtr section; return NULL; if ((sz_doodads>0)&&(_XkbAllocDoodads(section,sz_doodads)!=Success)) { if (section->rows) { - xfree(section->rows); + free(section->rows); section->rows= NULL; section->sz_rows= section->num_rows= 0; } diff --git a/xkb/XKBMAlloc.c b/xkb/XKBMAlloc.c index fd12e2b6c..27151b8b1 100644 --- a/xkb/XKBMAlloc.c +++ b/xkb/XKBMAlloc.c @@ -59,7 +59,7 @@ XkbClientMapPtr map; } if (xkb->map==NULL) { - map= xcalloc(1, sizeof(XkbClientMapRec)); + map= calloc(1, sizeof(XkbClientMapRec)); if (map==NULL) return BadAlloc; xkb->map= map; @@ -68,7 +68,7 @@ XkbClientMapPtr map; if ((which&XkbKeyTypesMask)&&(nTotalTypes>0)) { if (map->types==NULL) { - map->types= xcalloc(nTotalTypes, sizeof(XkbKeyTypeRec)); + map->types= calloc(nTotalTypes, sizeof(XkbKeyTypeRec)); if (map->types==NULL) return BadAlloc; map->num_types= 0; @@ -77,9 +77,9 @@ XkbClientMapPtr map; else if (map->size_types<nTotalTypes) { XkbKeyTypeRec *prev_types = map->types; - map->types= xrealloc(map->types,nTotalTypes * sizeof(XkbKeyTypeRec)); + map->types= realloc(map->types,nTotalTypes * sizeof(XkbKeyTypeRec)); if (map->types==NULL) { - xfree(prev_types); + free(prev_types); map->num_types= map->size_types= 0; return BadAlloc; } @@ -92,7 +92,7 @@ XkbClientMapPtr map; int nKeys= XkbNumKeys(xkb); if (map->syms==NULL) { map->size_syms= (nKeys*15)/10; - map->syms= xcalloc(map->size_syms, sizeof(KeySym)); + map->syms= calloc(map->size_syms, sizeof(KeySym)); if (!map->syms) { map->size_syms= 0; return BadAlloc; @@ -102,7 +102,7 @@ XkbClientMapPtr map; } if (map->key_sym_map==NULL) { i= xkb->max_key_code+1; - map->key_sym_map= xcalloc(i, sizeof(XkbSymMapRec)); + map->key_sym_map= calloc(i, sizeof(XkbSymMapRec)); if (map->key_sym_map==NULL) return BadAlloc; } @@ -114,7 +114,7 @@ XkbClientMapPtr map; return BadMatch; if (map->modmap==NULL) { i= xkb->max_key_code+1; - map->modmap= xcalloc(i, sizeof(unsigned char)); + map->modmap= calloc(i, sizeof(unsigned char)); if (map->modmap==NULL) return BadAlloc; } @@ -131,7 +131,7 @@ XkbServerMapPtr map; if (xkb==NULL) return BadMatch; if (xkb->server==NULL) { - map= xcalloc(1, sizeof(XkbServerMapRec)); + map= calloc(1, sizeof(XkbServerMapRec)); if (map==NULL) return BadAlloc; for (i=0;i<XkbNumVirtualMods;i++) { @@ -147,7 +147,7 @@ XkbServerMapPtr map; return BadMatch; if (map->explicit==NULL) { i= xkb->max_key_code+1; - map->explicit= xcalloc(i, sizeof(unsigned char)); + map->explicit= calloc(i, sizeof(unsigned char)); if (map->explicit==NULL) return BadAlloc; } @@ -160,7 +160,7 @@ XkbServerMapPtr map; if (nNewActions<1) nNewActions= 1; if (map->acts==NULL) { - map->acts= xcalloc((nNewActions+1), sizeof(XkbAction)); + map->acts= calloc((nNewActions+1), sizeof(XkbAction)); if (map->acts==NULL) return BadAlloc; map->num_acts= 1; @@ -170,9 +170,9 @@ XkbServerMapPtr map; unsigned need; XkbAction *prev_acts = map->acts; need= map->num_acts+nNewActions; - map->acts= xrealloc(map->acts,need * sizeof(XkbAction)); + map->acts= realloc(map->acts,need * sizeof(XkbAction)); if (map->acts==NULL) { - xfree(prev_acts); + free(prev_acts); map->num_acts= map->size_acts= 0; return BadAlloc; } @@ -182,7 +182,7 @@ XkbServerMapPtr map; } if (map->key_acts==NULL) { i= xkb->max_key_code+1; - map->key_acts= xcalloc(i, sizeof(unsigned short)); + map->key_acts= calloc(i, sizeof(unsigned short)); if (map->key_acts==NULL) return BadAlloc; } @@ -194,7 +194,7 @@ XkbServerMapPtr map; return BadMatch; if (map->behaviors==NULL) { i= xkb->max_key_code+1; - map->behaviors= xcalloc(i, sizeof(XkbBehavior)); + map->behaviors= calloc(i, sizeof(XkbBehavior)); if (map->behaviors==NULL) return BadAlloc; } @@ -206,7 +206,7 @@ XkbServerMapPtr map; return BadMatch; if (map->vmodmap==NULL) { i= xkb->max_key_code+1; - map->vmodmap= xcalloc(i, sizeof(unsigned short)); + map->vmodmap= calloc(i, sizeof(unsigned short)); if (map->vmodmap==NULL) return BadAlloc; } @@ -222,33 +222,33 @@ XkbCopyKeyType(XkbKeyTypePtr from,XkbKeyTypePtr into) if ((!from)||(!into)) return BadMatch; if (into->map) { - xfree(into->map); + free(into->map); into->map= NULL; } if (into->preserve) { - xfree(into->preserve); + free(into->preserve); into->preserve= NULL; } if (into->level_names) { - xfree(into->level_names); + free(into->level_names); into->level_names= NULL; } *into= *from; if ((from->map)&&(into->map_count>0)) { - into->map= xcalloc(into->map_count, sizeof(XkbKTMapEntryRec)); + into->map= calloc(into->map_count, sizeof(XkbKTMapEntryRec)); if (!into->map) return BadAlloc; memcpy(into->map,from->map,into->map_count*sizeof(XkbKTMapEntryRec)); } if ((from->preserve)&&(into->map_count>0)) { - into->preserve= xcalloc(into->map_count, sizeof(XkbModsRec)); + into->preserve= calloc(into->map_count, sizeof(XkbModsRec)); if (!into->preserve) return BadAlloc; memcpy(into->preserve,from->preserve, into->map_count*sizeof(XkbModsRec)); } if ((from->level_names)&&(into->num_levels>0)) { - into->level_names= xcalloc(into->num_levels, sizeof(Atom)); + into->level_names= calloc(into->num_levels, sizeof(Atom)); if (!into->level_names) return BadAlloc; memcpy(into->level_names,from->level_names, @@ -299,10 +299,10 @@ KeyCode matchingKeys[XkbMaxKeyCount],nMatchingKeys; type= &xkb->map->types[type_ndx]; if (map_count==0) { if (type->map!=NULL) - xfree(type->map); + free(type->map); type->map= NULL; if (type->preserve!=NULL) - xfree(type->preserve); + free(type->preserve); type->preserve= NULL; type->map_count= 0; } @@ -310,27 +310,27 @@ KeyCode matchingKeys[XkbMaxKeyCount],nMatchingKeys; XkbKTMapEntryRec *prev_map = type->map; if ((map_count>type->map_count)||(type->map==NULL)) - type->map = xrealloc(type->map,map_count * sizeof(XkbKTMapEntryRec)); + type->map = realloc(type->map,map_count * sizeof(XkbKTMapEntryRec)); if (!type->map) { if (prev_map) - xfree(prev_map); + free(prev_map); return BadAlloc; } if (want_preserve) { XkbModsRec *prev_preserve = type->preserve; if ((map_count>type->map_count)||(type->preserve==NULL)) { - type->preserve = xrealloc(type->preserve, + type->preserve = realloc(type->preserve, map_count * sizeof(XkbModsRec)); } if (!type->preserve) { if (prev_preserve) - xfree(prev_preserve); + free(prev_preserve); return BadAlloc; } } else if (type->preserve!=NULL) { - xfree(type->preserve); + free(type->preserve); type->preserve= NULL; } type->map_count= map_count; @@ -339,11 +339,11 @@ KeyCode matchingKeys[XkbMaxKeyCount],nMatchingKeys; if ((new_num_lvls>type->num_levels)||(type->level_names==NULL)) { Atom * prev_level_names = type->level_names; - type->level_names = xrealloc(type->level_names, + type->level_names = realloc(type->level_names, new_num_lvls * sizeof(Atom)); if (!type->level_names) { if (prev_level_names) - xfree(prev_level_names); + free(prev_level_names); return BadAlloc; } } @@ -397,7 +397,7 @@ KeyCode matchingKeys[XkbMaxKeyCount],nMatchingKeys; if (nResize>0) { int nextMatch; xkb->map->size_syms= (nTotal*15)/10; - newSyms = xcalloc(xkb->map->size_syms, sizeof(KeySym)); + newSyms = calloc(xkb->map->size_syms, sizeof(KeySym)); if (newSyms==NULL) return BadAlloc; nextMatch= 0; @@ -423,7 +423,7 @@ KeyCode matchingKeys[XkbMaxKeyCount],nMatchingKeys; } } type->num_levels= new_num_lvls; - xfree(xkb->map->syms); + free(xkb->map->syms); xkb->map->syms= newSyms; xkb->map->num_syms= nSyms; return Success; @@ -499,7 +499,7 @@ KeySym *newSyms; return &xkb->map->syms[xkb->map->key_sym_map[key].offset]; } xkb->map->size_syms+= (needed>32?needed:32); - newSyms = xcalloc(xkb->map->size_syms, sizeof(KeySym)); + newSyms = calloc(xkb->map->size_syms, sizeof(KeySym)); if (newSyms==NULL) return NULL; newSyms[0]= NoSymbol; @@ -519,7 +519,7 @@ KeySym *newSyms; xkb->map->key_sym_map[i].offset = nSyms; nSyms+= nKeySyms; } - xfree(xkb->map->syms); + free(xkb->map->syms); xkb->map->syms = newSyms; xkb->map->num_syms = nSyms; return &xkb->map->syms[xkb->map->key_sym_map[key].offset]; @@ -638,10 +638,10 @@ int tmp; if (xkb->map->key_sym_map) { XkbSymMapRec *prev_key_sym_map = xkb->map->key_sym_map; - xkb->map->key_sym_map = xrealloc(xkb->map->key_sym_map, + xkb->map->key_sym_map = realloc(xkb->map->key_sym_map, (maxKC+1) * sizeof(XkbSymMapRec)); if (!xkb->map->key_sym_map) { - xfree(prev_key_sym_map); + free(prev_key_sym_map); return BadAlloc; } bzero((char *)&xkb->map->key_sym_map[xkb->max_key_code], @@ -656,10 +656,10 @@ int tmp; if (xkb->map->modmap) { unsigned char *prev_modmap = xkb->map->modmap; - xkb->map->modmap = xrealloc(xkb->map->modmap, + xkb->map->modmap = realloc(xkb->map->modmap, (maxKC+1) * sizeof(unsigned char)); if (!xkb->map->modmap) { - xfree(prev_modmap); + free(prev_modmap); return BadAlloc; } bzero((char *)&xkb->map->modmap[xkb->max_key_code],tmp); @@ -675,10 +675,10 @@ int tmp; if (xkb->server->behaviors) { XkbBehavior *prev_behaviors = xkb->server->behaviors; - xkb->server->behaviors = xrealloc(xkb->server->behaviors, + xkb->server->behaviors = realloc(xkb->server->behaviors, (maxKC+1) * sizeof(XkbBehavior)); if (!xkb->server->behaviors) { - xfree(prev_behaviors); + free(prev_behaviors); return BadAlloc; } bzero((char *)&xkb->server->behaviors[xkb->max_key_code], @@ -693,10 +693,10 @@ int tmp; if (xkb->server->key_acts) { unsigned short *prev_key_acts = xkb->server->key_acts; - xkb->server->key_acts= xrealloc(xkb->server->key_acts, + xkb->server->key_acts= realloc(xkb->server->key_acts, (maxKC+1) * sizeof(unsigned short)); if (!xkb->server->key_acts) { - xfree(prev_key_acts); + free(prev_key_acts); return BadAlloc; } bzero((char *)&xkb->server->key_acts[xkb->max_key_code], @@ -711,10 +711,10 @@ int tmp; if (xkb->server->vmodmap) { unsigned short *prev_vmodmap = xkb->server->vmodmap; - xkb->server->vmodmap= xrealloc(xkb->server->vmodmap, + xkb->server->vmodmap= realloc(xkb->server->vmodmap, (maxKC+1) * sizeof(unsigned short)); if (!xkb->server->vmodmap) { - xfree(prev_vmodmap); + free(prev_vmodmap); return BadAlloc; } bzero((char *)&xkb->server->vmodmap[xkb->max_key_code], @@ -730,10 +730,10 @@ int tmp; if ((xkb->names)&&(xkb->names->keys)) { XkbKeyNameRec *prev_keys = xkb->names->keys; - xkb->names->keys = xrealloc(xkb->names->keys, + xkb->names->keys = realloc(xkb->names->keys, (maxKC+1) * sizeof(XkbKeyNameRec)); if (!xkb->names->keys) { - xfree(prev_keys); + free(prev_keys); return BadAlloc; } bzero((char *)&xkb->names->keys[xkb->max_key_code], @@ -768,7 +768,7 @@ XkbAction *newActs; return &xkb->server->acts[xkb->server->key_acts[key]]; } xkb->server->size_acts= xkb->server->num_acts+needed+8; - newActs = xcalloc(xkb->server->size_acts, sizeof(XkbAction)); + newActs = calloc(xkb->server->size_acts, sizeof(XkbAction)); if (newActs==NULL) return NULL; newActs[0].type = XkbSA_NoAction; @@ -794,7 +794,7 @@ XkbAction *newActs; xkb->server->key_acts[i]= nActs; nActs+= nKeyActs; } - xfree(xkb->server->acts); + free(xkb->server->acts); xkb->server->acts = newActs; xkb->server->num_acts= nActs; return &xkb->server->acts[xkb->server->key_acts[key]]; @@ -817,42 +817,42 @@ XkbClientMapPtr map; XkbKeyTypePtr type; for (i=0,type=map->types;i<map->num_types;i++,type++) { if (type->map!=NULL) { - xfree(type->map); + free(type->map); type->map= NULL; } if (type->preserve!=NULL) { - xfree(type->preserve); + free(type->preserve); type->preserve= NULL; } type->map_count= 0; if (type->level_names!=NULL) { - xfree(type->level_names); + free(type->level_names); type->level_names= NULL; } } } - xfree(map->types); + free(map->types); map->num_types= map->size_types= 0; map->types= NULL; } } if (what&XkbKeySymsMask) { if (map->key_sym_map!=NULL) { - xfree(map->key_sym_map); + free(map->key_sym_map); map->key_sym_map= NULL; } if (map->syms!=NULL) { - xfree(map->syms); + free(map->syms); map->size_syms= map->num_syms= 0; map->syms= NULL; } } if ((what&XkbModifierMapMask)&&(map->modmap!=NULL)) { - xfree(map->modmap); + free(map->modmap); map->modmap= NULL; } if (freeMap) { - xfree(xkb->map); + free(xkb->map); xkb->map= NULL; } return; @@ -869,31 +869,31 @@ XkbServerMapPtr map; what= XkbAllServerInfoMask; map= xkb->server; if ((what&XkbExplicitComponentsMask)&&(map->explicit!=NULL)) { - xfree(map->explicit); + free(map->explicit); map->explicit= NULL; } if (what&XkbKeyActionsMask) { if (map->key_acts!=NULL) { - xfree(map->key_acts); + free(map->key_acts); map->key_acts= NULL; } if (map->acts!=NULL) { - xfree(map->acts); + free(map->acts); map->num_acts= map->size_acts= 0; map->acts= NULL; } } if ((what&XkbKeyBehaviorsMask)&&(map->behaviors!=NULL)) { - xfree(map->behaviors); + free(map->behaviors); map->behaviors= NULL; } if ((what&XkbVirtualModMapMask)&&(map->vmodmap!=NULL)) { - xfree(map->vmodmap); + free(map->vmodmap); map->vmodmap= NULL; } if (freeMap) { - xfree(xkb->server); + free(xkb->server); xkb->server= NULL; } return; diff --git a/xkb/XKBMisc.c b/xkb/XKBMisc.c index 2bb4a2452..ee3dfcca3 100644 --- a/xkb/XKBMisc.c +++ b/xkb/XKBMisc.c @@ -388,7 +388,7 @@ unsigned changed,tmp; nSyms= XkbKeyNumSyms(xkb,key); syms= XkbKeySymsPtr(xkb,key); if (nSyms>IBUF_SIZE) { - interps= xcalloc(nSyms, sizeof(XkbSymInterpretPtr)); + interps= calloc(nSyms, sizeof(XkbSymInterpretPtr)); if (interps==NULL) { interps= ibuf; nSyms= IBUF_SIZE; @@ -422,7 +422,7 @@ unsigned changed,tmp; pActs= XkbResizeKeyActions(xkb,key,nSyms); if (!pActs) { if (nSyms > IBUF_SIZE) - xfree(interps); + free(interps); return FALSE; } new_vmodmask= 0; @@ -507,7 +507,7 @@ unsigned changed,tmp; mc->changed|= changed; } if (interps!=ibuf) - xfree(interps); + free(interps); return TRUE; } diff --git a/xkb/ddxList.c b/xkb/ddxList.c index e212ea3b5..eee388749 100644 --- a/xkb/ddxList.c +++ b/xkb/ddxList.c @@ -97,7 +97,7 @@ char * tmp; if ((list->szPool-list->nPool)<wlen) { if (wlen>1024) list->szPool+= XkbPaddedSize(wlen*2); else list->szPool+= 1024; - list->pool= xrealloc(list->pool, list->szPool * sizeof(char)); + list->pool= realloc(list->pool, list->szPool * sizeof(char)); if (!list->pool) return BadAlloc; } @@ -201,7 +201,7 @@ char tmpname[PATH_MAX]; if (!in) { if (buf != NULL) - xfree (buf); + free(buf); #ifdef WIN32 unlink(tmpname); #endif @@ -209,10 +209,10 @@ char tmpname[PATH_MAX]; } list->nFound[what]= 0; if (buf) { - xfree(buf); + free(buf); buf = NULL; } - buf = xalloc(PATH_MAX * sizeof(char)); + buf = malloc(PATH_MAX * sizeof(char)); if (!buf) return BadAlloc; while ((status==Success)&&((tmp=fgets(buf,PATH_MAX,in))!=NULL)) { @@ -268,7 +268,7 @@ char tmpname[PATH_MAX]; unlink(tmpname); #endif if (buf != NULL) - xfree (buf); + free(buf); return status; } diff --git a/xkb/ddxLoad.c b/xkb/ddxLoad.c index 4ccdddaf0..a9b5ca984 100644 --- a/xkb/ddxLoad.c +++ b/xkb/ddxLoad.c @@ -131,7 +131,7 @@ Win32System(const char *cmdline) LocalFree(buffer); } - xfree(cmd); + free(cmd); return -1; } /* Wait until child process exits. */ @@ -142,7 +142,7 @@ Win32System(const char *cmdline) /* Close process and thread handles. */ CloseHandle( pi.hProcess ); CloseHandle( pi.hThread ); - xfree(cmd); + free(cmd); return dwExitCode; } @@ -235,7 +235,7 @@ XkbDDXCompileKeymapByNames( XkbDescPtr xkb, xkm_output_dir, keymap); if (xkbbasedirflag != emptystring) { - xfree(xkbbasedirflag); + free(xkbbasedirflag); } #ifndef WIN32 @@ -265,7 +265,7 @@ XkbDDXCompileKeymapByNames( XkbDescPtr xkb, nameRtrn[nameRtrnLen-1]= '\0'; } if (buf != NULL) - xfree (buf); + free(buf); return TRUE; } else @@ -285,7 +285,7 @@ XkbDDXCompileKeymapByNames( XkbDescPtr xkb, if (nameRtrn) nameRtrn[0]= '\0'; if (buf != NULL) - xfree (buf); + free(buf); return FALSE; } diff --git a/xkb/maprules.c b/xkb/maprules.c index 3467c4238..3b15a4749 100644 --- a/xkb/maprules.c +++ b/xkb/maprules.c @@ -78,7 +78,7 @@ static void FreeInputLine(InputLine *line) { if (line->line!=line->buf) - xfree(line->line); + free(line->line); line->line_num= 1; line->num_line= 0; line->sz_line= DFLT_LINE_SIZE; @@ -91,11 +91,11 @@ InputLineAddChar(InputLine *line,int ch) { if (line->num_line>=line->sz_line) { if (line->line==line->buf) { - line->line= xalloc(line->sz_line*2); + line->line= malloc(line->sz_line*2); memcpy(line->line,line->buf,line->sz_line); } else { - line->line= xrealloc((char *)line->line,line->sz_line*2); + line->line= realloc((char *)line->line,line->sz_line*2); } line->sz_line*= 2; } @@ -474,7 +474,7 @@ int len; if ((!str1)||(!str2)) return str1; len= strlen(str1)+strlen(str2)+1; - str1= xrealloc(str1,len * sizeof(char)); + str1= realloc(str1,len * sizeof(char)); if (str1) strcat(str1,str2); return str1; @@ -553,9 +553,9 @@ MakeMultiDefs(XkbRF_MultiDefsPtr mdefs, XkbRF_VarDefsPtr defs) static void FreeMultiDefs(XkbRF_MultiDefsPtr defs) { - if (defs->options) xfree(defs->options); - if (defs->layout[1]) xfree(defs->layout[1]); - if (defs->variant[1]) xfree(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 @@ -769,7 +769,7 @@ int len, ndx; } str= index(&str[0],'%'); } - name= xalloc(len+1); + name= malloc(len+1); str= orig; outstr= name; while (*str!='\0') { @@ -819,7 +819,7 @@ int len, ndx; } *outstr++= '\0'; if (orig!=name) - xfree(orig); + free(orig); return name; } @@ -864,11 +864,11 @@ XkbRF_AddRule(XkbRF_RulesPtr rules) if (rules->sz_rules<1) { rules->sz_rules= 16; rules->num_rules= 0; - rules->rules= xcalloc(rules->sz_rules, sizeof(XkbRF_RuleRec)); + rules->rules= calloc(rules->sz_rules, sizeof(XkbRF_RuleRec)); } else if (rules->num_rules>=rules->sz_rules) { rules->sz_rules*= 2; - rules->rules= xrealloc(rules->rules, + rules->rules= realloc(rules->rules, rules->sz_rules * sizeof(XkbRF_RuleRec)); } if (!rules->rules) { @@ -886,11 +886,11 @@ XkbRF_AddGroup(XkbRF_RulesPtr rules) if (rules->sz_groups<1) { rules->sz_groups= 16; rules->num_groups= 0; - rules->groups= xcalloc(rules->sz_groups, sizeof(XkbRF_GroupRec)); + rules->groups= calloc(rules->sz_groups, sizeof(XkbRF_GroupRec)); } else if (rules->num_groups >= rules->sz_groups) { rules->sz_groups *= 2; - rules->groups= xrealloc(rules->groups, + rules->groups= realloc(rules->groups, rules->sz_groups * sizeof(XkbRF_GroupRec)); } if (!rules->groups) { @@ -972,7 +972,7 @@ Bool ok; XkbRF_RulesPtr XkbRF_Create(void) { - return xcalloc(1, sizeof( XkbRF_RulesRec)); + return calloc(1, sizeof( XkbRF_RulesRec)); } /***====================================================================***/ @@ -988,32 +988,32 @@ XkbRF_GroupPtr group; return; if (rules->rules) { for (i=0,rule=rules->rules;i<rules->num_rules;i++,rule++) { - if (rule->model) xfree(rule->model); - if (rule->layout) xfree(rule->layout); - if (rule->variant) xfree(rule->variant); - if (rule->option) xfree(rule->option); - if (rule->keycodes) xfree(rule->keycodes); - if (rule->symbols) xfree(rule->symbols); - if (rule->types) xfree(rule->types); - if (rule->compat) xfree(rule->compat); - if (rule->geometry) xfree(rule->geometry); + 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); bzero((char *)rule,sizeof(XkbRF_RuleRec)); } - xfree(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) xfree(group->name); - if (group->words) xfree(group->words); + if (group->name) free(group->name); + if (group->words) free(group->words); } - xfree(rules->groups); + free(rules->groups); rules->num_groups= 0; rules->groups= NULL; } if (freeRules) - xfree(rules); + free(rules); return; } @@ -1365,7 +1365,7 @@ unsigned i,len; char *desc,*start; len= (rep->length*4)-(SIZEOF(xkbGetMapReply)-SIZEOF(xGenericReply)); - start= desc= xcalloc(1, len); + start= desc= calloc(1, len); if (!start) return BadAlloc; if ( rep->nTypes>0 ) @@ -1405,7 +1405,7 @@ char *desc,*start; } WriteToClient(client, (i=SIZEOF(xkbGetMapReply)), (char *)rep); WriteToClient(client, len, start); - xfree((char *)start); + free((char *)start); return client->noClientException; } @@ -2186,8 +2186,8 @@ unsigned first,last; if (maxRG>(int)xkbi->nRadioGroups) { int sz = maxRG*sizeof(XkbRadioGroupRec); if (xkbi->radioGroups) - xkbi->radioGroups= xrealloc(xkbi->radioGroups,sz); - else xkbi->radioGroups= xcalloc(1, sz); + xkbi->radioGroups= realloc(xkbi->radioGroups,sz); + else xkbi->radioGroups= calloc(1, sz); if (xkbi->radioGroups) { if (xkbi->nRadioGroups) bzero(&xkbi->radioGroups[xkbi->nRadioGroups], @@ -2629,7 +2629,7 @@ int size; size= rep->length*4; if (size>0) { - data = xalloc(size); + data = malloc(size); if (data) { register unsigned i,bit; xkbModsWireDesc * grp; @@ -2680,7 +2680,7 @@ int size; WriteToClient(client, SIZEOF(xkbGetCompatMapReply), (char *)rep); if (data) { WriteToClient(client, size, data); - xfree((char *)data); + free((char *)data); } return client->noClientException; } @@ -2777,7 +2777,7 @@ _XkbSetCompatMap(ClientPtr client, DeviceIntPtr dev, XkbSymInterpretPtr sym; if ((unsigned)(req->firstSI+req->nSI)>compat->num_si) { compat->num_si= req->firstSI+req->nSI; - compat->sym_interpret= xrealloc(compat->sym_interpret, + compat->sym_interpret= realloc(compat->sym_interpret, compat->num_si * sizeof(XkbSymInterpretRec)); if (!compat->sym_interpret) { compat->num_si= 0; @@ -2995,7 +2995,7 @@ register unsigned bit; length = rep->length*4; if (length>0) { CARD8 *to; - to= map= xalloc(length); + to= map= malloc(length); if (map) { xkbIndicatorMapWireDesc *wire = (xkbIndicatorMapWireDesc *)to; for (i=0,bit=1;i<XkbNumIndicators;i++,bit<<=1) { @@ -3034,7 +3034,7 @@ register unsigned bit; WriteToClient(client, SIZEOF(xkbGetIndicatorMapReply), (char *)rep); if (map) { WriteToClient(client, length, (char *)map); - xfree((char *)map); + free((char *)map); } return client->noClientException; } @@ -3632,7 +3632,7 @@ register int n; swapl(&rep->indicators,n); } - start = desc = xalloc(length); + start = desc = malloc(length); if ( !start ) return BadAlloc; if (xkb->names) { @@ -3756,7 +3756,7 @@ register int n; } WriteToClient(client, SIZEOF(xkbGetNamesReply), (char *)rep); WriteToClient(client, length, start); - xfree((char *)start); + free((char *)start); return client->noClientException; } @@ -4118,7 +4118,7 @@ _XkbSetNames(ClientPtr client, DeviceIntPtr dev, xkbSetNamesReq *stuff) tmp+= stuff->nKeyAliases*2; } else if (names->key_aliases!=NULL) { - xfree(names->key_aliases); + free(names->key_aliases); names->key_aliases= NULL; names->num_key_aliases= 0; } @@ -4137,7 +4137,7 @@ _XkbSetNames(ClientPtr client, DeviceIntPtr dev, xkbSetNamesReq *stuff) tmp+= stuff->nRadioGroups; } else if (names->radio_groups) { - xfree(names->radio_groups); + free(names->radio_groups); names->radio_groups= NULL; names->num_rg= 0; } @@ -4740,7 +4740,7 @@ XkbSendGeometry( ClientPtr client, if (geom!=NULL) { len= rep->length*4; - start= desc= xalloc(len); + start= desc= malloc(len); if (!start) return BadAlloc; desc= XkbWriteCountedString(desc,geom->label_font,client->swapped); @@ -4784,7 +4784,7 @@ XkbSendGeometry( ClientPtr client, if (len>0) WriteToClient(client, len, start); if (start!=NULL) - xfree((char *)start); + free((char *)start); if (freeGeom) XkbFreeGeometry(geom,XkbGeomAllMask,TRUE); return client->noClientException; @@ -4834,7 +4834,7 @@ CARD16 len,*plen; swaps(plen,n); } len= *plen; - str= xalloc(len+1); + str= malloc(len+1); if (str) { memcpy(str,&wire[2],len); str[len]= '\0'; @@ -5182,16 +5182,16 @@ char * wire; return BadAlloc; val= _GetCountedString(&wire,client->swapped); if (!val) { - xfree(name); + free(name); return BadAlloc; } if (XkbAddGeomProperty(geom,name,val)==NULL) { - xfree(name); - xfree(val); + free(name); + free(val); return BadAlloc; } - xfree(name); - xfree(val); + free(name); + free(val); } if (req->nColors<2) { @@ -5218,10 +5218,10 @@ char * wire; if (!name) return BadAlloc; if (!XkbAddGeomColor(geom,name,geom->num_colors)) { - xfree(name); + free(name); return BadAlloc; } - xfree(name); + free(name); } if (req->nColors!=geom->num_colors) { client->errorValue= _XkbErrCode3(0x05,req->nColors,geom->num_colors); @@ -5449,7 +5449,7 @@ unsigned char *wire,*str,*tmp,*legal; wire= *pWire; len= (*(unsigned char *)wire++); if (len>0) { - str= xcalloc(1, len+1); + str= calloc(1, len+1); if (str) { tmp= str; for (i=0;i<len;i++) { @@ -5460,7 +5460,7 @@ unsigned char *wire,*str,*tmp,*legal; if (tmp!=str) *tmp++= '\0'; else { - xfree(str); + free(str); str= NULL; } } @@ -5511,7 +5511,7 @@ ProcXkbListComponents(ClientPtr client) return BadLength; if ((status=XkbDDXList(dev,&list,client))!=Success) { if (list.pool) { - xfree(list.pool); + free(list.pool); list.pool= NULL; } return status; @@ -5545,7 +5545,7 @@ ProcXkbListComponents(ClientPtr client) WriteToClient(client,SIZEOF(xkbListComponentsReply),(char *)&rep); if (list.nPool && list.pool) { WriteToClient(client,XkbPaddedSize(list.nPool), (char *)list.pool); - xfree(list.pool); + free(list.pool); list.pool= NULL; } return client->noClientException; @@ -5886,11 +5886,11 @@ ProcXkbGetKbdByName(ClientPtr client) XkbFreeKeyboard(new,XkbAllComponentsMask,TRUE); new= NULL; } - if (names.keycodes) { xfree(names.keycodes); names.keycodes= NULL; } - if (names.types) { xfree(names.types); names.types= NULL; } - if (names.compat) { xfree(names.compat); names.compat= NULL; } - if (names.symbols) { xfree(names.symbols); names.symbols= NULL; } - if (names.geometry) { xfree(names.geometry); names.geometry= NULL; } + if (names.keycodes) { free(names.keycodes); names.keycodes= NULL; } + if (names.types) { free(names.types); names.types= NULL; } + if (names.compat) { free(names.compat); names.compat= NULL; } + if (names.symbols) { free(names.symbols); names.symbols= NULL; } + if (names.geometry) { free(names.geometry); names.geometry= NULL; } return client->noClientException; } @@ -6205,12 +6205,12 @@ char * str; } WriteToClient(client,SIZEOF(xkbGetDeviceInfoReply), (char *)&rep); - str= xalloc(nameLen); + str= malloc(nameLen); if (!str) return BadAlloc; XkbWriteCountedString(str,dev->name,client->swapped); WriteToClient(client,nameLen,str); - xfree(str); + free(str); length-= nameLen; if (rep.nBtnsRtrn>0) { @@ -6459,7 +6459,7 @@ _XkbSetDeviceInfoCheck(ClientPtr client, DeviceIntPtr dev, nBtns= dev->button->numButtons; acts= dev->button->xkb_acts; if (acts==NULL) { - acts= xcalloc(nBtns, sizeof(XkbAction)); + acts= calloc(nBtns, sizeof(XkbAction)); if (!acts) return BadAlloc; dev->button->xkb_acts= acts; diff --git a/xkb/xkbActions.c b/xkb/xkbActions.c index 6a9943fbc..0a1a873d1 100644 --- a/xkb/xkbActions.c +++ b/xkb/xkbActions.c @@ -70,7 +70,7 @@ XkbSetExtension(DeviceIntPtr device, ProcessInputProc proc) { xkbDeviceInfoPtr xkbPrivPtr; - xkbPrivPtr = (xkbDeviceInfoPtr) xcalloc(1, sizeof(xkbDeviceInfoRec)); + xkbPrivPtr = (xkbDeviceInfoPtr) calloc(1, sizeof(xkbDeviceInfoRec)); if (!xkbPrivPtr) return; xkbPrivPtr->unwrapProc = NULL; @@ -1020,7 +1020,7 @@ register int i; if (xkbi->szFilters==0) { xkbi->szFilters = 4; - xkbi->filters = xcalloc(xkbi->szFilters, sizeof(XkbFilterRec)); + xkbi->filters = calloc(xkbi->szFilters, sizeof(XkbFilterRec)); /* 6/21/93 (ef) -- XXX! deal with allocation failure */ } for (i=0;i<xkbi->szFilters;i++) { @@ -1030,7 +1030,7 @@ register int i; } } xkbi->szFilters*=2; - xkbi->filters= xrealloc(xkbi->filters, + xkbi->filters= realloc(xkbi->filters, xkbi->szFilters * sizeof(XkbFilterRec)); /* 6/21/93 (ef) -- XXX! deal with allocation failure */ bzero(&xkbi->filters[xkbi->szFilters/2], diff --git a/xkb/xkbEvents.c b/xkb/xkbEvents.c index 9755f9846..0a6a76c10 100644 --- a/xkb/xkbEvents.c +++ b/xkb/xkbEvents.c @@ -1041,7 +1041,7 @@ XkbInterestPtr interest; return ((interest->resource==id)?interest:NULL); interest = interest->next; } - interest = xcalloc(1, sizeof(XkbInterestRec)); + interest = calloc(1, sizeof(XkbInterestRec)); if (interest) { interest->dev = dev; interest->client = client; @@ -1085,7 +1085,7 @@ ClientPtr client = NULL; autoCtrls= interest->autoCtrls; autoValues= interest->autoCtrlValues; client= interest->client; - xfree(interest); + free(interest); found= TRUE; } while ((!found)&&(interest->next)) { @@ -1095,7 +1095,7 @@ ClientPtr client = NULL; autoCtrls= victim->autoCtrls; autoValues= victim->autoCtrlValues; client= victim->client; - xfree(victim); + free(victim); found= TRUE; } interest = interest->next; diff --git a/xkb/xkbInit.c b/xkb/xkbInit.c index 4a3219e2a..93175c538 100644 --- a/xkb/xkbInit.c +++ b/xkb/xkbInit.c @@ -140,14 +140,14 @@ XkbFreeRMLVOSet(XkbRMLVOSet *rmlvo, Bool freeRMLVO) if (!rmlvo) return; - xfree(rmlvo->rules); - xfree(rmlvo->model); - xfree(rmlvo->layout); - xfree(rmlvo->variant); - xfree(rmlvo->options); + free(rmlvo->rules); + free(rmlvo->model); + free(rmlvo->layout); + free(rmlvo->variant); + free(rmlvo->options); if (freeRMLVO) - xfree(rmlvo); + free(rmlvo); else memset(rmlvo, 0, sizeof(XkbRMLVOSet)); } @@ -174,7 +174,7 @@ char * pval; ErrorF("[xkb] Atom error: %s not created\n",_XKB_RF_NAMES_PROP_ATOM); return TRUE; } - pval= (char*) xalloc(len); + pval= (char*) malloc(len); if (!pval) { ErrorF("[xkb] Allocation error: %s proprerty not created\n", _XKB_RF_NAMES_PROP_ATOM); @@ -212,7 +212,7 @@ char * pval; } dixChangeWindowProperty(serverClient, WindowTable[0], name, XA_STRING, 8, PropModeReplace, len, pval, TRUE); - xfree(pval); + free(pval); return TRUE; } @@ -220,19 +220,19 @@ static void XkbSetRulesUsed(XkbRMLVOSet *rmlvo) { if (XkbRulesUsed) - xfree(XkbRulesUsed); + free(XkbRulesUsed); XkbRulesUsed= (rmlvo->rules?_XkbDupString(rmlvo->rules):NULL); if (XkbModelUsed) - xfree(XkbModelUsed); + free(XkbModelUsed); XkbModelUsed= (rmlvo->model?_XkbDupString(rmlvo->model):NULL); if (XkbLayoutUsed) - xfree(XkbLayoutUsed); + free(XkbLayoutUsed); XkbLayoutUsed= (rmlvo->layout?_XkbDupString(rmlvo->layout):NULL); if (XkbVariantUsed) - xfree(XkbVariantUsed); + free(XkbVariantUsed); XkbVariantUsed= (rmlvo->variant?_XkbDupString(rmlvo->variant):NULL); if (XkbOptionsUsed) - xfree(XkbOptionsUsed); + free(XkbOptionsUsed); XkbOptionsUsed= (rmlvo->options?_XkbDupString(rmlvo->options):NULL); if (XkbWantRulesProp) QueueWorkProc(XkbWriteRulesProp,NULL,NULL); @@ -244,27 +244,27 @@ XkbSetRulesDflts(XkbRMLVOSet *rmlvo) { if (rmlvo->rules) { if (XkbRulesDflt) - xfree(XkbRulesDflt); + free(XkbRulesDflt); XkbRulesDflt= _XkbDupString(rmlvo->rules); } if (rmlvo->model) { if (XkbModelDflt) - xfree(XkbModelDflt); + free(XkbModelDflt); XkbModelDflt= _XkbDupString(rmlvo->model); } if (rmlvo->layout) { if (XkbLayoutDflt) - xfree(XkbLayoutDflt); + free(XkbLayoutDflt); XkbLayoutDflt= _XkbDupString(rmlvo->layout); } if (rmlvo->variant) { if (XkbVariantDflt) - xfree(XkbVariantDflt); + free(XkbVariantDflt); XkbVariantDflt= _XkbDupString(rmlvo->variant); } if (rmlvo->options) { if (XkbOptionsDflt) - xfree(XkbOptionsDflt); + free(XkbOptionsDflt); XkbOptionsDflt= _XkbDupString(rmlvo->options); } return; @@ -273,15 +273,15 @@ XkbSetRulesDflts(XkbRMLVOSet *rmlvo) void XkbDeleteRulesDflts(void) { - xfree(XkbRulesDflt); + free(XkbRulesDflt); XkbRulesDflt = NULL; - xfree(XkbModelDflt); + free(XkbModelDflt); XkbModelDflt = NULL; - xfree(XkbLayoutDflt); + free(XkbLayoutDflt); XkbLayoutDflt = NULL; - xfree(XkbVariantDflt); + free(XkbVariantDflt); XkbVariantDflt = NULL; - xfree(XkbOptionsDflt); + free(XkbOptionsDflt); XkbOptionsDflt = NULL; XkbFreeKeyboard(xkb_cached_map, XkbAllComponentsMask, TRUE); @@ -515,20 +515,20 @@ InitKeyboardDeviceStruct(DeviceIntPtr dev, XkbRMLVOSet *rmlvo, memset(&changes, 0, sizeof(changes)); XkbSetCauseUnknown(&cause); - dev->key = xcalloc(1, sizeof(*dev->key)); + dev->key = calloc(1, sizeof(*dev->key)); if (!dev->key) { ErrorF("XKB: Failed to allocate key class\n"); return FALSE; } dev->key->sourceid = dev->id; - dev->kbdfeed = xcalloc(1, sizeof(*dev->kbdfeed)); + dev->kbdfeed = calloc(1, sizeof(*dev->kbdfeed)); if (!dev->kbdfeed) { ErrorF("XKB: Failed to allocate key feedback class\n"); goto unwind_key; } - xkbi = xcalloc(1, sizeof(*xkbi)); + xkbi = calloc(1, sizeof(*xkbi)); if (!xkbi) { ErrorF("XKB: Failed to allocate XKB info\n"); goto unwind_kbdfeed; @@ -620,13 +620,13 @@ InitKeyboardDeviceStruct(DeviceIntPtr dev, XkbRMLVOSet *rmlvo, unwind_desc: XkbFreeKeyboard(xkb, 0, TRUE); unwind_info: - xfree(xkbi); + free(xkbi); dev->key->xkbInfo = NULL; unwind_kbdfeed: - xfree(dev->kbdfeed); + free(dev->kbdfeed); dev->kbdfeed = NULL; unwind_key: - xfree(dev->key); + free(dev->key); dev->key = NULL; return FALSE; } @@ -645,7 +645,7 @@ void XkbFreeInfo(XkbSrvInfoPtr xkbi) { if (xkbi->radioGroups) { - xfree(xkbi->radioGroups); + free(xkbi->radioGroups); xkbi->radioGroups= NULL; } if (xkbi->mouseKeyTimer) { @@ -677,7 +677,7 @@ XkbFreeInfo(XkbSrvInfoPtr xkbi) XkbFreeKeyboard(xkbi->desc,XkbAllComponentsMask,TRUE); xkbi->desc= NULL; } - xfree(xkbi); + free(xkbi); return; } diff --git a/xkb/xkbLEDs.c b/xkb/xkbLEDs.c index 8c28513ec..6097f8576 100644 --- a/xkb/xkbLEDs.c +++ b/xkb/xkbLEDs.c @@ -524,7 +524,7 @@ Bool checkNames; sli= NULL; checkAccel= checkNames= FALSE; if ((kf!=NULL)&&(kf->xkb_sli==NULL)) { - kf->xkb_sli= sli= xcalloc(1, sizeof(XkbSrvLedInfoRec)); + kf->xkb_sli= sli= calloc(1, sizeof(XkbSrvLedInfoRec)); if (sli==NULL) return NULL; /* ALLOCATION ERROR */ if (dev->key && dev->key->xkbInfo) @@ -567,7 +567,7 @@ Bool checkNames; } } else if ((lf!=NULL)&&(lf->xkb_sli==NULL)) { - lf->xkb_sli= sli= xcalloc(1, sizeof(XkbSrvLedInfoRec)); + lf->xkb_sli= sli= calloc(1, sizeof(XkbSrvLedInfoRec)); if (sli==NULL) return NULL; /* ALLOCATION ERROR */ if (dev->key && dev->key->xkbInfo) @@ -585,9 +585,9 @@ Bool checkNames; sli->names= NULL; } if ((sli->names==NULL)&&(needed_parts&XkbXI_IndicatorNamesMask)) - sli->names= xcalloc(XkbNumIndicators, sizeof(Atom)); + sli->names= calloc(XkbNumIndicators, sizeof(Atom)); if ((sli->maps==NULL)&&(needed_parts&XkbXI_IndicatorMapsMask)) - sli->maps= xcalloc(XkbNumIndicators, sizeof(XkbIndicatorMapRec)); + sli->maps= calloc(XkbNumIndicators, sizeof(XkbIndicatorMapRec)); if (checkNames) { register unsigned i,bit; sli->namesPresent= 0; @@ -605,12 +605,12 @@ void XkbFreeSrvLedInfo(XkbSrvLedInfoPtr sli) { if ((sli->flags&XkbSLI_IsDefault)==0) { - if (sli->maps) xfree(sli->maps); - if (sli->names) xfree(sli->names); + if (sli->maps) free(sli->maps); + if (sli->names) free(sli->names); } sli->maps= NULL; sli->names= NULL; - xfree(sli); + free(sli); return; } @@ -633,7 +633,7 @@ XkbCopySrvLedInfo( DeviceIntPtr from, if (!src) goto finish; - sli_new = xcalloc(1, sizeof( XkbSrvLedInfoRec)); + sli_new = calloc(1, sizeof( XkbSrvLedInfoRec)); if (!sli_new) goto finish; @@ -644,8 +644,8 @@ XkbCopySrvLedInfo( DeviceIntPtr from, sli_new->fb.lf = lf; if (!(sli_new->flags & XkbSLI_IsDefault)) { - sli_new->names= xcalloc(XkbNumIndicators, sizeof(Atom)); - sli_new->maps= xcalloc(XkbNumIndicators, sizeof(XkbIndicatorMapRec)); + sli_new->names= calloc(XkbNumIndicators, sizeof(Atom)); + sli_new->maps= calloc(XkbNumIndicators, sizeof(XkbIndicatorMapRec)); } /* else sli_new->names/maps is pointing to dev->key->xkbInfo->desc->names->indicators; dev->key->xkbInfo->desc->names->indicators; */ @@ -715,9 +715,9 @@ XkbSrvLedInfoPtr sli; } } if ((sli->names==NULL)&&(needed_parts&XkbXI_IndicatorNamesMask)) - sli->names= xcalloc(XkbNumIndicators, sizeof(Atom)); + sli->names= calloc(XkbNumIndicators, sizeof(Atom)); if ((sli->maps==NULL)&&(needed_parts&XkbXI_IndicatorMapsMask)) - sli->maps= xcalloc(XkbNumIndicators, sizeof(XkbIndicatorMapRec)); + sli->maps= calloc(XkbNumIndicators, sizeof(XkbIndicatorMapRec)); return sli; } diff --git a/xkb/xkbUtils.c b/xkb/xkbUtils.c index 6d0901a36..e3fb9dc3a 100644 --- a/xkb/xkbUtils.c +++ b/xkb/xkbUtils.c @@ -410,7 +410,7 @@ int maxNumberOfGroups; if (maxSymsPerKey <= 0) return NULL; - syms = xcalloc(1, sizeof(*syms)); + syms = calloc(1, sizeof(*syms)); if (!syms) return NULL; @@ -427,9 +427,9 @@ int maxNumberOfGroups; syms->maxKeyCode = xkb->max_key_code; tmp = syms->mapWidth * (xkb->max_key_code - xkb->min_key_code + 1); - syms->map = xcalloc(tmp, sizeof(*syms->map)); + syms->map = calloc(tmp, sizeof(*syms->map)); if (!syms->map) { - xfree(syms); + free(syms); return NULL; } @@ -911,7 +911,7 @@ _XkbCopyClientMap(XkbDescPtr src, XkbDescPtr dst) /* client map */ if (src->map) { if (!dst->map) { - tmp = xcalloc(1, sizeof(XkbClientMapRec)); + tmp = calloc(1, sizeof(XkbClientMapRec)); if (!tmp) return FALSE; dst->map = tmp; @@ -920,10 +920,10 @@ _XkbCopyClientMap(XkbDescPtr src, XkbDescPtr dst) if (src->map->syms) { if (src->map->size_syms != dst->map->size_syms) { if (dst->map->syms) - tmp = xrealloc(dst->map->syms, + tmp = realloc(dst->map->syms, src->map->size_syms * sizeof(KeySym)); else - tmp = xalloc(src->map->size_syms * sizeof(KeySym)); + tmp = malloc(src->map->size_syms * sizeof(KeySym)); if (!tmp) return FALSE; dst->map->syms = tmp; @@ -934,7 +934,7 @@ _XkbCopyClientMap(XkbDescPtr src, XkbDescPtr dst) } else { if (dst->map->syms) { - xfree(dst->map->syms); + free(dst->map->syms); dst->map->syms = NULL; } } @@ -944,11 +944,11 @@ _XkbCopyClientMap(XkbDescPtr src, XkbDescPtr dst) if (src->map->key_sym_map) { if (src->max_key_code != dst->max_key_code) { if (dst->map->key_sym_map) - tmp = xrealloc(dst->map->key_sym_map, + tmp = realloc(dst->map->key_sym_map, (src->max_key_code + 1) * sizeof(XkbSymMapRec)); else - tmp = xalloc((src->max_key_code + 1) * + tmp = malloc((src->max_key_code + 1) * sizeof(XkbSymMapRec)); if (!tmp) return FALSE; @@ -959,7 +959,7 @@ _XkbCopyClientMap(XkbDescPtr src, XkbDescPtr dst) } else { if (dst->map->key_sym_map) { - xfree(dst->map->key_sym_map); + free(dst->map->key_sym_map); dst->map->key_sym_map = NULL; } } @@ -968,7 +968,7 @@ _XkbCopyClientMap(XkbDescPtr src, XkbDescPtr dst) if (src->map->num_types > dst->map->size_types || !dst->map->types || !dst->map->size_types) { if (dst->map->types && dst->map->size_types) { - tmp = xrealloc(dst->map->types, + tmp = realloc(dst->map->types, src->map->num_types * sizeof(XkbKeyTypeRec)); if (!tmp) return FALSE; @@ -978,7 +978,7 @@ _XkbCopyClientMap(XkbDescPtr src, XkbDescPtr dst) sizeof(XkbKeyTypeRec)); } else { - tmp = xcalloc(src->map->num_types, sizeof(XkbKeyTypeRec)); + tmp = calloc(src->map->num_types, sizeof(XkbKeyTypeRec)); if (!tmp) return FALSE; dst->map->types = tmp; @@ -989,14 +989,14 @@ _XkbCopyClientMap(XkbDescPtr src, XkbDescPtr dst) for (i = src->map->num_types, dtype = (dst->map->types + i); i < dst->map->num_types; i++, dtype++) { if (dtype->level_names) - xfree(dtype->level_names); + free(dtype->level_names); dtype->level_names = NULL; dtype->num_levels = 0; if (dtype->map_count) { if (dtype->map) - xfree(dtype->map); + free(dtype->map); if (dtype->preserve) - xfree(dtype->preserve); + free(dtype->preserve); } } } @@ -1008,7 +1008,7 @@ _XkbCopyClientMap(XkbDescPtr src, XkbDescPtr dst) if (stype->num_levels != dtype->num_levels && dtype->num_levels && dtype->level_names && i < dst->map->num_types) { - tmp = xrealloc(dtype->level_names, + tmp = realloc(dtype->level_names, stype->num_levels * sizeof(Atom)); if (!tmp) continue; @@ -1016,7 +1016,7 @@ _XkbCopyClientMap(XkbDescPtr src, XkbDescPtr dst) } else if (!dtype->num_levels || !dtype->level_names || i >= dst->map->num_types) { - tmp = xalloc(stype->num_levels * sizeof(Atom)); + tmp = malloc(stype->num_levels * sizeof(Atom)); if (!tmp) continue; dtype->level_names = tmp; @@ -1028,7 +1028,7 @@ _XkbCopyClientMap(XkbDescPtr src, XkbDescPtr dst) else { if (dtype->num_levels && dtype->level_names && i < dst->map->num_types) - xfree(dtype->level_names); + free(dtype->level_names); dtype->num_levels = 0; dtype->level_names = NULL; } @@ -1041,7 +1041,7 @@ _XkbCopyClientMap(XkbDescPtr src, XkbDescPtr dst) if (stype->map_count != dtype->map_count && dtype->map_count && dtype->map && i < dst->map->num_types) { - tmp = xrealloc(dtype->map, + tmp = realloc(dtype->map, stype->map_count * sizeof(XkbKTMapEntryRec)); if (!tmp) @@ -1050,7 +1050,7 @@ _XkbCopyClientMap(XkbDescPtr src, XkbDescPtr dst) } else if (!dtype->map_count || !dtype->map || i >= dst->map->num_types) { - tmp = xalloc(stype->map_count * + tmp = malloc(stype->map_count * sizeof(XkbKTMapEntryRec)); if (!tmp) return FALSE; @@ -1062,7 +1062,7 @@ _XkbCopyClientMap(XkbDescPtr src, XkbDescPtr dst) } else { if (dtype->map && i < dst->map->num_types) - xfree(dtype->map); + free(dtype->map); dtype->map = NULL; } @@ -1070,7 +1070,7 @@ _XkbCopyClientMap(XkbDescPtr src, XkbDescPtr dst) if (stype->map_count != dtype->map_count && dtype->map_count && dtype->preserve && i < dst->map->num_types) { - tmp = xrealloc(dtype->preserve, + tmp = realloc(dtype->preserve, stype->map_count * sizeof(XkbModsRec)); if (!tmp) @@ -1079,7 +1079,7 @@ _XkbCopyClientMap(XkbDescPtr src, XkbDescPtr dst) } else if (!dtype->preserve || !dtype->map_count || i >= dst->map->num_types) { - tmp = xalloc(stype->map_count * + tmp = malloc(stype->map_count * sizeof(XkbModsRec)); if (!tmp) return FALSE; @@ -1091,7 +1091,7 @@ _XkbCopyClientMap(XkbDescPtr src, XkbDescPtr dst) } else { if (dtype->preserve && i < dst->map->num_types) - xfree(dtype->preserve); + free(dtype->preserve); dtype->preserve = NULL; } @@ -1100,9 +1100,9 @@ _XkbCopyClientMap(XkbDescPtr src, XkbDescPtr dst) else { if (dtype->map_count && i < dst->map->num_types) { if (dtype->map) - xfree(dtype->map); + free(dtype->map); if (dtype->preserve) - xfree(dtype->preserve); + free(dtype->preserve); } dtype->map_count = 0; dtype->map = NULL; @@ -1118,13 +1118,13 @@ _XkbCopyClientMap(XkbDescPtr src, XkbDescPtr dst) for (i = 0, dtype = dst->map->types; i < dst->map->num_types; i++, dtype++) { if (dtype->level_names) - xfree(dtype->level_names); + free(dtype->level_names); if (dtype->map && dtype->map_count) - xfree(dtype->map); + free(dtype->map); if (dtype->preserve && dtype->map_count) - xfree(dtype->preserve); + free(dtype->preserve); } - xfree(dst->map->types); + free(dst->map->types); dst->map->types = NULL; } dst->map->num_types = 0; @@ -1134,9 +1134,9 @@ _XkbCopyClientMap(XkbDescPtr src, XkbDescPtr dst) if (src->map->modmap) { if (src->max_key_code != dst->max_key_code) { if (dst->map->modmap) - tmp = xrealloc(dst->map->modmap, src->max_key_code + 1); + tmp = realloc(dst->map->modmap, src->max_key_code + 1); else - tmp = xalloc(src->max_key_code + 1); + tmp = malloc(src->max_key_code + 1); if (!tmp) return FALSE; dst->map->modmap = tmp; @@ -1145,7 +1145,7 @@ _XkbCopyClientMap(XkbDescPtr src, XkbDescPtr dst) } else { if (dst->map->modmap) { - xfree(dst->map->modmap); + free(dst->map->modmap); dst->map->modmap = NULL; } } @@ -1166,7 +1166,7 @@ _XkbCopyServerMap(XkbDescPtr src, XkbDescPtr dst) /* server map */ if (src->server) { if (!dst->server) { - tmp = xcalloc(1, sizeof(XkbServerMapRec)); + tmp = calloc(1, sizeof(XkbServerMapRec)); if (!tmp) return FALSE; dst->server = tmp; @@ -1175,9 +1175,9 @@ _XkbCopyServerMap(XkbDescPtr src, XkbDescPtr dst) if (src->server->explicit) { if (src->max_key_code != dst->max_key_code) { if (dst->server->explicit) - tmp = xrealloc(dst->server->explicit, src->max_key_code + 1); + tmp = realloc(dst->server->explicit, src->max_key_code + 1); else - tmp = xalloc(src->max_key_code + 1); + tmp = malloc(src->max_key_code + 1); if (!tmp) return FALSE; dst->server->explicit = tmp; @@ -1187,7 +1187,7 @@ _XkbCopyServerMap(XkbDescPtr src, XkbDescPtr dst) } else { if (dst->server->explicit) { - xfree(dst->server->explicit); + free(dst->server->explicit); dst->server->explicit = NULL; } } @@ -1195,10 +1195,10 @@ _XkbCopyServerMap(XkbDescPtr src, XkbDescPtr dst) if (src->server->acts) { if (src->server->size_acts != dst->server->size_acts) { if (dst->server->acts) - tmp = xrealloc(dst->server->acts, + tmp = realloc(dst->server->acts, src->server->size_acts * sizeof(XkbAction)); else - tmp = xalloc(src->server->size_acts * sizeof(XkbAction)); + tmp = malloc(src->server->size_acts * sizeof(XkbAction)); if (!tmp) return FALSE; dst->server->acts = tmp; @@ -1208,7 +1208,7 @@ _XkbCopyServerMap(XkbDescPtr src, XkbDescPtr dst) } else { if (dst->server->acts) { - xfree(dst->server->acts); + free(dst->server->acts); dst->server->acts = NULL; } } @@ -1218,11 +1218,11 @@ _XkbCopyServerMap(XkbDescPtr src, XkbDescPtr dst) if (src->server->key_acts) { if (src->max_key_code != dst->max_key_code) { if (dst->server->key_acts) - tmp = xrealloc(dst->server->key_acts, + tmp = realloc(dst->server->key_acts, (src->max_key_code + 1) * sizeof(unsigned short)); else - tmp = xalloc((src->max_key_code + 1) * + tmp = malloc((src->max_key_code + 1) * sizeof(unsigned short)); if (!tmp) return FALSE; @@ -1233,7 +1233,7 @@ _XkbCopyServerMap(XkbDescPtr src, XkbDescPtr dst) } else { if (dst->server->key_acts) { - xfree(dst->server->key_acts); + free(dst->server->key_acts); dst->server->key_acts = NULL; } } @@ -1241,11 +1241,11 @@ _XkbCopyServerMap(XkbDescPtr src, XkbDescPtr dst) if (src->server->behaviors) { if (src->max_key_code != dst->max_key_code) { if (dst->server->behaviors) - tmp = xrealloc(dst->server->behaviors, + tmp = realloc(dst->server->behaviors, (src->max_key_code + 1) * sizeof(XkbBehavior)); else - tmp = xalloc((src->max_key_code + 1) * + tmp = malloc((src->max_key_code + 1) * sizeof(XkbBehavior)); if (!tmp) return FALSE; @@ -1256,7 +1256,7 @@ _XkbCopyServerMap(XkbDescPtr src, XkbDescPtr dst) } else { if (dst->server->behaviors) { - xfree(dst->server->behaviors); + free(dst->server->behaviors); dst->server->behaviors = NULL; } } @@ -1266,11 +1266,11 @@ _XkbCopyServerMap(XkbDescPtr src, XkbDescPtr dst) if (src->server->vmodmap) { if (src->max_key_code != dst->max_key_code) { if (dst->server->vmodmap) - tmp = xrealloc(dst->server->vmodmap, + tmp = realloc(dst->server->vmodmap, (src->max_key_code + 1) * sizeof(unsigned short)); else - tmp = xalloc((src->max_key_code + 1) * + tmp = malloc((src->max_key_code + 1) * sizeof(unsigned short)); if (!tmp) return FALSE; @@ -1281,7 +1281,7 @@ _XkbCopyServerMap(XkbDescPtr src, XkbDescPtr dst) } else { if (dst->server->vmodmap) { - xfree(dst->server->vmodmap); + free(dst->server->vmodmap); dst->server->vmodmap = NULL; } } @@ -1302,7 +1302,7 @@ _XkbCopyNames(XkbDescPtr src, XkbDescPtr dst) /* names */ if (src->names) { if (!dst->names) { - dst->names = xcalloc(1, sizeof(XkbNamesRec)); + dst->names = calloc(1, sizeof(XkbNamesRec)); if (!dst->names) return FALSE; } @@ -1310,10 +1310,10 @@ _XkbCopyNames(XkbDescPtr src, XkbDescPtr dst) if (src->names->keys) { if (src->max_key_code != dst->max_key_code) { if (dst->names->keys) - tmp = xrealloc(dst->names->keys, (src->max_key_code + 1) * + tmp = realloc(dst->names->keys, (src->max_key_code + 1) * sizeof(XkbKeyNameRec)); else - tmp = xalloc((src->max_key_code + 1) * + tmp = malloc((src->max_key_code + 1) * sizeof(XkbKeyNameRec)); if (!tmp) return FALSE; @@ -1324,7 +1324,7 @@ _XkbCopyNames(XkbDescPtr src, XkbDescPtr dst) } else { if (dst->names->keys) { - xfree(dst->names->keys); + free(dst->names->keys); dst->names->keys = NULL; } } @@ -1332,11 +1332,11 @@ _XkbCopyNames(XkbDescPtr src, XkbDescPtr dst) if (src->names->num_key_aliases) { if (src->names->num_key_aliases != dst->names->num_key_aliases) { if (dst->names->key_aliases) - tmp = xrealloc(dst->names->key_aliases, + tmp = realloc(dst->names->key_aliases, src->names->num_key_aliases * sizeof(XkbKeyAliasRec)); else - tmp = xalloc(src->names->num_key_aliases * + tmp = malloc(src->names->num_key_aliases * sizeof(XkbKeyAliasRec)); if (!tmp) return FALSE; @@ -1347,7 +1347,7 @@ _XkbCopyNames(XkbDescPtr src, XkbDescPtr dst) } else { if (dst->names->key_aliases) { - xfree(dst->names->key_aliases); + free(dst->names->key_aliases); dst->names->key_aliases = NULL; } } @@ -1356,10 +1356,10 @@ _XkbCopyNames(XkbDescPtr src, XkbDescPtr dst) if (src->names->num_rg) { if (src->names->num_rg != dst->names->num_rg) { if (dst->names->radio_groups) - tmp = xrealloc(dst->names->radio_groups, + tmp = realloc(dst->names->radio_groups, src->names->num_rg * sizeof(Atom)); else - tmp = xalloc(src->names->num_rg * sizeof(Atom)); + tmp = malloc(src->names->num_rg * sizeof(Atom)); if (!tmp) return FALSE; dst->names->radio_groups = tmp; @@ -1369,7 +1369,7 @@ _XkbCopyNames(XkbDescPtr src, XkbDescPtr dst) } else { if (dst->names->radio_groups) - xfree(dst->names->radio_groups); + free(dst->names->radio_groups); } dst->names->num_rg = src->names->num_rg; @@ -1403,7 +1403,7 @@ _XkbCopyCompat(XkbDescPtr src, XkbDescPtr dst) /* compat */ if (src->compat) { if (!dst->compat) { - dst->compat = xcalloc(1, sizeof(XkbCompatMapRec)); + dst->compat = calloc(1, sizeof(XkbCompatMapRec)); if (!dst->compat) return FALSE; } @@ -1411,11 +1411,11 @@ _XkbCopyCompat(XkbDescPtr src, XkbDescPtr dst) if (src->compat->sym_interpret && src->compat->num_si) { if (src->compat->num_si != dst->compat->size_si) { if (dst->compat->sym_interpret) - tmp = xrealloc(dst->compat->sym_interpret, + tmp = realloc(dst->compat->sym_interpret, src->compat->num_si * sizeof(XkbSymInterpretRec)); else - tmp = xalloc(src->compat->num_si * + tmp = malloc(src->compat->num_si * sizeof(XkbSymInterpretRec)); if (!tmp) return FALSE; @@ -1429,7 +1429,7 @@ _XkbCopyCompat(XkbDescPtr src, XkbDescPtr dst) } else { if (dst->compat->sym_interpret && dst->compat->size_si) - xfree(dst->compat->sym_interpret); + free(dst->compat->sym_interpret); dst->compat->sym_interpret = NULL; dst->compat->num_si = 0; @@ -1463,7 +1463,7 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst) /* geometry */ if (src->geom) { if (!dst->geom) { - dst->geom = xcalloc(sizeof(XkbGeometryRec), 1); + dst->geom = calloc(sizeof(XkbGeometryRec), 1); if (!dst->geom) return FALSE; } @@ -1479,17 +1479,17 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst) dprop = dst->geom->properties + i; i < dst->geom->num_properties; i++, dprop++) { - xfree(dprop->name); - xfree(dprop->value); + free(dprop->name); + free(dprop->value); } } if (dst->geom->sz_properties) - tmp = xrealloc(dst->geom->properties, + tmp = realloc(dst->geom->properties, src->geom->num_properties * sizeof(XkbPropertyRec)); else - tmp = xalloc(src->geom->num_properties * + tmp = malloc(src->geom->num_properties * sizeof(XkbPropertyRec)); if (!tmp) return FALSE; @@ -1513,13 +1513,13 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst) i++, sprop++, dprop++) { if (i < dst->geom->num_properties) { if (strlen(sprop->name) != strlen(dprop->name)) { - tmp = xrealloc(dprop->name, strlen(sprop->name) + 1); + tmp = realloc(dprop->name, strlen(sprop->name) + 1); if (!tmp) return FALSE; dprop->name = tmp; } if (strlen(sprop->value) != strlen(dprop->value)) { - tmp = xrealloc(dprop->value, strlen(sprop->value) + 1); + tmp = realloc(dprop->value, strlen(sprop->value) + 1); if (!tmp) return FALSE; dprop->value = tmp; @@ -1541,10 +1541,10 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst) for (i = 0, dprop = dst->geom->properties; i < dst->geom->num_properties; i++, dprop++) { - xfree(dprop->name); - xfree(dprop->value); + free(dprop->name); + free(dprop->value); } - xfree(dst->geom->properties); + free(dst->geom->properties); dst->geom->properties = NULL; } @@ -1560,16 +1560,16 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst) dcolor = dst->geom->colors + i; i < dst->geom->num_colors; i++, dcolor++) { - xfree(dcolor->spec); + free(dcolor->spec); } } if (dst->geom->sz_colors) - tmp = xrealloc(dst->geom->colors, + tmp = realloc(dst->geom->colors, src->geom->num_colors * sizeof(XkbColorRec)); else - tmp = xalloc(src->geom->num_colors * + tmp = malloc(src->geom->num_colors * sizeof(XkbColorRec)); if (!tmp) return FALSE; @@ -1591,7 +1591,7 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst) i++, scolor++, dcolor++) { if (i < dst->geom->num_colors) { if (strlen(scolor->spec) != strlen(dcolor->spec)) { - tmp = xrealloc(dcolor->spec, strlen(scolor->spec) + 1); + tmp = realloc(dcolor->spec, strlen(scolor->spec) + 1); if (!tmp) return FALSE; dcolor->spec = tmp; @@ -1611,9 +1611,9 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst) for (i = 0, dcolor = dst->geom->colors; i < dst->geom->num_colors; i++, dcolor++) { - xfree(dcolor->spec); + free(dcolor->spec); } - xfree(dst->geom->colors); + free(dst->geom->colors); dst->geom->colors = NULL; } @@ -1631,11 +1631,11 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst) j < dshape->num_outlines; j++, doutline++) { if (doutline->sz_points) - xfree(doutline->points); + free(doutline->points); } if (dshape->sz_outlines) { - xfree(dshape->outlines); + free(dshape->outlines); dshape->outlines = NULL; } @@ -1645,7 +1645,7 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst) } if (src->geom->num_shapes) { - tmp = xcalloc(src->geom->num_shapes, sizeof(XkbShapeRec)); + tmp = calloc(src->geom->num_shapes, sizeof(XkbShapeRec)); if (!tmp) return FALSE; dst->geom->shapes = tmp; @@ -1654,7 +1654,7 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst) i < src->geom->num_shapes; i++, sshape++, dshape++) { if (sshape->num_outlines) { - tmp = xcalloc(sshape->num_outlines, sizeof(XkbOutlineRec)); + tmp = calloc(sshape->num_outlines, sizeof(XkbOutlineRec)); if (!tmp) return FALSE; dshape->outlines = tmp; @@ -1665,7 +1665,7 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst) j < sshape->num_outlines; j++, soutline++, doutline++) { if (soutline->num_points) { - tmp = xalloc(soutline->num_points * + tmp = malloc(soutline->num_points * sizeof(XkbPointRec)); if (!tmp) return FALSE; @@ -1721,7 +1721,7 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst) } else { if (dst->geom->sz_shapes) { - xfree(dst->geom->shapes); + free(dst->geom->shapes); } dst->geom->shapes = NULL; dst->geom->num_shapes = 0; @@ -1739,11 +1739,11 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst) j < dsection->num_rows; j++, drow++) { if (drow->num_keys) - xfree(drow->keys); + free(drow->keys); } if (dsection->num_rows) - xfree(dsection->rows); + free(dsection->rows); /* cut and waste from geom/doodad below. */ for (j = 0, ddoodad = dsection->doodads; @@ -1751,24 +1751,24 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst) j++, ddoodad++) { if (ddoodad->any.type == XkbTextDoodad) { if (ddoodad->text.text) { - xfree(ddoodad->text.text); + free(ddoodad->text.text); ddoodad->text.text = NULL; } if (ddoodad->text.font) { - xfree(ddoodad->text.font); + free(ddoodad->text.font); ddoodad->text.font = NULL; } } else if (ddoodad->any.type == XkbLogoDoodad) { if (ddoodad->logo.logo_name) { - xfree(ddoodad->logo.logo_name); + free(ddoodad->logo.logo_name); ddoodad->logo.logo_name = NULL; } } } if (dsection->num_doodads) - xfree(dsection->doodads); + free(dsection->doodads); } dst->geom->num_sections = 0; @@ -1777,11 +1777,11 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst) if (src->geom->num_sections) { if (dst->geom->sz_sections) - tmp = xrealloc(dst->geom->sections, + tmp = realloc(dst->geom->sections, src->geom->num_sections * sizeof(XkbSectionRec)); else - tmp = xalloc(src->geom->num_sections * sizeof(XkbSectionRec)); + tmp = malloc(src->geom->num_sections * sizeof(XkbSectionRec)); if (!tmp) return FALSE; memset(tmp, 0, src->geom->num_sections * sizeof(XkbSectionRec)); @@ -1796,7 +1796,7 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst) i++, ssection++, dsection++) { *dsection = *ssection; if (ssection->num_rows) { - tmp = xcalloc(ssection->num_rows, sizeof(XkbRowRec)); + tmp = calloc(ssection->num_rows, sizeof(XkbRowRec)); if (!tmp) return FALSE; dsection->rows = tmp; @@ -1808,7 +1808,7 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst) j < ssection->num_rows; j++, srow++, drow++) { if (srow->num_keys) { - tmp = xalloc(srow->num_keys * sizeof(XkbKeyRec)); + tmp = malloc(srow->num_keys * sizeof(XkbKeyRec)); if (!tmp) return FALSE; drow->keys = tmp; @@ -1824,7 +1824,7 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst) } if (ssection->num_doodads) { - tmp = xcalloc(ssection->num_doodads, sizeof(XkbDoodadRec)); + tmp = calloc(ssection->num_doodads, sizeof(XkbDoodadRec)); if (!tmp) return FALSE; dsection->doodads = tmp; @@ -1861,7 +1861,7 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst) } else { if (dst->geom->sz_sections) { - xfree(dst->geom->sections); + free(dst->geom->sections); } dst->geom->sections = NULL; @@ -1878,17 +1878,17 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst) i++, ddoodad++) { if (ddoodad->any.type == XkbTextDoodad) { if (ddoodad->text.text) { - xfree(ddoodad->text.text); + free(ddoodad->text.text); ddoodad->text.text = NULL; } if (ddoodad->text.font) { - xfree(ddoodad->text.font); + free(ddoodad->text.font); ddoodad->text.font = NULL; } } else if (ddoodad->any.type == XkbLogoDoodad) { if (ddoodad->logo.logo_name) { - xfree(ddoodad->logo.logo_name); + free(ddoodad->logo.logo_name); ddoodad->logo.logo_name = NULL; } } @@ -1899,11 +1899,11 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst) if (src->geom->num_doodads) { if (dst->geom->sz_doodads) - tmp = xrealloc(dst->geom->doodads, + tmp = realloc(dst->geom->doodads, src->geom->num_doodads * sizeof(XkbDoodadRec)); else - tmp = xalloc(src->geom->num_doodads * + tmp = malloc(src->geom->num_doodads * sizeof(XkbDoodadRec)); if (!tmp) return FALSE; @@ -1935,7 +1935,7 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst) } else { if (dst->geom->sz_doodads) { - xfree(dst->geom->doodads); + free(dst->geom->doodads); } dst->geom->doodads = NULL; @@ -1947,11 +1947,11 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst) if (src->geom->num_key_aliases) { if (src->geom->num_key_aliases != dst->geom->sz_key_aliases) { if (dst->geom->sz_key_aliases) - tmp = xrealloc(dst->geom->key_aliases, + tmp = realloc(dst->geom->key_aliases, src->geom->num_key_aliases * 2 * XkbKeyNameLength); else - tmp = xalloc(src->geom->num_key_aliases * + tmp = malloc(src->geom->num_key_aliases * 2 * XkbKeyNameLength); if (!tmp) return FALSE; @@ -1967,7 +1967,7 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst) } else { if (dst->geom->key_aliases) { - xfree(dst->geom->key_aliases); + free(dst->geom->key_aliases); } dst->geom->key_aliases = NULL; dst->geom->num_key_aliases = 0; @@ -1977,14 +1977,14 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst) /* font */ if (src->geom->label_font) { if (!dst->geom->label_font) { - tmp = xalloc(strlen(src->geom->label_font)); + tmp = malloc(strlen(src->geom->label_font)); if (!tmp) return FALSE; dst->geom->label_font = tmp; } else if (strlen(src->geom->label_font) != strlen(dst->geom->label_font)) { - tmp = xrealloc(dst->geom->label_font, + tmp = realloc(dst->geom->label_font, strlen(src->geom->label_font)); if (!tmp) return FALSE; @@ -1999,7 +1999,7 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst) } else { if (dst->geom->label_font) { - xfree(dst->geom->label_font); + free(dst->geom->label_font); } dst->geom->label_font = NULL; dst->geom->label_color = NULL; @@ -2028,7 +2028,7 @@ _XkbCopyIndicators(XkbDescPtr src, XkbDescPtr dst) /* indicators */ if (src->indicators) { if (!dst->indicators) { - dst->indicators = xalloc(sizeof(XkbIndicatorRec)); + dst->indicators = malloc(sizeof(XkbIndicatorRec)); if (!dst->indicators) return FALSE; } @@ -2036,7 +2036,7 @@ _XkbCopyIndicators(XkbDescPtr src, XkbDescPtr dst) } else { if (dst->indicators) { - xfree(dst->indicators); + free(dst->indicators); dst->indicators = NULL; } } @@ -2049,7 +2049,7 @@ _XkbCopyControls(XkbDescPtr src, XkbDescPtr dst) /* controls */ if (src->ctrls) { if (!dst->ctrls) { - dst->ctrls = xalloc(sizeof(XkbControlsRec)); + dst->ctrls = malloc(sizeof(XkbControlsRec)); if (!dst->ctrls) return FALSE; } @@ -2057,7 +2057,7 @@ _XkbCopyControls(XkbDescPtr src, XkbDescPtr dst) } else { if (dst->ctrls) { - xfree(dst->ctrls); + free(dst->ctrls); dst->ctrls = NULL; } } diff --git a/xkb/xkmread.c b/xkb/xkmread.c index a201731f3..5d3372da2 100644 --- a/xkb/xkmread.c +++ b/xkb/xkmread.c @@ -58,7 +58,7 @@ char *new; if (str==NULL) return NULL; - new= xcalloc(strlen(str)+1,sizeof(char)); + new= calloc(strlen(str)+1,sizeof(char)); if (new) strcpy(new,str); return new; @@ -74,10 +74,10 @@ int newCount= *newCountRtrn; if (oldPtr==NULL) { if (newCount==0) return NULL; - oldPtr= xcalloc(newCount,elemSize); + oldPtr= calloc(newCount,elemSize); } else if (oldCount<newCount) { - oldPtr= xrealloc(oldPtr,newCount*elemSize); + oldPtr= realloc(oldPtr,newCount*elemSize); if (oldPtr!=NULL) { char *tmp= (char *)oldPtr; bzero(&tmp[oldCount*elemSize],(newCount-oldCount)*elemSize); |