diff options
Diffstat (limited to 'xkb/XKBMAlloc.c')
-rw-r--r-- | xkb/XKBMAlloc.c | 124 |
1 files changed, 62 insertions, 62 deletions
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; |