Commit 7d7224d8 authored by Alan Coopersmith's avatar Alan Coopersmith Committed by Ulrich Sibiller

Replace Xmalloc+bzero pairs with Xcalloc calls

parent 369c9566
...@@ -206,10 +206,9 @@ ExpandQuarkTable(void) ...@@ -206,10 +206,9 @@ ExpandQuarkTable(void)
#endif #endif
newmask = 0x1ff; newmask = 0x1ff;
} }
entries = (Entry *)Xmalloc(sizeof(Entry) * (newmask + 1)); entries = Xcalloc(newmask + 1, sizeof(Entry));
if (!entries) if (!entries)
return False; return False;
bzero((char *)entries, sizeof(Entry) * (newmask + 1));
quarkTable = entries; quarkTable = entries;
quarkMask = newmask; quarkMask = newmask;
quarkRehash = quarkMask - 2; quarkRehash = quarkMask - 2;
......
...@@ -128,10 +128,9 @@ init_fontset( ...@@ -128,10 +128,9 @@ init_fontset(
data = XOM_GENERIC(oc->core.om)->data; data = XOM_GENERIC(oc->core.om)->data;
font_set = (FontSet) Xmalloc(sizeof(FontSetRec)); font_set = Xcalloc(1, sizeof(FontSetRec));
if (font_set == NULL) if (font_set == NULL)
return False; return False;
bzero((char *) font_set, sizeof(FontSetRec));
gen = XOC_GENERIC(oc); gen = XOC_GENERIC(oc);
gen->font_set = font_set; gen->font_set = font_set;
...@@ -1005,10 +1004,9 @@ create_oc( ...@@ -1005,10 +1004,9 @@ create_oc(
{ {
XOC oc; XOC oc;
oc = (XOC) Xmalloc(sizeof(XOCGenericRec)); oc = Xcalloc(1, sizeof(XOCGenericRec));
if (oc == NULL) if (oc == NULL)
return (XOC) NULL; return (XOC) NULL;
bzero((char *) oc, sizeof(XOCGenericRec));
oc->core.om = om; oc->core.om = om;
...@@ -1126,15 +1124,13 @@ add_data( ...@@ -1126,15 +1124,13 @@ add_data(
XOMGenericPart *gen = XOM_GENERIC(om); XOMGenericPart *gen = XOM_GENERIC(om);
OMData new; OMData new;
new = (OMData) Xmalloc(sizeof(OMDataRec)); new = Xcalloc(1, sizeof(OMDataRec));
if (new == NULL) if (new == NULL)
return NULL; return NULL;
gen->data = new; gen->data = new;
bzero((char *) new, sizeof(OMDataRec));
return new; return new;
} }
...@@ -1168,10 +1164,9 @@ init_om( ...@@ -1168,10 +1164,9 @@ init_om(
if (data == NULL) if (data == NULL)
return False; return False;
font_data = (FontData) Xmalloc(sizeof(FontDataRec) * count); font_data = Xcalloc(count, sizeof(FontDataRec));
if (font_data == NULL) if (font_data == NULL)
return False; return False;
bzero((char *) font_data, sizeof(FontDataRec) * count);
data->font_data = font_data; data->font_data = font_data;
data->font_data_count = count; data->font_data_count = count;
...@@ -1237,10 +1232,9 @@ _XDefaultOpenOM(XLCd lcd, Display *dpy, XrmDatabase rdb, ...@@ -1237,10 +1232,9 @@ _XDefaultOpenOM(XLCd lcd, Display *dpy, XrmDatabase rdb,
{ {
XOM om; XOM om;
om = (XOM) Xmalloc(sizeof(XOMGenericRec)); om = Xcalloc(1, sizeof(XOMGenericRec));
if (om == NULL) if (om == NULL)
return (XOM) NULL; return (XOM) NULL;
bzero((char *) om, sizeof(XOMGenericRec));
om->methods = (XOMMethods)&methods; om->methods = (XOMMethods)&methods;
om->core.lcd = lcd; om->core.lcd = lcd;
......
...@@ -581,23 +581,21 @@ static void GrowTable( ...@@ -581,23 +581,21 @@ static void GrowTable(
ltable = (LTable)table; ltable = (LTable)table;
/* cons up a copy to make MoveValues look symmetric */ /* cons up a copy to make MoveValues look symmetric */
otable = *ltable; otable = *ltable;
ltable->buckets = (VEntry *)Xmalloc(i * sizeof(VEntry)); ltable->buckets = Xcalloc(i, sizeof(VEntry));
if (!ltable->buckets) { if (!ltable->buckets) {
ltable->buckets = otable.buckets; ltable->buckets = otable.buckets;
return; return;
} }
ltable->table.mask = i - 1; ltable->table.mask = i - 1;
bzero((char *)ltable->buckets, i * sizeof(VEntry));
MoveValues(&otable, ltable); MoveValues(&otable, ltable);
} else { } else {
register NTable ntable; register NTable ntable;
ntable = (NTable)Xmalloc(sizeof(NTableRec) + i * sizeof(NTable)); ntable = Xcalloc(1, sizeof(NTableRec) + (i * sizeof(NTable)));
if (!ntable) if (!ntable)
return; return;
*ntable = *table; *ntable = *table;
ntable->mask = i - 1; ntable->mask = i - 1;
bzero((char *)NodeBuckets(ntable), i * sizeof(NTable));
*prev = ntable; *prev = ntable;
MoveTables(table, ntable); MoveTables(table, ntable);
} }
......
...@@ -1425,10 +1425,9 @@ _XimProtoCreateIC( ...@@ -1425,10 +1425,9 @@ _XimProtoCreateIC(
if (!(_XimGetInputStyle(arg, &input_style))) if (!(_XimGetInputStyle(arg, &input_style)))
return (XIC)NULL; return (XIC)NULL;
if ((ic = (Xic)Xmalloc(sizeof(XicRec))) == (Xic)NULL) if ((ic = Xcalloc(1, sizeof(XicRec))) == (Xic)NULL)
return (XIC)NULL; return (XIC)NULL;
bzero((char *)ic, sizeof(XicRec));
ic->methods = &ic_methods; ic->methods = &ic_methods;
ic->core.im = (XIM)im; ic->core.im = (XIM)im;
ic->core.input_style = input_style; ic->core.input_style = input_style;
......
...@@ -204,9 +204,8 @@ _XimOpenIM( ...@@ -204,9 +204,8 @@ _XimOpenIM(
Xim im; Xim im;
register int i; register int i;
if (!(im = (Xim)Xmalloc(sizeof(XimRec)))) if (!(im = Xcalloc(1, sizeof(XimRec))))
return (XIM)NULL; return (XIM)NULL;
bzero(im, sizeof(XimRec));
im->core.lcd = lcd; im->core.lcd = lcd;
im->core.ic_chain = (XIC)NULL; im->core.ic_chain = (XIC)NULL;
......
...@@ -143,10 +143,9 @@ _XimLocalCreateIC( ...@@ -143,10 +143,9 @@ _XimLocalCreateIC(
unsigned int num; unsigned int num;
int len; int len;
if((ic = (Xic)Xmalloc(sizeof(XicRec))) == (Xic)NULL) { if((ic = Xcalloc(1, sizeof(XicRec))) == (Xic)NULL) {
return ((XIC)NULL); return ((XIC)NULL);
} }
bzero((char *)ic, sizeof(XicRec));
ic->methods = &Local_ic_methods; ic->methods = &Local_ic_methods;
ic->core.im = im; ic->core.im = im;
......
...@@ -360,10 +360,9 @@ _XimDefaultStyles( ...@@ -360,10 +360,9 @@ _XimDefaultStyles(
n = XIMNumber(supported_local_styles) - 1; n = XIMNumber(supported_local_styles) - 1;
len = sizeof(XIMStyles) + sizeof(XIMStyle) * n; len = sizeof(XIMStyles) + sizeof(XIMStyle) * n;
if(!(tmp = (XPointer)Xmalloc(len))) { if(!(tmp = Xcalloc(1, len))) {
return False; return False;
} }
bzero(tmp, len);
styles = (XIMStyles *)tmp; styles = (XIMStyles *)tmp;
if (n > 0) { if (n > 0) {
...@@ -396,10 +395,9 @@ _XimDefaultIMValues( ...@@ -396,10 +395,9 @@ _XimDefaultIMValues(
n = XIMNumber(supported_local_im_values_list); n = XIMNumber(supported_local_im_values_list);
len = sizeof(XIMValuesList) + sizeof(char **) * n; len = sizeof(XIMValuesList) + sizeof(char **) * n;
if(!(tmp = (XPointer)Xmalloc(len))) { if(!(tmp = Xcalloc(1, len))) {
return False; return False;
} }
bzero(tmp, len);
values_list = (XIMValuesList *)tmp; values_list = (XIMValuesList *)tmp;
if (n > 0) { if (n > 0) {
...@@ -433,10 +431,9 @@ _XimDefaultICValues( ...@@ -433,10 +431,9 @@ _XimDefaultICValues(
n = XIMNumber(supported_local_ic_values_list); n = XIMNumber(supported_local_ic_values_list);
len = sizeof(XIMValuesList) + sizeof(char **) * n; len = sizeof(XIMValuesList) + sizeof(char **) * n;
if(!(tmp = (XPointer)Xmalloc(len))) { if(!(tmp = Xcalloc(1, len))) {
return False; return False;
} }
bzero(tmp, len);
values_list = (XIMValuesList *)tmp; values_list = (XIMValuesList *)tmp;
if (n > 0) { if (n > 0) {
...@@ -1085,10 +1082,9 @@ _XimDecodeStyles( ...@@ -1085,10 +1082,9 @@ _XimDecodeStyles(
num = styles->count_styles; num = styles->count_styles;
len = sizeof(XIMStyles) + sizeof(XIMStyle) * num; len = sizeof(XIMStyles) + sizeof(XIMStyle) * num;
if(!(tmp = (XPointer)Xmalloc(len))) { if(!(tmp = Xcalloc(1, len))) {
return False; return False;
} }
bzero(tmp, len);
out = (XIMStyles *)tmp; out = (XIMStyles *)tmp;
if(num >0) { if(num >0) {
...@@ -1124,10 +1120,9 @@ _XimDecodeValues( ...@@ -1124,10 +1120,9 @@ _XimDecodeValues(
num = values_list->count_values; num = values_list->count_values;
len = sizeof(XIMValuesList) + sizeof(char **) * num; len = sizeof(XIMValuesList) + sizeof(char **) * num;
if(!(tmp = (char *)Xmalloc(len))) { if(!(tmp = Xcalloc(1, len))) {
return False; return False;
} }
bzero(tmp, len);
out = (XIMValuesList *)tmp; out = (XIMValuesList *)tmp;
if(num) { if(num) {
...@@ -2143,10 +2138,9 @@ _XimSetResourceList( ...@@ -2143,10 +2138,9 @@ _XimSetResourceList(
XIMResourceList res; XIMResourceList res;
len = sizeof(XIMResource) * num_resource; len = sizeof(XIMResource) * num_resource;
if(!(res = (XIMResourceList)Xmalloc(len))) { if(!(res = Xcalloc(1, len))) {
return False; return False;
} }
bzero((char *)res, len);
for(i = 0; i < num_resource; i++, id++) { for(i = 0; i < num_resource; i++, id++) {
res[i] = resource[i]; res[i] = resource[i];
......
...@@ -1405,7 +1405,6 @@ _XimGetAttributeID( ...@@ -1405,7 +1405,6 @@ _XimGetAttributeID(
{ {
unsigned int n; unsigned int n;
XIMResourceList res; XIMResourceList res;
int res_len;
char *names; char *names;
int names_len; int names_len;
XPointer tmp; XPointer tmp;
...@@ -1423,18 +1422,15 @@ _XimGetAttributeID( ...@@ -1423,18 +1422,15 @@ _XimGetAttributeID(
if (!(n = _XimCountNumberOfAttr(buf[0], &buf[1], &names_len))) if (!(n = _XimCountNumberOfAttr(buf[0], &buf[1], &names_len)))
return False; return False;
res_len = sizeof(XIMResource) * n;
if (!(res = (XIMResourceList)Xmalloc(res_len))) if (!(res = Xcalloc(n, sizeof(XIMResource))))
return False; return False;
bzero((char *)res, res_len);
values_len = sizeof(XIMValuesList) + (sizeof(char **) * n) + names_len; values_len = sizeof(XIMValuesList) + (sizeof(char **) * n) + names_len;
if (!(tmp = (XPointer)Xmalloc(values_len))) { if (!(tmp = Xcalloc(1, values_len))) {
Xfree(res); Xfree(res);
return False; return False;
} }
bzero(tmp, values_len);
values_list = (XIMValuesList *)tmp; values_list = (XIMValuesList *)tmp;
values = (char **)((char *)tmp + sizeof(XIMValuesList)); values = (char **)((char *)tmp + sizeof(XIMValuesList));
...@@ -1472,18 +1468,15 @@ _XimGetAttributeID( ...@@ -1472,18 +1468,15 @@ _XimGetAttributeID(
if (!(n = _XimCountNumberOfAttr(buf[0], &buf[2], &names_len))) if (!(n = _XimCountNumberOfAttr(buf[0], &buf[2], &names_len)))
return False; return False;
res_len = sizeof(XIMResource) * n;
if (!(res = (XIMResourceList)Xmalloc(res_len))) if (!(res = Xcalloc(n, sizeof(XIMResource))))
return False; return False;
bzero((char *)res, res_len);
values_len = sizeof(XIMValuesList) + (sizeof(char **) * n) + names_len; values_len = sizeof(XIMValuesList) + (sizeof(char **) * n) + names_len;
if (!(tmp = (XPointer)Xmalloc(values_len))) { if (!(tmp = Xcalloc(1, values_len))) {
Xfree(res); Xfree(res);
return False; return False;
} }
bzero(tmp, values_len);
values_list = (XIMValuesList *)tmp; values_list = (XIMValuesList *)tmp;
values = (char **)((char *)tmp + sizeof(XIMValuesList)); values = (char **)((char *)tmp + sizeof(XIMValuesList));
......
...@@ -157,10 +157,9 @@ _XimThaiCreateIC( ...@@ -157,10 +157,9 @@ _XimThaiCreateIC(
int len; int len;
DefTree *tree; DefTree *tree;
if((ic = (Xic)Xmalloc(sizeof(XicRec))) == (Xic)NULL) { if((ic = Xcalloc(1, sizeof(XicRec))) == (Xic)NULL) {
return ((XIC)NULL); return ((XIC)NULL);
} }
bzero((char *)ic, sizeof(XicRec));
ic->methods = &Thai_ic_methods; ic->methods = &Thai_ic_methods;
ic->core.im = im; ic->core.im = im;
......
...@@ -487,9 +487,8 @@ _XimXConf(Xim im, char *address) ...@@ -487,9 +487,8 @@ _XimXConf(Xim im, char *address)
{ {
XSpecRec *spec; XSpecRec *spec;
if (!(spec = (XSpecRec *)Xmalloc(sizeof(XSpecRec)))) if (!(spec = Xcalloc(1, sizeof(XSpecRec))))
return False; return False;
bzero(spec, sizeof(XSpecRec));
spec->improtocolid = XInternAtom(im->core.display, _XIM_PROTOCOL, False); spec->improtocolid = XInternAtom(im->core.display, _XIM_PROTOCOL, False);
spec->imconnectid = XInternAtom(im->core.display, _XIM_XCONNECT, False); spec->imconnectid = XInternAtom(im->core.display, _XIM_XCONNECT, False);
......
...@@ -293,13 +293,11 @@ _XimTransConf( ...@@ -293,13 +293,11 @@ _XimTransConf(
if (!(paddr = (char *)Xmalloc(strlen(address) + 1))) if (!(paddr = (char *)Xmalloc(strlen(address) + 1)))
return False; return False;
if (!(spec = (TransSpecRec *) Xmalloc(sizeof(TransSpecRec)))) { if (!(spec = Xcalloc(1, sizeof(TransSpecRec)))) {
Xfree(paddr); Xfree(paddr);
return False; return False;
} }
bzero(spec, sizeof(TransSpecRec));
(void)strcpy(paddr, address); (void)strcpy(paddr, address);
spec->address = paddr; spec->address = paddr;
......
...@@ -176,10 +176,9 @@ _XlcCreateDefaultCharSet( ...@@ -176,10 +176,9 @@ _XlcCreateDefaultCharSet(
const char *colon; const char *colon;
char *tmp; char *tmp;
charset = (XlcCharSet) Xmalloc(sizeof(XlcCharSetRec)); charset = Xcalloc(1, sizeof(XlcCharSetRec));
if (charset == NULL) if (charset == NULL)
return (XlcCharSet) NULL; return (XlcCharSet) NULL;
bzero((char *) charset, sizeof(XlcCharSetRec));
name_len = strlen(name); name_len = strlen(name);
ct_sequence_len = strlen(ct_sequence); ct_sequence_len = strlen(ct_sequence);
......
...@@ -591,11 +591,10 @@ store_to_database( ...@@ -591,11 +591,10 @@ store_to_database(
goto err; goto err;
} }
new = (Database)Xmalloc(sizeof(DatabaseRec)); new = Xcalloc(1, sizeof(DatabaseRec));
if (new == (Database)NULL) { if (new == (Database)NULL) {
goto err; goto err;
} }
bzero(new, sizeof(DatabaseRec));
new->category = (char *)Xmalloc(strlen(parse_info.category) + 1); new->category = (char *)Xmalloc(strlen(parse_info.category) + 1);
if (new->category == NULL) { if (new->category == NULL) {
...@@ -1309,10 +1308,9 @@ _XlcCreateLocaleDataBase( ...@@ -1309,10 +1308,9 @@ _XlcCreateLocaleDataBase(
return (XPointer)NULL; return (XPointer)NULL;
} }
n = CountDatabase(database); n = CountDatabase(database);
lc_db = (XlcDatabase)Xmalloc(sizeof(XlcDatabaseRec) * (n + 1)); lc_db = Xcalloc(n + 1, sizeof(XlcDatabaseRec));
if (lc_db == (XlcDatabase)NULL) if (lc_db == (XlcDatabase)NULL)
goto err; goto err;
bzero(lc_db, sizeof(XlcDatabaseRec) * (n + 1));
for (p = database, i = 0; p && i < n; p = p->next, ++i) { for (p = database, i = 0; p && i < n; p = p->next, ++i) {
lc_db[i].category_q = XrmStringToQuark(p->category); lc_db[i].category_q = XrmStringToQuark(p->category);
lc_db[i].name_q = XrmStringToQuark(p->name); lc_db[i].name_q = XrmStringToQuark(p->name);
......
...@@ -2660,10 +2660,9 @@ create_conv( ...@@ -2660,10 +2660,9 @@ create_conv(
*conv->methods = *methods; *conv->methods = *methods;
conv->methods->reset = init_state; conv->methods->reset = init_state;
conv->state = (XPointer) Xmalloc(sizeof(StateRec)); conv->state = Xcalloc(1, sizeof(StateRec));
if (conv->state == NULL) if (conv->state == NULL)
goto err; goto err;
bzero((char *) conv->state, sizeof(StateRec));
state = (State) conv->state; state = (State) conv->state;
state->lcd = lcd; state->lcd = lcd;
......
...@@ -60,15 +60,13 @@ create( ...@@ -60,15 +60,13 @@ create(
XLCd lcd; XLCd lcd;
XLCdPublicMethods new; XLCdPublicMethods new;
lcd = (XLCd) Xmalloc(sizeof(XLCdRec)); lcd = Xcalloc(1, sizeof(XLCdRec));
if (lcd == NULL) if (lcd == NULL)
return (XLCd) NULL; return (XLCd) NULL;
bzero((char *) lcd, sizeof(XLCdRec));
lcd->core = (XLCdCore) Xmalloc(sizeof(XLCdGenericRec)); lcd->core = Xcalloc(1, sizeof(XLCdGenericRec));
if (lcd->core == NULL) if (lcd->core == NULL)
goto err; goto err;
bzero((char *) lcd->core, sizeof(XLCdGenericRec));
new = (XLCdPublicMethods) Xmalloc(sizeof(XLCdPublicMethodsRec)); new = (XLCdPublicMethods) Xmalloc(sizeof(XLCdPublicMethodsRec));
if (new == NULL) if (new == NULL)
...@@ -180,10 +178,9 @@ add_codeset( ...@@ -180,10 +178,9 @@ add_codeset(
CodeSet new, *new_list; CodeSet new, *new_list;
int num; int num;
new = (CodeSet) Xmalloc(sizeof(CodeSetRec)); new = Xcalloc(1, sizeof(CodeSetRec));
if (new == NULL) if (new == NULL)
return NULL; return NULL;
bzero((char *) new, sizeof(CodeSetRec));
if ((num = gen->codeset_num)) if ((num = gen->codeset_num))
new_list = (CodeSet *) Xrealloc(gen->codeset_list, new_list = (CodeSet *) Xrealloc(gen->codeset_list,
...@@ -223,16 +220,14 @@ add_parse_list( ...@@ -223,16 +220,14 @@ add_parse_list(
return False; return False;
strcpy(str, encoding); strcpy(str, encoding);
new = (ParseInfo) Xmalloc(sizeof(ParseInfoRec)); new = Xcalloc(1, sizeof(ParseInfoRec));
if (new == NULL) if (new == NULL)
goto err; goto err;
bzero((char *) new, sizeof(ParseInfoRec));
if (gen->mb_parse_table == NULL) { if (gen->mb_parse_table == NULL) {
gen->mb_parse_table = (unsigned char *) Xmalloc(256); /* 2^8 */ gen->mb_parse_table = Xcalloc(1, 256); /* 2^8 */
if (gen->mb_parse_table == NULL) if (gen->mb_parse_table == NULL)
goto err; goto err;
bzero((char *) gen->mb_parse_table, 256);
} }
if ((num = gen->mb_parse_list_num)) if ((num = gen->mb_parse_list_num))
......
...@@ -545,10 +545,9 @@ create_conv( ...@@ -545,10 +545,9 @@ create_conv(
if (XLC_PUBLIC(lcd, is_state_depend)) if (XLC_PUBLIC(lcd, is_state_depend))
conv->methods->reset = init_state; conv->methods->reset = init_state;
conv->state = (XPointer) Xmalloc(sizeof(StateRec)); conv->state = Xcalloc(1, sizeof(StateRec));
if (conv->state == NULL) if (conv->state == NULL)
goto err; goto err;
bzero((char *) conv->state, sizeof(StateRec));
state = (State) conv->state; state = (State) conv->state;
state->lcd = lcd; state->lcd = lcd;
......
...@@ -80,15 +80,13 @@ create( ...@@ -80,15 +80,13 @@ create(
XLCd lcd; XLCd lcd;
XLCdPublicMethods new; XLCdPublicMethods new;
lcd = (XLCd) Xmalloc(sizeof(XLCdRec)); lcd = Xcalloc(1, sizeof(XLCdRec));
if (lcd == NULL) if (lcd == NULL)
return (XLCd) NULL; return (XLCd) NULL;
bzero((char *) lcd, sizeof(XLCdRec));
lcd->core = (XLCdCore) Xmalloc(sizeof(XLCdPublicRec)); lcd->core = Xcalloc(1, sizeof(XLCdPublicRec));
if (lcd->core == NULL) if (lcd->core == NULL)
goto err; goto err;
bzero((char *) lcd->core, sizeof(XLCdPublicRec));
new = (XLCdPublicMethods) Xmalloc(sizeof(XLCdPublicMethodsRec)); new = (XLCdPublicMethods) Xmalloc(sizeof(XLCdPublicMethodsRec));
if (new == NULL) if (new == NULL)
......
...@@ -1656,10 +1656,9 @@ create_oc( ...@@ -1656,10 +1656,9 @@ create_oc(
XOCMethodsList methods_list = oc_methods_list; XOCMethodsList methods_list = oc_methods_list;
int count; int count;
oc = (XOC) Xmalloc(sizeof(XOCGenericRec)); oc = Xcalloc(1, sizeof(XOCGenericRec));
if (oc == NULL) if (oc == NULL)
return (XOC) NULL; return (XOC) NULL;
bzero((char *) oc, sizeof(XOCGenericRec));
oc->core.om = om; oc->core.om = om;
...@@ -1844,10 +1843,9 @@ create_om( ...@@ -1844,10 +1843,9 @@ create_om(
{ {
XOM om; XOM om;
om = (XOM) Xmalloc(sizeof(XOMGenericRec)); om = Xcalloc(1, sizeof(XOMGenericRec));
if (om == NULL) if (om == NULL)
return (XOM) NULL; return (XOM) NULL;
bzero((char *) om, sizeof(XOMGenericRec));
om->methods = &methods; om->methods = &methods;
om->core.lcd = lcd; om->core.lcd = lcd;
...@@ -1915,10 +1913,9 @@ read_EncodingInfo( ...@@ -1915,10 +1913,9 @@ read_EncodingInfo(
FontData font_data,ret; FontData font_data,ret;
char *buf, *bufptr,*scp; char *buf, *bufptr,*scp;
int len; int len;
font_data = (FontData) Xmalloc(sizeof(FontDataRec) * count); font_data = Xcalloc(count, sizeof(FontDataRec));
if (font_data == NULL) if (font_data == NULL)
return NULL; return NULL;
bzero((char *) font_data, sizeof(FontDataRec) * count);
ret = font_data; ret = font_data;
for ( ; count-- > 0; font_data++) { for ( ; count-- > 0; font_data++) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment