diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2009-05-05 21:00:31 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2009-05-08 14:28:53 +1000 |
commit | 5cf70183812541b33a6e83c7e1e3bc6198730cbe (patch) | |
tree | f5756527aeb0a97732cd3fc480a07249f6a02996 | |
parent | 0e31d3906deaee5d9ada66e538b9e93574a4d610 (diff) |
xkb: remove _XkbAlloc, _XkbCalloc, _XkbRealloc and _XkbFree
We all agree that wrapping is fun, but seriously. One of these days someone
will get hurt.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r-- | include/xkbsrv.h | 4 | ||||
-rw-r--r-- | xkb/XKBAlloc.c | 28 | ||||
-rw-r--r-- | xkb/XKBGAlloc.c | 40 | ||||
-rw-r--r-- | xkb/XKBMAlloc.c | 68 | ||||
-rw-r--r-- | xkb/XKBMisc.c | 2 | ||||
-rw-r--r-- | xkb/maprules.c | 44 | ||||
-rw-r--r-- | xkb/xkb.c | 40 | ||||
-rw-r--r-- | xkb/xkbEvents.c | 4 | ||||
-rw-r--r-- | xkb/xkbInit.c | 34 | ||||
-rw-r--r-- | xkb/xkbLEDs.c | 6 | ||||
-rw-r--r-- | xkb/xkmread.c | 6 |
11 files changed, 136 insertions, 140 deletions
diff --git a/include/xkbsrv.h b/include/xkbsrv.h index 74d5f290c..c3f64916e 100644 --- a/include/xkbsrv.h +++ b/include/xkbsrv.h @@ -301,15 +301,11 @@ extern _X_EXPORT pointer XkbLastRepeatEvent; extern _X_EXPORT CARD32 xkbDebugFlags; -#define _XkbAlloc(s) xalloc((s)) -#define _XkbCalloc(n,s) Xcalloc((n)*(s)) -#define _XkbRealloc(o,s) Xrealloc((o),(s)) #define _XkbTypedAlloc(t) ((t *)xalloc(sizeof(t))) #define _XkbTypedCalloc(n,t) ((t *)Xcalloc((n)*sizeof(t))) #define _XkbTypedRealloc(o,n,t) \ ((o)?(t *)Xrealloc((o),(n)*sizeof(t)):_XkbTypedCalloc(n,t)) #define _XkbClearElems(a,f,l,t) bzero(&(a)[f],((l)-(f)+1)*sizeof(t)) -#define _XkbFree(p) Xfree(p) #define _XkbLibError(c,l,d) /* Epoch fail */ #define _XkbErrCode2(a,b) ((XID)((((unsigned int)(a))<<24)|((b)&0xffffff))) diff --git a/xkb/XKBAlloc.c b/xkb/XKBAlloc.c index 559a52483..7265d83f2 100644 --- a/xkb/XKBAlloc.c +++ b/xkb/XKBAlloc.c @@ -58,7 +58,7 @@ XkbSymInterpretRec *prev_interpret; compat->sym_interpret= _XkbTypedRealloc(compat->sym_interpret, nSI,XkbSymInterpretRec); if (compat->sym_interpret==NULL) { - _XkbFree(prev_interpret); + xfree(prev_interpret); compat->size_si= compat->num_si= 0; return BadAlloc; } @@ -74,7 +74,7 @@ XkbSymInterpretRec *prev_interpret; if (nSI>0) { compat->sym_interpret= _XkbTypedCalloc(nSI,XkbSymInterpretRec); if (!compat->sym_interpret) { - _XkbFree(compat); + xfree(compat); return BadAlloc; } } @@ -100,12 +100,12 @@ register XkbCompatMapPtr compat; bzero((char *)&compat->groups[0],XkbNumKbdGroups*sizeof(XkbModsRec)); if (which&XkbSymInterpMask) { if ((compat->sym_interpret)&&(compat->size_si>0)) - _XkbFree(compat->sym_interpret); + xfree(compat->sym_interpret); compat->size_si= compat->num_si= 0; compat->sym_interpret= NULL; } if (freeMap) { - _XkbFree(compat); + xfree(compat); xkb->compat= NULL; } return; @@ -161,7 +161,7 @@ XkbNamesPtr names; _XkbClearElems(names->key_aliases,names->num_key_aliases, nTotalAliases-1,XkbKeyAliasRec); } else { - _XkbFree(prev_aliases); + xfree(prev_aliases); } } if (names->key_aliases==NULL) { @@ -183,7 +183,7 @@ XkbNamesPtr names; _XkbClearElems(names->radio_groups,names->num_rg,nTotalRG-1, Atom); } else { - _XkbFree(prev_radio_groups); + xfree(prev_radio_groups); } } if (names->radio_groups==NULL) @@ -211,29 +211,29 @@ XkbNamesPtr names; type= map->types; for (i=0;i<map->num_types;i++,type++) { if (type->level_names!=NULL) { - _XkbFree(type->level_names); + xfree(type->level_names); type->level_names= NULL; } } } } if ((which&XkbKeyNamesMask)&&(names->keys!=NULL)) { - _XkbFree(names->keys); + xfree(names->keys); names->keys= NULL; names->num_keys= 0; } if ((which&XkbKeyAliasesMask)&&(names->key_aliases)){ - _XkbFree(names->key_aliases); + xfree(names->key_aliases); names->key_aliases=NULL; names->num_key_aliases=0; } if ((which&XkbRGNamesMask)&&(names->radio_groups)) { - _XkbFree(names->radio_groups); + xfree(names->radio_groups); names->radio_groups= NULL; names->num_rg= 0; } if (freeMap) { - _XkbFree(names); + xfree(names); xkb->names= NULL; } return; @@ -261,7 +261,7 @@ static void XkbFreeControls(XkbDescPtr xkb,unsigned which,Bool freeMap) { if (freeMap && (xkb!=NULL) && (xkb->ctrls!=NULL)) { - _XkbFree(xkb->ctrls); + xfree(xkb->ctrls); xkb->ctrls= NULL; } return; @@ -286,7 +286,7 @@ static void XkbFreeIndicatorMaps(XkbDescPtr xkb) { if ((xkb!=NULL)&&(xkb->indicators!=NULL)) { - _XkbFree(xkb->indicators); + xfree(xkb->indicators); xkb->indicators= NULL; } return; @@ -330,6 +330,6 @@ XkbFreeKeyboard(XkbDescPtr xkb,unsigned which,Bool freeAll) if (which&XkbControlsMask) XkbFreeControls(xkb,XkbAllControlsMask,True); if (freeAll) - _XkbFree(xkb); + xfree(xkb); return; } diff --git a/xkb/XKBGAlloc.c b/xkb/XKBGAlloc.c index 9561a3df8..752b11a94 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) { - _XkbFree(*elems); + xfree(*elems); *elems= NULL; } return; @@ -115,7 +115,7 @@ register char *ptr; if (freeAll) { (*num_inout)= (*sz_inout)= 0; if (*elems) { - _XkbFree(*elems); + xfree(*elems); *elems= NULL; } } @@ -138,11 +138,11 @@ _XkbClearProperty(char *prop_in) XkbPropertyPtr prop= (XkbPropertyPtr)prop_in; if (prop->name) { - _XkbFree(prop->name); + xfree(prop->name); prop->name= NULL; } if (prop->value) { - _XkbFree(prop->value); + xfree(prop->value); prop->value= NULL; } return; @@ -184,7 +184,7 @@ _XkbClearColor(char *color_in) XkbColorPtr color= (XkbColorPtr)color_in; if (color->spec) - _XkbFree(color->spec); + xfree(color->spec); return; } @@ -381,11 +381,11 @@ XkbDoodadPtr doodad= (XkbDoodadPtr)doodad_in; case XkbTextDoodad: { if (doodad->text.text!=NULL) { - _XkbFree(doodad->text.text); + xfree(doodad->text.text); doodad->text.text= NULL; } if (doodad->text.font!=NULL) { - _XkbFree(doodad->text.font); + xfree(doodad->text.font); doodad->text.font= NULL; } } @@ -393,7 +393,7 @@ XkbDoodadPtr doodad= (XkbDoodadPtr)doodad_in; case XkbLogoDoodad: { if (doodad->logo.logo_name!=NULL) { - _XkbFree(doodad->logo.logo_name); + xfree(doodad->logo.logo_name); doodad->logo.logo_name= NULL; } } @@ -413,7 +413,7 @@ register XkbDoodadPtr doodad; _XkbClearDoodad((char *)doodad); } if (freeAll) - _XkbFree(doodads); + xfree(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) { - _XkbFree(geom->label_font); + xfree(geom->label_font); geom->label_font= NULL; } - _XkbFree(geom); + xfree(geom); } return; } @@ -469,8 +469,8 @@ _XkbGeomAlloc( void ** old, *total= (*num)+num_new; if ((*old)!=NULL) - (*old)= _XkbRealloc((*old),(*total)*sz_elem); - else (*old)= _XkbCalloc((*total),sz_elem); + (*old)= xrealloc((*old),(*total)*sz_elem); + else (*old)= xcalloc((*total),sz_elem); if ((*old)==NULL) { *total= *num= 0; 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) - _XkbFree(prop->value); - prop->value= (char *)_XkbAlloc(strlen(value)+1); + xfree(prop->value); + prop->value= xalloc(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= (char *)_XkbAlloc(strlen(name)+1); + prop->name= xalloc(strlen(name)+1); if (!name) return NULL; strcpy(prop->name,name); - prop->value= (char *)_XkbAlloc(strlen(value)+1); + prop->value= xalloc(strlen(value)+1); if (!value) { - _XkbFree(prop->name); + xfree(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= (char *)_XkbAlloc(strlen(spec)+1); + color->spec= xalloc(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) { - _XkbFree(section->rows); + xfree(section->rows); section->rows= NULL; section->sz_rows= section->num_rows= 0; } diff --git a/xkb/XKBMAlloc.c b/xkb/XKBMAlloc.c index de8ee29fa..728c0297b 100644 --- a/xkb/XKBMAlloc.c +++ b/xkb/XKBMAlloc.c @@ -79,7 +79,7 @@ XkbClientMapPtr map; map->types= _XkbTypedRealloc(map->types,nTotalTypes,XkbKeyTypeRec); if (map->types==NULL) { - _XkbFree(prev_types); + xfree(prev_types); map->num_types= map->size_types= 0; return BadAlloc; } @@ -172,7 +172,7 @@ XkbServerMapPtr map; need= map->num_acts+nNewActions; map->acts= _XkbTypedRealloc(map->acts,need,XkbAction); if (map->acts==NULL) { - _XkbFree(prev_acts); + xfree(prev_acts); map->num_acts= map->size_acts= 0; return BadAlloc; } @@ -222,15 +222,15 @@ XkbCopyKeyType(XkbKeyTypePtr from,XkbKeyTypePtr into) if ((!from)||(!into)) return BadMatch; if (into->map) { - _XkbFree(into->map); + xfree(into->map); into->map= NULL; } if (into->preserve) { - _XkbFree(into->preserve); + xfree(into->preserve); into->preserve= NULL; } if (into->level_names) { - _XkbFree(into->level_names); + xfree(into->level_names); into->level_names= NULL; } *into= *from; @@ -299,10 +299,10 @@ KeyCode matchingKeys[XkbMaxKeyCount],nMatchingKeys; type= &xkb->map->types[type_ndx]; if (map_count==0) { if (type->map!=NULL) - _XkbFree(type->map); + xfree(type->map); type->map= NULL; if (type->preserve!=NULL) - _XkbFree(type->preserve); + xfree(type->preserve); type->preserve= NULL; type->map_count= 0; } @@ -313,7 +313,7 @@ KeyCode matchingKeys[XkbMaxKeyCount],nMatchingKeys; type->map=_XkbTypedRealloc(type->map,map_count,XkbKTMapEntryRec); if (!type->map) { if (prev_map) - _XkbFree(prev_map); + xfree(prev_map); return BadAlloc; } if (want_preserve) { @@ -325,12 +325,12 @@ KeyCode matchingKeys[XkbMaxKeyCount],nMatchingKeys; } if (!type->preserve) { if (prev_preserve) - _XkbFree(prev_preserve); + xfree(prev_preserve); return BadAlloc; } } else if (type->preserve!=NULL) { - _XkbFree(type->preserve); + xfree(type->preserve); type->preserve= NULL; } type->map_count= map_count; @@ -342,7 +342,7 @@ KeyCode matchingKeys[XkbMaxKeyCount],nMatchingKeys; type->level_names=_XkbTypedRealloc(type->level_names,new_num_lvls,Atom); if (!type->level_names) { if (prev_level_names) - _XkbFree(prev_level_names); + xfree(prev_level_names); return BadAlloc; } } @@ -422,7 +422,7 @@ KeyCode matchingKeys[XkbMaxKeyCount],nMatchingKeys; } } type->num_levels= new_num_lvls; - _XkbFree(xkb->map->syms); + xfree(xkb->map->syms); xkb->map->syms= newSyms; xkb->map->num_syms= nSyms; return Success; @@ -518,7 +518,7 @@ KeySym *newSyms; xkb->map->key_sym_map[i].offset = nSyms; nSyms+= nKeySyms; } - _XkbFree(xkb->map->syms); + xfree(xkb->map->syms); xkb->map->syms = newSyms; xkb->map->num_syms = nSyms; return &xkb->map->syms[xkb->map->key_sym_map[key].offset]; @@ -640,7 +640,7 @@ int tmp; xkb->map->key_sym_map= _XkbTypedRealloc(xkb->map->key_sym_map, (maxKC+1),XkbSymMapRec); if (!xkb->map->key_sym_map) { - _XkbFree(prev_key_sym_map); + xfree(prev_key_sym_map); return BadAlloc; } bzero((char *)&xkb->map->key_sym_map[xkb->max_key_code], @@ -658,7 +658,7 @@ int tmp; xkb->map->modmap= _XkbTypedRealloc(xkb->map->modmap, (maxKC+1),unsigned char); if (!xkb->map->modmap) { - _XkbFree(prev_modmap); + xfree(prev_modmap); return BadAlloc; } bzero((char *)&xkb->map->modmap[xkb->max_key_code],tmp); @@ -677,7 +677,7 @@ int tmp; xkb->server->behaviors=_XkbTypedRealloc(xkb->server->behaviors, (maxKC+1),XkbBehavior); if (!xkb->server->behaviors) { - _XkbFree(prev_behaviors); + xfree(prev_behaviors); return BadAlloc; } bzero((char *)&xkb->server->behaviors[xkb->max_key_code], @@ -695,7 +695,7 @@ int tmp; xkb->server->key_acts= _XkbTypedRealloc(xkb->server->key_acts, (maxKC+1),unsigned short); if (!xkb->server->key_acts) { - _XkbFree(prev_key_acts); + xfree(prev_key_acts); return BadAlloc; } bzero((char *)&xkb->server->key_acts[xkb->max_key_code], @@ -713,7 +713,7 @@ int tmp; xkb->server->vmodmap= _XkbTypedRealloc(xkb->server->vmodmap, (maxKC+1),unsigned short); if (!xkb->server->vmodmap) { - _XkbFree(prev_vmodmap); + xfree(prev_vmodmap); return BadAlloc; } bzero((char *)&xkb->server->vmodmap[xkb->max_key_code], @@ -732,7 +732,7 @@ int tmp; xkb->names->keys= _XkbTypedRealloc(xkb->names->keys, (maxKC+1),XkbKeyNameRec); if (!xkb->names->keys) { - _XkbFree(prev_keys); + xfree(prev_keys); return BadAlloc; } bzero((char *)&xkb->names->keys[xkb->max_key_code], @@ -793,7 +793,7 @@ XkbAction *newActs; xkb->server->key_acts[i]= nActs; nActs+= nKeyActs; } - _XkbFree(xkb->server->acts); + xfree(xkb->server->acts); xkb->server->acts = newActs; xkb->server->num_acts= nActs; return &xkb->server->acts[xkb->server->key_acts[key]]; @@ -816,42 +816,42 @@ XkbClientMapPtr map; XkbKeyTypePtr type; for (i=0,type=map->types;i<map->num_types;i++,type++) { if (type->map!=NULL) { - _XkbFree(type->map); + xfree(type->map); type->map= NULL; } if (type->preserve!=NULL) { - _XkbFree(type->preserve); + xfree(type->preserve); type->preserve= NULL; } type->map_count= 0; if (type->level_names!=NULL) { - _XkbFree(type->level_names); + xfree(type->level_names); type->level_names= NULL; } } } - _XkbFree(map->types); + xfree(map->types); map->num_types= map->size_types= 0; map->types= NULL; } } if (what&XkbKeySymsMask) { if (map->key_sym_map!=NULL) { - _XkbFree(map->key_sym_map); + xfree(map->key_sym_map); map->key_sym_map= NULL; } if (map->syms!=NULL) { - _XkbFree(map->syms); + xfree(map->syms); map->size_syms= map->num_syms= 0; map->syms= NULL; } } if ((what&XkbModifierMapMask)&&(map->modmap!=NULL)) { - _XkbFree(map->modmap); + xfree(map->modmap); map->modmap= NULL; } if (freeMap) { - _XkbFree(xkb->map); + xfree(xkb->map); xkb->map= NULL; } return; @@ -868,31 +868,31 @@ XkbServerMapPtr map; what= XkbAllServerInfoMask; map= xkb->server; if ((what&XkbExplicitComponentsMask)&&(map->explicit!=NULL)) { - _XkbFree(map->explicit); + xfree(map->explicit); map->explicit= NULL; } if (what&XkbKeyActionsMask) { if (map->key_acts!=NULL) { - _XkbFree(map->key_acts); + xfree(map->key_acts); map->key_acts= NULL; } if (map->acts!=NULL) { - _XkbFree(map->acts); + xfree(map->acts); map->num_acts= map->size_acts= 0; map->acts= NULL; } } if ((what&XkbKeyBehaviorsMask)&&(map->behaviors!=NULL)) { - _XkbFree(map->behaviors); + xfree(map->behaviors); map->behaviors= NULL; } if ((what&XkbVirtualModMapMask)&&(map->vmodmap!=NULL)) { - _XkbFree(map->vmodmap); + xfree(map->vmodmap); map->vmodmap= NULL; } if (freeMap) { - _XkbFree(xkb->server); + xfree(xkb->server); xkb->server= NULL; } return; diff --git a/xkb/XKBMisc.c b/xkb/XKBMisc.c index 82d37d19f..9cb7061f3 100644 --- a/xkb/XKBMisc.c +++ b/xkb/XKBMisc.c @@ -507,7 +507,7 @@ unsigned changed,tmp; mc->changed|= changed; } if (interps!=ibuf) - _XkbFree(interps); + xfree(interps); return True; } diff --git a/xkb/maprules.c b/xkb/maprules.c index a0141a3d1..168c5277f 100644 --- a/xkb/maprules.c +++ b/xkb/maprules.c @@ -78,7 +78,7 @@ static void FreeInputLine(InputLine *line) { if (line->line!=line->buf) - _XkbFree(line->line); + xfree(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= (char *)_XkbAlloc(line->sz_line*2); + line->line= xalloc(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= xrealloc((char *)line->line,line->sz_line*2); } line->sz_line*= 2; } @@ -553,9 +553,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) xfree(defs->options); + if (defs->layout[1]) xfree(defs->layout[1]); + if (defs->variant[1]) xfree(defs->variant[1]); } static void @@ -769,7 +769,7 @@ int len, ndx; } str= index(&str[0],'%'); } - name= (char *)_XkbAlloc(len+1); + name= xalloc(len+1); str= orig; outstr= name; while (*str!='\0') { @@ -819,7 +819,7 @@ int len, ndx; } *outstr++= '\0'; if (orig!=name) - _XkbFree(orig); + xfree(orig); return name; } @@ -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) _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->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); bzero((char *)rule,sizeof(XkbRF_RuleRec)); } - _XkbFree(rules->rules); + xfree(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) xfree(group->name); + if (group->words) xfree(group->words); } - _XkbFree(rules->groups); + xfree(rules->groups); rules->num_groups= 0; rules->groups= NULL; } if (freeRules) - _XkbFree(rules); + xfree(rules); return; } @@ -1363,7 +1363,7 @@ unsigned i,len; char *desc,*start; len= (rep->length*4)-(SIZEOF(xkbGetMapReply)-SIZEOF(xGenericReply)); - start= desc= (char *)xcalloc(1, len); + start= desc= xcalloc(1, len); if (!start) return BadAlloc; if ( rep->nTypes>0 ) @@ -2184,8 +2184,8 @@ unsigned first,last; if (maxRG>(int)xkbi->nRadioGroups) { int sz = maxRG*sizeof(XkbRadioGroupRec); if (xkbi->radioGroups) - xkbi->radioGroups=(XkbRadioGroupPtr)_XkbRealloc(xkbi->radioGroups,sz); - else xkbi->radioGroups= (XkbRadioGroupPtr)_XkbCalloc(1, sz); + xkbi->radioGroups= xrealloc(xkbi->radioGroups,sz); + else xkbi->radioGroups= xcalloc(1, sz); if (xkbi->radioGroups) { if (xkbi->nRadioGroups) bzero(&xkbi->radioGroups[xkbi->nRadioGroups], @@ -2627,7 +2627,7 @@ int size; size= rep->length*4; if (size>0) { - data = (char *)xalloc(size); + data = xalloc(size); if (data) { register unsigned i,bit; xkbModsWireDesc * grp; @@ -2994,7 +2994,7 @@ register unsigned bit; length = rep->length*4; if (length>0) { CARD8 *to; - to= map= (CARD8 *)xalloc(length); + to= map= xalloc(length); if (map) { xkbIndicatorMapWireDesc *wire = (xkbIndicatorMapWireDesc *)to; for (i=0,bit=1;i<XkbNumIndicators;i++,bit<<=1) { @@ -3630,7 +3630,7 @@ register int n; swapl(&rep->indicators,n); } - start = desc = (char *)xalloc(length); + start = desc = xalloc(length); if ( !start ) return BadAlloc; if (xkb->names) { @@ -4116,7 +4116,7 @@ _XkbSetNames(ClientPtr client, DeviceIntPtr dev, xkbSetNamesReq *stuff) tmp+= stuff->nKeyAliases*2; } else if (names->key_aliases!=NULL) { - _XkbFree(names->key_aliases); + xfree(names->key_aliases); names->key_aliases= NULL; names->num_key_aliases= 0; } @@ -4135,7 +4135,7 @@ _XkbSetNames(ClientPtr client, DeviceIntPtr dev, xkbSetNamesReq *stuff) tmp+= stuff->nRadioGroups; } else if (names->radio_groups) { - _XkbFree(names->radio_groups); + xfree(names->radio_groups); names->radio_groups= NULL; names->num_rg= 0; } @@ -4735,7 +4735,7 @@ XkbSendGeometry( ClientPtr client, if (geom!=NULL) { len= rep->length*4; - start= desc= (char *)xalloc(len); + start= desc= xalloc(len); if (!start) return BadAlloc; desc= XkbWriteCountedString(desc,geom->label_font,client->swapped); @@ -4829,7 +4829,7 @@ CARD16 len,*plen; swaps(plen,n); } len= *plen; - str= (char *)_XkbAlloc(len+1); + str= xalloc(len+1); if (str) { memcpy(str,&wire[2],len); str[len]= '\0'; @@ -5444,7 +5444,7 @@ unsigned char *wire,*str,*tmp,*legal; wire= *pWire; len= (*(unsigned char *)wire++); if (len>0) { - str= (unsigned char *)_XkbCalloc(1, len+1); + str= xcalloc(1, len+1); if (str) { tmp= str; for (i=0;i<len;i++) { @@ -5455,7 +5455,7 @@ unsigned char *wire,*str,*tmp,*legal; if (tmp!=str) *tmp++= '\0'; else { - _XkbFree(str); + xfree(str); str= NULL; } } @@ -5506,7 +5506,7 @@ ProcXkbListComponents(ClientPtr client) return BadLength; if ((status=XkbDDXList(dev,&list,client))!=Success) { if (list.pool) { - _XkbFree(list.pool); + xfree(list.pool); list.pool= NULL; } return status; @@ -5540,7 +5540,7 @@ ProcXkbListComponents(ClientPtr client) WriteToClient(client,SIZEOF(xkbListComponentsReply),(char *)&rep); if (list.nPool && list.pool) { WriteToClient(client,XkbPaddedSize(list.nPool), (char *)list.pool); - _XkbFree(list.pool); + xfree(list.pool); list.pool= NULL; } return client->noClientException; @@ -5869,11 +5869,11 @@ ProcXkbGetKbdByName(ClientPtr client) XkbFreeKeyboard(new,XkbAllComponentsMask,True); new= NULL; } - if (names.keycodes) { _XkbFree(names.keycodes); names.keycodes= NULL; } - if (names.types) { _XkbFree(names.types); names.types= NULL; } - if (names.compat) { _XkbFree(names.compat); names.compat= NULL; } - if (names.symbols) { _XkbFree(names.symbols); names.symbols= NULL; } - if (names.geometry) { _XkbFree(names.geometry); names.geometry= 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; } return client->noClientException; } @@ -6188,7 +6188,7 @@ char * str; } WriteToClient(client,SIZEOF(xkbGetDeviceInfoReply), (char *)&rep); - str= (char*) xalloc(nameLen); + str= xalloc(nameLen); if (!str) return BadAlloc; XkbWriteCountedString(str,dev->name,client->swapped); diff --git a/xkb/xkbEvents.c b/xkb/xkbEvents.c index 9293c60be..489f309a4 100644 --- a/xkb/xkbEvents.c +++ b/xkb/xkbEvents.c @@ -1136,7 +1136,7 @@ ClientPtr client = NULL; autoCtrls= interest->autoCtrls; autoValues= interest->autoCtrlValues; client= interest->client; - _XkbFree(interest); + xfree(interest); found= True; } while ((!found)&&(interest->next)) { @@ -1146,7 +1146,7 @@ ClientPtr client = NULL; autoCtrls= victim->autoCtrls; autoValues= victim->autoCtrlValues; client= victim->client; - _XkbFree(victim); + xfree(victim); found= True; } interest = interest->next; diff --git a/xkb/xkbInit.c b/xkb/xkbInit.c index 7c611bcc7..bea8ce0cc 100644 --- a/xkb/xkbInit.c +++ b/xkb/xkbInit.c @@ -222,19 +222,19 @@ static void XkbSetRulesUsed(XkbRMLVOSet *rmlvo) { if (XkbRulesUsed) - _XkbFree(XkbRulesUsed); + xfree(XkbRulesUsed); XkbRulesUsed= (rmlvo->rules?_XkbDupString(rmlvo->rules):NULL); if (XkbModelUsed) - _XkbFree(XkbModelUsed); + xfree(XkbModelUsed); XkbModelUsed= (rmlvo->model?_XkbDupString(rmlvo->model):NULL); if (XkbLayoutUsed) - _XkbFree(XkbLayoutUsed); + xfree(XkbLayoutUsed); XkbLayoutUsed= (rmlvo->layout?_XkbDupString(rmlvo->layout):NULL); if (XkbVariantUsed) - _XkbFree(XkbVariantUsed); + xfree(XkbVariantUsed); XkbVariantUsed= (rmlvo->variant?_XkbDupString(rmlvo->variant):NULL); if (XkbOptionsUsed) - _XkbFree(XkbOptionsUsed); + xfree(XkbOptionsUsed); XkbOptionsUsed= (rmlvo->options?_XkbDupString(rmlvo->options):NULL); if (XkbWantRulesProp) QueueWorkProc(XkbWriteRulesProp,NULL,NULL); @@ -246,27 +246,27 @@ XkbSetRulesDflts(XkbRMLVOSet *rmlvo) { if (rmlvo->rules) { if (XkbRulesDflt) - _XkbFree(XkbRulesDflt); + xfree(XkbRulesDflt); XkbRulesDflt= _XkbDupString(rmlvo->rules); } if (rmlvo->model) { if (XkbModelDflt) - _XkbFree(XkbModelDflt); + xfree(XkbModelDflt); XkbModelDflt= _XkbDupString(rmlvo->model); } if (rmlvo->layout) { if (XkbLayoutDflt) - _XkbFree(XkbLayoutDflt); + xfree(XkbLayoutDflt); XkbLayoutDflt= _XkbDupString(rmlvo->layout); } if (rmlvo->variant) { if (XkbVariantDflt) - _XkbFree(XkbVariantDflt); + xfree(XkbVariantDflt); XkbVariantDflt= _XkbDupString(rmlvo->variant); } if (rmlvo->options) { if (XkbOptionsDflt) - _XkbFree(XkbOptionsDflt); + xfree(XkbOptionsDflt); XkbOptionsDflt= _XkbDupString(rmlvo->options); } return; @@ -275,15 +275,15 @@ XkbSetRulesDflts(XkbRMLVOSet *rmlvo) void XkbDeleteRulesDflts(void) { - _XkbFree(XkbRulesDflt); + xfree(XkbRulesDflt); XkbRulesDflt = NULL; - _XkbFree(XkbModelDflt); + xfree(XkbModelDflt); XkbModelDflt = NULL; - _XkbFree(XkbLayoutDflt); + xfree(XkbLayoutDflt); XkbLayoutDflt = NULL; - _XkbFree(XkbVariantDflt); + xfree(XkbVariantDflt); XkbVariantDflt = NULL; - _XkbFree(XkbOptionsDflt); + xfree(XkbOptionsDflt); XkbOptionsDflt = NULL; XkbFreeKeyboard(xkb_cached_map, XkbAllComponentsMask, True); @@ -643,7 +643,7 @@ void XkbFreeInfo(XkbSrvInfoPtr xkbi) { if (xkbi->radioGroups) { - _XkbFree(xkbi->radioGroups); + xfree(xkbi->radioGroups); xkbi->radioGroups= NULL; } if (xkbi->mouseKeyTimer) { @@ -675,7 +675,7 @@ XkbFreeInfo(XkbSrvInfoPtr xkbi) XkbFreeKeyboard(xkbi->desc,XkbAllComponentsMask,True); xkbi->desc= NULL; } - _XkbFree(xkbi); + xfree(xkbi); return; } diff --git a/xkb/xkbLEDs.c b/xkb/xkbLEDs.c index a70ac841d..59cdba416 100644 --- a/xkb/xkbLEDs.c +++ b/xkb/xkbLEDs.c @@ -605,12 +605,12 @@ void XkbFreeSrvLedInfo(XkbSrvLedInfoPtr sli) { if ((sli->flags&XkbSLI_IsDefault)==0) { - if (sli->maps) _XkbFree(sli->maps); - if (sli->names) _XkbFree(sli->names); + if (sli->maps) xfree(sli->maps); + if (sli->names) xfree(sli->names); } sli->maps= NULL; sli->names= NULL; - _XkbFree(sli); + xfree(sli); return; } diff --git a/xkb/xkmread.c b/xkb/xkmread.c index dc8ab612d..206c40382 100644 --- a/xkb/xkmread.c +++ b/xkb/xkmread.c @@ -57,7 +57,7 @@ char *new; if (str==NULL) return NULL; - new= (char *)_XkbCalloc(strlen(str)+1,sizeof(char)); + new= xcalloc(strlen(str)+1,sizeof(char)); if (new) strcpy(new,str); return new; @@ -73,10 +73,10 @@ int newCount= *newCountRtrn; if (oldPtr==NULL) { if (newCount==0) return NULL; - oldPtr= _XkbCalloc(newCount,elemSize); + oldPtr= xcalloc(newCount,elemSize); } else if (oldCount<newCount) { - oldPtr= _XkbRealloc(oldPtr,newCount*elemSize); + oldPtr= xrealloc(oldPtr,newCount*elemSize); if (oldPtr!=NULL) { char *tmp= (char *)oldPtr; bzero(&tmp[oldCount*elemSize],(newCount-oldCount)*elemSize); |