From 4bc839ab89904ae88f7feebe6a4e823d91fe62d6 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Wed, 29 Feb 2012 20:50:17 +0200 Subject: [PATCH] Use memset instead of bzero Signed-off-by: Ran Benita --- src/XKBcommonint.h | 2 +- src/alloc.c | 5 +++-- src/galloc.c | 14 +++++++------- src/geom.c | 4 ++-- src/malloc.c | 19 ++++++++++--------- src/maprules.c | 22 +++++++++++----------- src/xkb.c | 2 +- src/xkbcomp/action.c | 4 ++-- src/xkbcomp/alias.c | 6 +++--- src/xkbcomp/compat.c | 12 ++++++------ src/xkbcomp/geometry.c | 32 ++++++++++++++++---------------- src/xkbcomp/keycodes.c | 2 +- src/xkbcomp/keymap.c | 2 +- src/xkbcomp/keytypes.c | 4 ++-- src/xkbcomp/parseutils.c | 20 ++++++++++---------- src/xkbcomp/symbols.c | 6 +++--- src/xkbcomp/utils.c | 2 +- 17 files changed, 80 insertions(+), 78 deletions(-) diff --git a/src/XKBcommonint.h b/src/XKBcommonint.h index def7224..41e0a08 100644 --- a/src/XKBcommonint.h +++ b/src/XKBcommonint.h @@ -39,7 +39,7 @@ authorization from the authors. #define _XkbTypedCalloc(n,t) ((t *)calloc((n),sizeof(t))) #define _XkbTypedRealloc(o,n,t) \ ((o)?(t *)realloc((o),(n)*sizeof(t)):_XkbTypedCalloc(n,t)) -#define _XkbClearElems(a,f,l,t) bzero(&(a)[f],((l)-(f)+1)*sizeof(t)) +#define _XkbClearElems(a,f,l,t) memset(&(a)[f], 0, ((l) - (f) + 1) * sizeof(t)) #define _XkbDupString(s) ((s) ? strdup(s) : NULL) #define _XkbStrCaseCmp strcasecmp diff --git a/src/alloc.c b/src/alloc.c index 77aa638..c677967 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -79,7 +79,7 @@ XkbcAllocCompatMap(struct xkb_desc * xkb, unsigned which, unsigned nSI) } compat->size_si = nSI; compat->num_si = 0; - bzero(&compat->groups[0], XkbNumKbdGroups * sizeof(struct xkb_mods)); + memset(&compat->groups[0], 0, XkbNumKbdGroups * sizeof(struct xkb_mods)); xkb->compat = compat; return Success; @@ -99,7 +99,8 @@ XkbcFreeCompatMap(struct xkb_desc * xkb, unsigned which, Bool freeMap) which = XkbAllCompatMask; if (which & XkbGroupCompatMask) - bzero(&compat->groups[0], XkbNumKbdGroups * sizeof(struct xkb_mods)); + memset(&compat->groups[0], 0, + XkbNumKbdGroups * sizeof(struct xkb_mods)); if (which & XkbSymInterpMask) { free(compat->sym_interpret); diff --git a/src/galloc.c b/src/galloc.c index ad24139..92242da 100644 --- a/src/galloc.c +++ b/src/galloc.c @@ -342,7 +342,7 @@ _XkbGeomAlloc(char **old, unsigned short *num, unsigned short *total, if (*num > 0) { char *tmp = *old; - bzero(&tmp[sz_elem * (*num)], num_new * sz_elem); + memset(&tmp[sz_elem * (*num)], 0, num_new * sz_elem); } return Success; @@ -524,7 +524,7 @@ struct xkb_outline * outline; return NULL; } outline= &shape->outlines[shape->num_outlines]; - bzero(outline,sizeof(struct xkb_outline)); + memset(outline, 0, sizeof(struct xkb_outline)); if ((sz_points>0)&&(_XkbAllocPoints(outline,sz_points)!=Success)) return NULL; shape->num_outlines++; @@ -549,7 +549,7 @@ XkbcAddGeomShape(struct xkb_geometry * geom,uint32_t name,int sz_outlines) (_XkbAllocShapes(geom,1)!=Success)) return NULL; shape= &geom->shapes[geom->num_shapes]; - bzero(shape,sizeof(struct xkb_shape)); + memset(shape, 0, sizeof(struct xkb_shape)); if ((sz_outlines>0)&&(_XkbAllocOutlines(shape,sz_outlines)!=Success)) return NULL; shape->name= name; @@ -567,7 +567,7 @@ struct xkb_key * key; if ((row->num_keys>=row->sz_keys)&&(_XkbAllocKeys(row,1)!=Success)) return NULL; key= &row->keys[row->num_keys++]; - bzero(key,sizeof(struct xkb_key)); + memset(key, 0, sizeof(struct xkb_key)); return key; } @@ -582,7 +582,7 @@ struct xkb_row * row; (_XkbAllocRows(section,1)!=Success)) return NULL; row= §ion->rows[section->num_rows]; - bzero(row,sizeof(struct xkb_row)); + memset(row, 0, sizeof(struct xkb_row)); if ((sz_keys>0)&&(_XkbAllocKeys(row,sz_keys)!=Success)) return NULL; section->num_rows++; @@ -660,7 +660,7 @@ XkbcAddGeomDoodad(struct xkb_geometry * geom,struct xkb_section * section,uint32 return NULL; doodad= &geom->doodads[geom->num_doodads++]; } - bzero(doodad,sizeof(union xkb_doodad)); + memset(doodad, 0, sizeof(union xkb_doodad)); doodad->any.name= name; return doodad; } @@ -689,7 +689,7 @@ XkbcAddGeomOverlayRow(struct xkb_overlay * overlay,int row_under,int sz_keys) (_XkbAllocOverlayRows(overlay,1)!=Success)) return NULL; row= &overlay->rows[overlay->num_rows]; - bzero(row,sizeof(struct xkb_overlay_row)); + memset(row, 0, sizeof(struct xkb_overlay_row)); if ((sz_keys>0)&&(_XkbAllocOverlayKeys(row,sz_keys)!=Success)) return NULL; row->row_under= row_under; diff --git a/src/geom.c b/src/geom.c index 33e639d..e839be9 100644 --- a/src/geom.c +++ b/src/geom.c @@ -87,7 +87,7 @@ XkbcComputeRowBounds(struct xkb_geometry * geom, struct xkb_section * section, s return False; bounds = &row->bounds; - bzero(bounds, sizeof(struct xkb_bounds)); + memset(bounds, 0, sizeof(struct xkb_bounds)); for (key = row->keys, pos = k = 0; k < row->num_keys; k++, key++) { sbounds = &XkbKeyShape(geom, key)->bounds; @@ -129,7 +129,7 @@ XkbcComputeSectionBounds(struct xkb_geometry * geom, struct xkb_section * sectio return False; bounds = §ion->bounds; - bzero(bounds, sizeof(struct xkb_bounds)); + memset(bounds, 0, sizeof(struct xkb_bounds)); for (i = 0, row = section->rows; i < section->num_rows; i++, row++) { if (!XkbcComputeRowBounds(geom, section, row)) diff --git a/src/malloc.c b/src/malloc.c index 965821c..42e672f 100644 --- a/src/malloc.c +++ b/src/malloc.c @@ -75,8 +75,8 @@ XkbcAllocClientMap(struct xkb_desc * xkb, unsigned which, unsigned nTotalTypes) } map->size_types = nTotalTypes; - bzero(&map->types[map->num_types], - (map->size_types - map->num_types) * sizeof(struct xkb_key_type)); + memset(&map->types[map->num_types], 0, + (map->size_types - map->num_types) * sizeof(struct xkb_key_type)); } } @@ -178,8 +178,8 @@ XkbcAllocServerMap(struct xkb_desc * xkb, unsigned which, unsigned nNewActions) } map->size_acts = need; - bzero(&map->acts[map->num_acts], - (map->size_acts - map->num_acts) * sizeof(union xkb_action)); + memset(&map->acts[map->num_acts], 0, + (map->size_acts - map->num_acts) * sizeof(union xkb_action)); } if (!map->key_acts) { @@ -276,8 +276,8 @@ XkbcResizeKeySyms(struct xkb_desc * xkb, xkb_keycode_t key, XkbKeySymsPtr(xkb, key), nOldSyms * sizeof(uint32_t)); if ((needed - nOldSyms) > 0) - bzero(&xkb->map->syms[xkb->map->num_syms + XkbKeyNumSyms(xkb, key)], - (needed - nOldSyms) * sizeof(uint32_t)); + memset(&xkb->map->syms[xkb->map->num_syms + XkbKeyNumSyms(xkb, key)], + 0, (needed - nOldSyms) * sizeof(uint32_t)); xkb->map->key_sym_map[key].offset = xkb->map->num_syms; xkb->map->num_syms += needed; @@ -305,7 +305,8 @@ XkbcResizeKeySyms(struct xkb_desc * xkb, xkb_keycode_t key, memcpy(&newSyms[nSyms], XkbKeySymsPtr(xkb, i), nCopy * sizeof(uint32_t)); if (nKeySyms > nCopy) - bzero(&newSyms[nSyms+nCopy], (nKeySyms - nCopy) * sizeof(uint32_t)); + memset(&newSyms[nSyms + nCopy], 0, + (nKeySyms - nCopy) * sizeof(uint32_t)); xkb->map->key_sym_map[i].offset = nSyms; nSyms += nKeySyms; @@ -364,8 +365,8 @@ XkbcResizeKeyActions(struct xkb_desc * xkb, xkb_keycode_t key, int needed) memcpy(&newActs[nActs], XkbKeyActionsPtr(xkb, i), nCopy * sizeof(union xkb_action)); if (nCopy < nKeyActs) - bzero(&newActs[nActs + nCopy], - (nKeyActs - nCopy) * sizeof(union xkb_action)); + memset(&newActs[nActs + nCopy], 0, + (nKeyActs - nCopy) * sizeof(union xkb_action)); xkb->server->key_acts[i] = nActs; nActs += nKeyActs; diff --git a/src/maprules.c b/src/maprules.c index a1c92f6..b868b8b 100644 --- a/src/maprules.c +++ b/src/maprules.c @@ -278,7 +278,7 @@ SetUpRemap(InputLine *line,RemapSpec *remap) l_ndx_present = v_ndx_present = present= 0; str= &line->line[1]; len = remap->number; - bzero((char *)remap,sizeof(RemapSpec)); + memset(remap, 0, sizeof(RemapSpec)); remap->number = len; while ((tok=_XStrtok(str," ",strtok_buf))!=NULL) { #ifdef DEBUG @@ -434,7 +434,7 @@ CheckLine( InputLine * line, PR_DEBUG("Illegal line of data ignored\n"); return False; } - bzero((char *)&tmp,sizeof(FileSpec)); + memset(&tmp, 0, sizeof(FileSpec)); str= line->line; for (nread= 0;(tok=_XStrtok(str," ",strtok_buf))!=NULL;nread++) { str= NULL; @@ -517,7 +517,7 @@ squeeze_spaces(char *p1) static Bool MakeMultiDefs(XkbRF_MultiDefsPtr mdefs, XkbRF_VarDefsPtr defs) { - bzero((char *)mdefs,sizeof(XkbRF_MultiDefsRec)); + memset(mdefs, 0, sizeof(XkbRF_MultiDefsRec)); mdefs->model = defs->model; mdefs->options = _XkbDupString(defs->options); if (mdefs->options) squeeze_spaces(mdefs->options); @@ -858,7 +858,7 @@ XkbcRF_GetComponents( XkbRF_RulesPtr rules, MakeMultiDefs(&mdefs, defs); - bzero((char *)names,sizeof(struct xkb_component_names)); + memset(names, 0, sizeof(struct xkb_component_names)); XkbRF_ClearPartialMatches(rules); XkbRF_CheckApplyRules(rules, &mdefs, names, XkbRF_Normal); XkbRF_ApplyPartialMatches(rules, names); @@ -905,7 +905,7 @@ XkbcRF_AddRule(XkbRF_RulesPtr rules) #endif return NULL; } - bzero((char *)&rules->rules[rules->num_rules],sizeof(XkbRF_RuleRec)); + memset(&rules->rules[rules->num_rules], 0, sizeof(XkbRF_RuleRec)); return &rules->rules[rules->num_rules++]; } @@ -927,7 +927,7 @@ XkbcRF_AddGroup(XkbRF_RulesPtr rules) return NULL; } - bzero((char *)&rules->groups[rules->num_groups],sizeof(XkbRF_GroupRec)); + memset(&rules->groups[rules->num_groups], 0, sizeof(XkbRF_GroupRec)); return &rules->groups[rules->num_groups++]; } @@ -941,20 +941,20 @@ XkbRF_GroupRec tgroup,*group; if (!(rules && file)) return False; - bzero((char *)&remap,sizeof(RemapSpec)); - bzero((char *)&tgroup,sizeof(XkbRF_GroupRec)); + memset(&remap, 0, sizeof(RemapSpec)); + memset(&tgroup, 0, sizeof(XkbRF_GroupRec)); InitInputLine(&line); while (GetInputLine(file,&line,True)) { if (CheckLine(&line,&remap,&trule,&tgroup)) { if (tgroup.number) { if ((group= XkbcRF_AddGroup(rules))!=NULL) { *group= tgroup; - bzero((char *)&tgroup,sizeof(XkbRF_GroupRec)); + memset(&tgroup, 0, sizeof(XkbRF_GroupRec)); } } else { if ((rule= XkbcRF_AddRule(rules))!=NULL) { *rule= trule; - bzero((char *)&trule,sizeof(XkbRF_RuleRec)); + memset(&trule, 0, sizeof(XkbRF_RuleRec)); } } } @@ -1010,7 +1010,7 @@ XkbcRF_Free(XkbRF_RulesPtr rules,Bool freeRules) free(rule->compat); free(rule->geometry); free(rule->keymap); - bzero((char *)rule,sizeof(XkbRF_RuleRec)); + memset(rule, 0, sizeof(XkbRF_RuleRec)); } free(rules->rules); rules->num_rules= rules->sz_rules= 0; diff --git a/src/xkb.c b/src/xkb.c index 0870b3b..a560230 100644 --- a/src/xkb.c +++ b/src/xkb.c @@ -132,7 +132,7 @@ XkbcComputeEffectiveMap(struct xkb_desc * xkb, struct xkb_key_type * type, type->mods.mask = type->mods.real_mods; if (map_rtrn) { - bzero(map_rtrn, type->mods.mask + 1); + memset(map_rtrn, 0, type->mods.mask + 1); if (entry && entry->active) for (i = 0; i < type->map_count; i++) map_rtrn[type->map[i].mods.mask] = type->map[i].level; diff --git a/src/xkbcomp/action.c b/src/xkbcomp/action.c index c5c4c9b..c2cbd01 100644 --- a/src/xkbcomp/action.c +++ b/src/xkbcomp/action.c @@ -1421,8 +1421,8 @@ ActionsInit(void) { if (!actionsInitialized) { - bzero((char *) &constTrue, sizeof(constTrue)); - bzero((char *) &constFalse, sizeof(constFalse)); + memset(&constTrue, 0, sizeof(constTrue)); + memset(&constFalse, 0, sizeof(constFalse)); constTrue.common.stmtType = StmtExpr; constTrue.common.next = NULL; constTrue.op = ExprIdent; diff --git a/src/xkbcomp/alias.c b/src/xkbcomp/alias.c index a75948e..a1cf160 100644 --- a/src/xkbcomp/alias.c +++ b/src/xkbcomp/alias.c @@ -77,7 +77,7 @@ static void InitAliasInfo(AliasInfo * info, unsigned merge, unsigned file_id, char *alias, char *real) { - bzero(info, sizeof(AliasInfo)); + memset(info, 0, sizeof(AliasInfo)); info->def.merge = merge; info->def.fileID = file_id; strncpy(info->alias, alias, XkbKeyNameLength); @@ -136,7 +136,7 @@ MergeAliases(AliasInfo ** into, AliasInfo ** merge, unsigned how_merge) *merge = NULL; return True; } - bzero((char *) &def, sizeof(KeyAliasDef)); + memset(&def, 0, sizeof(KeyAliasDef)); for (tmp = *merge; tmp != NULL; tmp = (AliasInfo *) tmp->def.next) { if (how_merge == MergeDefault) @@ -232,7 +232,7 @@ ApplyAliases(struct xkb_desc * xkb, Bool toGeom, AliasInfo ** info_in) if (!xkb->geom) { struct xkb_geometry_sizes sizes; - bzero((char *) &sizes, sizeof(struct xkb_geometry_sizes)); + memset(&sizes, 0, sizeof(struct xkb_geometry_sizes)); sizes.which = XkbGeomKeyAliasesMask; sizes.num_key_aliases = nOld + nNew; status = XkbcAllocGeometry(xkb, &sizes); diff --git a/src/xkbcomp/compat.c b/src/xkbcomp/compat.c index 7f41af6..97171b7 100644 --- a/src/xkbcomp/compat.c +++ b/src/xkbcomp/compat.c @@ -125,8 +125,8 @@ InitCompatInfo(CompatInfo * info, struct xkb_desc * xkb) info->ledDflt.defs.fileID = info->fileID; info->ledDflt.defs.defined = 0; info->ledDflt.defs.merge = MergeOverride; - bzero((char *) &info->groupCompat[0], - XkbNumKbdGroups * sizeof(GroupCompatInfo)); + memset(&info->groupCompat[0], 0, + XkbNumKbdGroups * sizeof(GroupCompatInfo)); info->leds = NULL; InitVModInfo(&info->vmods, xkb); } @@ -150,8 +150,8 @@ ClearCompatInfo(CompatInfo * info, struct xkb_desc * xkb) ClearIndicatorMapInfo(&info->ledDflt); info->nInterps = 0; info->interps = (SymInterpInfo *) ClearCommonInfo(&info->interps->defs); - bzero((char *) &info->groupCompat[0], - XkbNumKbdGroups * sizeof(GroupCompatInfo)); + memset(&info->groupCompat[0], 0, + XkbNumKbdGroups * sizeof(GroupCompatInfo)); info->leds = (LEDInfo *) ClearCommonInfo(&info->leds->defs); /* 3/30/94 (ef) -- XXX! Should free action info here */ ClearVModInfo(&info->vmods, xkb); @@ -165,7 +165,7 @@ NextInterp(CompatInfo * info) si = uTypedAlloc(SymInterpInfo); if (si) { - bzero((char *) si, sizeof(SymInterpInfo)); + memset(si, 0, sizeof(SymInterpInfo)); info->interps = (SymInterpInfo *) AddCommonInfo(&info->interps->defs, (CommonInfo *) si); @@ -407,7 +407,7 @@ HandleIncludeCompatMap(IncludeStmt * stmt, { haveSelf = True; included = *info; - bzero(info, sizeof(CompatInfo)); + memset(info, 0, sizeof(CompatInfo)); } else if (ProcessIncludeFile(stmt, XkmCompatMapIndex, &rtrn, &newMerge)) { diff --git a/src/xkbcomp/geometry.c b/src/xkbcomp/geometry.c index 51ccc63..f1de745 100644 --- a/src/xkbcomp/geometry.c +++ b/src/xkbcomp/geometry.c @@ -311,7 +311,7 @@ InitKeyInfo(KeyInfo * key, RowInfo * row, GeometryInfo * info) } else { - bzero(key, sizeof(KeyInfo)); + memset(key, 0, sizeof(KeyInfo)); strcpy(key->name, "default"); key->defs.defined = _GK_Default; key->defs.fileID = info->fileID; @@ -360,7 +360,7 @@ InitRowInfo(RowInfo * row, SectionInfo * section, GeometryInfo * info) } else { - bzero(row, sizeof(RowInfo)); + memset(row, 0, sizeof(RowInfo)); row->defs.defined = _GR_Default; row->defs.fileID = info->fileID; row->defs.merge = info->merge; @@ -446,7 +446,7 @@ InitDoodadInfo(DoodadInfo * di, unsigned type, SectionInfo * si, } else { - bzero(di, sizeof(DoodadInfo)); + memset(di, 0, sizeof(DoodadInfo)); di->defs.fileID = info->fileID; di->type = type; } @@ -473,7 +473,7 @@ ClearDoodadInfo(DoodadInfo * di) CommonInfo defs; defs = di->defs; - bzero(di, sizeof(DoodadInfo)); + memset(di, 0, sizeof(DoodadInfo)); di->defs = defs; di->defs.defined = 0; } @@ -533,7 +533,7 @@ InitSectionInfo(SectionInfo * si, GeometryInfo * info) } else { - bzero(si, sizeof(SectionInfo)); + memset(si, 0, sizeof(SectionInfo)); si->defs.fileID = info->fileID; si->defs.merge = info->merge; si->defs.next = NULL; @@ -644,7 +644,7 @@ FreeShapes(ShapeInfo * si, GeometryInfo * info) static void InitGeometryInfo(GeometryInfo * info, unsigned fileID, unsigned merge) { - bzero(info, sizeof(GeometryInfo)); + memset(info, 0, sizeof(GeometryInfo)); info->fileID = fileID; info->merge = merge; InitSectionInfo(&info->dfltSection, info); @@ -681,7 +681,7 @@ NextProperty(GeometryInfo * info) pi = uTypedAlloc(PropertyInfo); if (pi) { - bzero((char *) pi, sizeof(PropertyInfo)); + memset(pi, 0, sizeof(PropertyInfo)); info->props = (PropertyInfo *) AddCommonInfo(&info->props->defs, (CommonInfo *) pi); info->nProps++; @@ -758,7 +758,7 @@ NextShape(GeometryInfo * info) si = uTypedAlloc(ShapeInfo); if (si) { - bzero((char *) si, sizeof(ShapeInfo)); + memset(si, 0, sizeof(ShapeInfo)); info->shapes = (ShapeInfo *) AddCommonInfo(&info->shapes->defs, (CommonInfo *) si); info->nShapes++; @@ -1308,7 +1308,7 @@ HandleIncludeGeometry(IncludeStmt * stmt, struct xkb_desc * xkb, GeometryInfo * { haveSelf = True; included = *info; - bzero(info, sizeof(GeometryInfo)); + memset(info, 0, sizeof(GeometryInfo)); } else if (ProcessIncludeFile(stmt, XkmGeometryIndex, &rtrn, &newMerge)) { @@ -2054,7 +2054,7 @@ SetKeyField(KeyInfo * key, return ReportBadType("key", field, keyText(key), "key name"); } key->defs.defined |= _GK_Name; - bzero(key->name, XkbKeyNameLength + 1); + memset(key->name, 0, XkbKeyNameLength + 1); strncpy(key->name, tmp.keyName.name, XkbKeyNameLength); } else @@ -2471,7 +2471,7 @@ HandleShapeDef(ShapeDef * def, struct xkb_desc * xkb, unsigned merge, if (def->merge != MergeDefault) merge = def->merge; - bzero(&si, sizeof(ShapeInfo)); + memset(&si, 0, sizeof(ShapeInfo)); si.defs.merge = merge; si.name = def->name; si.dfltCornerRadius = info->dfltCornerRadius; @@ -2540,7 +2540,7 @@ HandleOverlayDef(OverlayDef * def, ACTION("Overlay ignored\n"); return True; } - bzero(&ol, sizeof(OverlayInfo)); + memset(&ol, 0, sizeof(OverlayInfo)); ol.name = def->name; for (keyDef = def->keys; keyDef; keyDef = (OverlayKeyDef *) keyDef->common.next) @@ -2692,7 +2692,7 @@ HandleRowBody(RowDef * def, RowInfo * row, unsigned merge, ACTION("Section not compiled\n"); return False; } - bzero(key.name, XkbKeyNameLength + 1); + memset(key.name, 0, XkbKeyNameLength + 1); strncpy(key.name, keyDef->name, XkbKeyNameLength); key.defs.defined |= _GK_Name; } @@ -3439,7 +3439,7 @@ VerifyOverlayInfo(struct xkb_geometry * geom, return False; } /* now figure out how many rows are defined for the overlay */ - bzero(rowSize, sizeof(short) * 256); + memset(rowSize, 0, sizeof(short) * 256); for (k = 0; k < 256; k++) { rowMap[k] = -1; @@ -3498,7 +3498,7 @@ CopyOverlayDef(struct xkb_geometry * geom, { row = &ol->rows[ki->overlayRow]; key = &row->keys[row->num_keys++]; - bzero(key, sizeof(struct xkb_overlay_key)); + memset(key, 0, sizeof(struct xkb_overlay_key)); strncpy(key->over.name, ki->over, XkbKeyNameLength); strncpy(key->under.name, ki->under, XkbKeyNameLength); } @@ -3622,7 +3622,7 @@ CompileGeometry(XkbFile *file, struct xkb_desc * xkb, unsigned merge) { struct xkb_geometry * geom; struct xkb_geometry_sizes sizes; - bzero(&sizes, sizeof(sizes)); + memset(&sizes, 0, sizeof(sizes)); sizes.which = XkbGeomAllMask; sizes.num_properties = info.nProps; sizes.num_colors = 8; diff --git a/src/xkbcomp/keycodes.c b/src/xkbcomp/keycodes.c index 47b9c35..ee76f4c 100644 --- a/src/xkbcomp/keycodes.c +++ b/src/xkbcomp/keycodes.c @@ -556,7 +556,7 @@ HandleIncludeKeycodes(IncludeStmt * stmt, struct xkb_desc * xkb, KeyNamesInfo * { haveSelf = True; included = *info; - bzero(info, sizeof(KeyNamesInfo)); + memset(info, 0, sizeof(KeyNamesInfo)); } else if (stmt->file && strcmp(stmt->file, "computed") == 0) { diff --git a/src/xkbcomp/keymap.c b/src/xkbcomp/keymap.c index 0dd135d..7906b2b 100644 --- a/src/xkbcomp/keymap.c +++ b/src/xkbcomp/keymap.c @@ -56,7 +56,7 @@ CompileKeymap(XkbFile *file, struct xkb_desc * xkb, unsigned merge) char *mainName; LEDInfo *unbound = NULL; - bzero(sections, MAX_SECTIONS * sizeof(XkbFile *)); + memset(sections, 0, MAX_SECTIONS * sizeof(XkbFile *)); mainType = file->type; mainName = file->name; switch (mainType) diff --git a/src/xkbcomp/keytypes.c b/src/xkbcomp/keytypes.c index 057c080..fb1b5b4 100644 --- a/src/xkbcomp/keytypes.c +++ b/src/xkbcomp/keytypes.c @@ -214,7 +214,7 @@ NextKeyType(KeyTypesInfo * info) type = uTypedAlloc(KeyTypeInfo); if (type != NULL) { - bzero(type, sizeof(KeyTypeInfo)); + memset(type, 0, sizeof(KeyTypeInfo)); type->defs.fileID = info->fileID; info->types = (KeyTypeInfo *) AddCommonInfo(&info->types->defs, (CommonInfo *) type); @@ -375,7 +375,7 @@ HandleIncludeKeyTypes(IncludeStmt * stmt, { haveSelf = True; included = *info; - bzero(info, sizeof(KeyTypesInfo)); + memset(info, 0, sizeof(KeyTypesInfo)); } else if (ProcessIncludeFile(stmt, XkmTypesIndex, &rtrn, &newMerge)) { diff --git a/src/xkbcomp/parseutils.c b/src/xkbcomp/parseutils.c index 5606cef..bc56c78 100644 --- a/src/xkbcomp/parseutils.c +++ b/src/xkbcomp/parseutils.c @@ -270,7 +270,7 @@ SymbolsCreate(char *keyName, ExprDef * symbols) def->common.stmtType = StmtSymbolsDef; def->common.next = NULL; def->merge = MergeDefault; - bzero(def->keyName, 5); + memset(def->keyName, 0, 5); strncpy(def->keyName, keyName, 4); def->symbols = symbols; } @@ -420,7 +420,7 @@ ShapeDeclCreate(uint32_t name, OutlineDef * outlines) shape = uTypedAlloc(ShapeDef); if (shape != NULL) { - bzero(shape, sizeof(ShapeDef)); + memset(shape, 0, sizeof(ShapeDef)); shape->common.stmtType = StmtShapeDef; shape->common.next = NULL; shape->merge = MergeDefault; @@ -445,7 +445,7 @@ OutlineCreate(uint32_t field, ExprDef * points) outline = uTypedAlloc(OutlineDef); if (outline != NULL) { - bzero(outline, sizeof(OutlineDef)); + memset(outline, 0, sizeof(OutlineDef)); outline->common.stmtType = StmtOutlineDef; outline->common.next = NULL; outline->field = field; @@ -470,7 +470,7 @@ KeyDeclCreate(char *name, ExprDef * expr) key = uTypedAlloc(KeyDef); if (key != NULL) { - bzero(key, sizeof(KeyDef)); + memset(key, 0, sizeof(KeyDef)); key->common.stmtType = StmtKeyDef; key->common.next = NULL; if (name) @@ -490,7 +490,7 @@ RowDeclCreate(KeyDef * keys) row = uTypedAlloc(RowDef); if (row != NULL) { - bzero(row, sizeof(RowDef)); + memset(row, 0, sizeof(RowDef)); row->common.stmtType = StmtRowDef; row->common.next = NULL; row->nKeys = 0; @@ -513,7 +513,7 @@ SectionDeclCreate(uint32_t name, RowDef * rows) section = uTypedAlloc(SectionDef); if (section != NULL) { - bzero(section, sizeof(SectionDef)); + memset(section, 0, sizeof(SectionDef)); section->common.stmtType = StmtSectionDef; section->common.next = NULL; section->name = name; @@ -536,7 +536,7 @@ OverlayKeyCreate(char *under, char *over) key = uTypedAlloc(OverlayKeyDef); if (key != NULL) { - bzero(key, sizeof(OverlayKeyDef)); + memset(key, 0, sizeof(OverlayKeyDef)); key->common.stmtType = StmtOverlayKeyDef; strncpy(key->over, over, XkbKeyNameLength); strncpy(key->under, under, XkbKeyNameLength); @@ -555,7 +555,7 @@ OverlayDeclCreate(uint32_t name, OverlayKeyDef * keys) ol = uTypedAlloc(OverlayDef); if (ol != NULL) { - bzero(ol, sizeof(OverlayDef)); + memset(ol, 0, sizeof(OverlayDef)); ol->common.stmtType = StmtOverlayDef; ol->name = name; ol->keys = keys; @@ -576,7 +576,7 @@ DoodadCreate(unsigned type, uint32_t name, VarDef * body) doodad = uTypedAlloc(DoodadDef); if (doodad != NULL) { - bzero(doodad, sizeof(DoodadDef)); + memset(doodad, 0, sizeof(DoodadDef)); doodad->common.stmtType = StmtDoodadDef; doodad->common.next = NULL; doodad->type = type; @@ -770,7 +770,7 @@ CreateXKBFile(int type, char *name, ParseCommon * defs, unsigned flags) if (file) { XkbcEnsureSafeMapName(name); - bzero(file, sizeof(XkbFile)); + memset(file, 0, sizeof(XkbFile)); file->type = type; file->topName = _XkbDupString(name); file->name = name; diff --git a/src/xkbcomp/symbols.c b/src/xkbcomp/symbols.c index 217b99f..1415890 100644 --- a/src/xkbcomp/symbols.c +++ b/src/xkbcomp/symbols.c @@ -276,7 +276,7 @@ FreeSymbolsInfo(SymbolsInfo * info) ClearCommonInfo(&info->modMap->defs); if (info->aliases) ClearAliases(&info->aliases); - bzero((char *) info, sizeof(SymbolsInfo)); + memset(info, 0, sizeof(SymbolsInfo)); } static Bool @@ -478,7 +478,7 @@ MergeKeys(SymbolsInfo * info, KeyInfo * into, KeyInfo * from) } } *into = *from; - bzero(from, sizeof(KeyInfo)); + memset(from, 0, sizeof(KeyInfo)); return True; } report = ((warningLevel > 9) || @@ -763,7 +763,7 @@ HandleIncludeSymbols(IncludeStmt * stmt, { haveSelf = True; included = *info; - bzero(info, sizeof(SymbolsInfo)); + memset(info, 0, sizeof(SymbolsInfo)); } else if (ProcessIncludeFile(stmt, XkmSymbolsIndex, &rtrn, &newMerge)) { diff --git a/src/xkbcomp/utils.c b/src/xkbcomp/utils.c index e936367..65128d7 100644 --- a/src/xkbcomp/utils.c +++ b/src/xkbcomp/utils.c @@ -42,7 +42,7 @@ recalloc(void * old, unsigned nOld, unsigned nNew, unsigned itemSize) rtrn = (char *) realloc((char *) old, nNew * itemSize); if ((rtrn) && (nNew > nOld)) { - bzero(&rtrn[nOld * itemSize], (nNew - nOld) * itemSize); + memset(&rtrn[nOld * itemSize], 0, (nNew - nOld) * itemSize); } } return (void *) rtrn;