summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Jackson <ajax@redhat.com>2009-01-20 23:16:35 -0500
committerAdam Jackson <ajax@redhat.com>2009-01-20 23:16:35 -0500
commit0cdc9b8f850342d50b72a57507db3413eacc6fb8 (patch)
treeb86480167977d28f8e7574c91aedf982db52bf32
parent632a2e90a4b209facc84d7a18873f19a720ea7df (diff)
xalloc -> malloc, etc.
-rw-r--r--include/X11/fonts/bufio.h7
-rw-r--r--include/X11/fonts/fontmisc.h13
-rw-r--r--src/FreeType/ftfuncs.c111
-rw-r--r--src/FreeType/xttcap.c19
-rw-r--r--src/bitmap/bdfread.c69
-rw-r--r--src/bitmap/bdfutils.c6
-rw-r--r--src/bitmap/bitmapfunc.c2
-rw-r--r--src/bitmap/bitmaputil.c2
-rw-r--r--src/bitmap/bitscale.c74
-rw-r--r--src/bitmap/pcfread.c86
-rw-r--r--src/bitmap/pcfwrite.c6
-rw-r--r--src/bitmap/snfread.c59
-rw-r--r--src/builtins/dir.c19
-rw-r--r--src/builtins/file.c6
-rw-r--r--src/builtins/render.c4
-rw-r--r--src/fc/fsconvert.c21
-rw-r--r--src/fc/fserve.c38
-rw-r--r--src/fc/fsio.c16
-rw-r--r--src/fontfile/bitsource.c6
-rw-r--r--src/fontfile/bufio.c4
-rw-r--r--src/fontfile/bunzip2.c6
-rw-r--r--src/fontfile/catalogue.c36
-rw-r--r--src/fontfile/decompress.c4
-rwxr-xr-xsrc/fontfile/dirfile.c2
-rw-r--r--src/fontfile/fontdir.c49
-rw-r--r--src/fontfile/fontfile.c26
-rw-r--r--src/fontfile/fontscale.c5
-rw-r--r--src/fontfile/gunzip.c8
-rw-r--r--src/fontfile/renderers.c4
-rw-r--r--src/util/atom.c9
-rw-r--r--src/util/fontnames.c32
-rw-r--r--src/util/fontutil.c12
-rw-r--r--src/util/miscutil.c32
-rw-r--r--src/util/patcache.c14
-rw-r--r--src/util/private.c11
35 files changed, 357 insertions, 461 deletions
diff --git a/include/X11/fonts/bufio.h b/include/X11/fonts/bufio.h
index b5977b1..f8e5815 100644
--- a/include/X11/fonts/bufio.h
+++ b/include/X11/fonts/bufio.h
@@ -34,13 +34,6 @@ from The Open Group.
#include <X11/Xfuncproto.h>
-#ifdef TEST
-
-#define xalloc(s) malloc(s)
-#define xfree(s) free(s)
-
-#endif
-
#define BUFFILESIZE 8192
#define BUFFILEEOF -1
diff --git a/include/X11/fonts/fontmisc.h b/include/X11/fonts/fontmisc.h
index 3fc60ff..8df5a6a 100644
--- a/include/X11/fonts/fontmisc.h
+++ b/include/X11/fonts/fontmisc.h
@@ -59,21 +59,8 @@ extern Atom MakeAtom ( char *string, unsigned len, int makeit );
extern int ValidAtom ( Atom atom );
extern char *NameForAtom (Atom atom);
-#ifndef _HAVE_XALLOC_DECLS
-#define _HAVE_XALLOC_DECLS
-extern pointer Xalloc(unsigned long);
-extern pointer Xrealloc(pointer, unsigned long);
-extern void Xfree(pointer);
-extern pointer Xcalloc(unsigned long);
-#endif
extern int f_strcasecmp(const char *s1, const char *s2);
-#ifndef xalloc
-#define xalloc(n) Xalloc ((unsigned) n)
-#define xfree(p) Xfree ((pointer) p)
-#define xrealloc(p,n) Xrealloc ((pointer)p,n)
-#define xcalloc(n,s) Xcalloc((unsigned) n * (unsigned) s)
-#endif
#define lowbit(x) ((x) & (~(x) + 1))
#undef assert
diff --git a/src/FreeType/ftfuncs.c b/src/FreeType/ftfuncs.c
index 9f3af5d..35d58d5 100644
--- a/src/FreeType/ftfuncs.c
+++ b/src/FreeType/ftfuncs.c
@@ -194,24 +194,22 @@ FreeTypeOpenFace(FTFacePtr *facep, char *FTFileName, char *realFileName, int fac
}
/* No cached match; need to make a new one */
- face = (FTFacePtr)xalloc(sizeof(FTFaceRec));
- if(face == NULL) {
+ face = calloc(1, sizeof(FTFaceRec));
+ if (face == NULL) {
return AllocError;
}
- memset(face, 0, sizeof(FTFaceRec));
- face->filename = (char*)xalloc(strlen(FTFileName)+1);
- if(face->filename == NULL) {
- xfree(face);
+ face->filename = strdup(FTFileName);
+ if (face->filename == NULL) {
+ free(face);
return AllocError;
}
- strcpy(face->filename, FTFileName);
ftrc = FT_New_Face(ftypeLibrary, realFileName, faceNumber, &face->face);
if(ftrc != 0) {
ErrorF("FreeType: couldn't open face %s: %d\n", FTFileName, ftrc);
- xfree(face->filename);
- xfree(face);
+ free(face->filename);
+ free(face);
return BadFontName;
}
@@ -257,8 +255,8 @@ FreeTypeFreeFace(FTFacePtr face)
}
MUMBLE1("Closing face: %s\n", face->filename);
FT_Done_Face(face->face);
- xfree(face->filename);
- xfree(face);
+ free(face->filename);
+ free(face);
}
}
@@ -417,7 +415,7 @@ FreeTypeOpenInstance(FTInstancePtr *instance_return, FTFacePtr face,
}
/* None matching found */
- instance = (FTInstancePtr)xalloc(sizeof(FTInstanceRec));
+ instance = malloc(sizeof(FTInstanceRec));
if(instance == NULL) {
return AllocError;
}
@@ -452,7 +450,7 @@ FreeTypeOpenInstance(FTInstancePtr *instance_return, FTFacePtr face,
ftrc = FT_New_Size(instance->face->face, &instance->size);
if(ftrc != 0) {
ErrorF("FreeType: couldn't create size object: %d\n", ftrc);
- xfree(instance);
+ free(instance);
return FTtoXReturnCode(ftrc);
}
FreeTypeActivateInstance(instance);
@@ -465,14 +463,14 @@ FreeTypeOpenInstance(FTInstancePtr *instance_return, FTFacePtr face,
int xsize, ysize;
xrc = FTFindSize(face->face, trans, &xsize, &ysize);
if(xrc != Successful) {
- xfree(instance);
+ free(instance);
return xrc;
}
ftrc = FT_Set_Pixel_Sizes(instance->face->face, xsize, ysize);
}
if(ftrc != 0) {
FT_Done_Size(instance->size);
- xfree(instance);
+ free(instance);
return FTtoXReturnCode(ftrc);
}
@@ -569,10 +567,10 @@ FreeTypeFreeInstance(FTInstancePtr instance)
FreeTypeFreeFace(instance->face);
if(instance->charcellMetrics) {
- xfree(instance->charcellMetrics);
+ free(instance->charcellMetrics);
}
if(instance->forceConstantMetrics) {
- xfree(instance->forceConstantMetrics);
+ free(instance->forceConstantMetrics);
}
if(instance->glyphs) {
for(i = 0; i < iceil(instance->nglyphs, FONTSEGMENTSIZE); i++) {
@@ -580,21 +578,21 @@ FreeTypeFreeInstance(FTInstancePtr instance)
for(j = 0; j < FONTSEGMENTSIZE; j++) {
if(instance->available[i][j] ==
FT_AVAILABLE_RASTERISED)
- xfree(instance->glyphs[i][j].bits);
+ free(instance->glyphs[i][j].bits);
}
- xfree(instance->glyphs[i]);
+ free(instance->glyphs[i]);
}
}
- xfree(instance->glyphs);
+ free(instance->glyphs);
}
if(instance->available) {
for(i = 0; i < iceil(instance->nglyphs, FONTSEGMENTSIZE); i++) {
if(instance->available[i])
- xfree(instance->available[i]);
+ free(instance->available[i]);
}
- xfree(instance->available);
+ free(instance->available);
}
- xfree(instance);
+ free(instance);
}
}
@@ -617,38 +615,30 @@ FreeTypeInstanceFindGlyph(unsigned idx_in, int flags, FTInstancePtr instance,
}
if(*available == NULL) {
- *available =
- (int**)xalloc(sizeof(int*) * iceil(instance->nglyphs,
- FONTSEGMENTSIZE));
+ *available = calloc(iceil(instance->nglyphs, FONTSEGMENTSIZE),
+ sizeof(int *));
if(*available == NULL)
return AllocError;
- memset((char*)(*available), 0,
- sizeof(int*) * iceil(instance->nglyphs, FONTSEGMENTSIZE));
}
segment = ifloor(idx, FONTSEGMENTSIZE);
offset = idx - segment * FONTSEGMENTSIZE;
if((*available)[segment] == NULL) {
- (*available)[segment] = (int*)xalloc(sizeof(int) * FONTSEGMENTSIZE);
+ (*available)[segment] = calloc(FONTSEGMENTSIZE, sizeof(int *));
if((*available)[segment] == NULL)
return AllocError;
- memset((char*)(*available)[segment], 0, sizeof(int) * FONTSEGMENTSIZE);
}
if(*glyphs == NULL) {
- *glyphs = (CharInfoPtr*)xalloc(sizeof(CharInfoPtr)*
- iceil(instance->nglyphs,
- FONTSEGMENTSIZE));
+ *glyphs = calloc(iceil(instance->nglyphs, FONTSEGMENTSIZE),
+ sizeof(CharInfoPtr));
if(*glyphs == NULL)
return AllocError;
- memset((char*)(*glyphs), 0,
- sizeof(CharInfoPtr)*iceil(instance->nglyphs, FONTSEGMENTSIZE));
}
if((*glyphs)[segment] == NULL) {
- (*glyphs)[segment]=
- (CharInfoPtr)xalloc(sizeof(CharInfoRec) * FONTSEGMENTSIZE);
+ (*glyphs)[segment] = malloc(sizeof(CharInfoRec) * FONTSEGMENTSIZE);
if((*glyphs)[segment] == NULL)
return AllocError;
}
@@ -1372,10 +1362,9 @@ FreeTypeRasteriseGlyph(unsigned idx, int flags, CharInfoPtr tgp,
bpr = (((wd + (instance->bmfmt.glyph<<3) - 1) >> 3) &
-instance->bmfmt.glyph);
- raster = (char*)xalloc(ht * bpr);
+ raster = calloc(1, ht * bpr);
if(raster == NULL)
return AllocError;
- memset(raster, 0, ht * bpr);
tgp->bits = raster;
@@ -1534,10 +1523,10 @@ FreeTypeFreeFont(FTFontPtr font)
{
FreeTypeFreeInstance(font->instance);
if(font->ranges)
- xfree(font->ranges);
+ free(font->ranges);
if(font->dummy_char.bits)
- xfree(font->dummy_char.bits);
- xfree(font);
+ free(font->dummy_char.bits);
+ free(font);
}
/* Free a font. If freeProps is 0, don't free the properties. */
@@ -1552,8 +1541,8 @@ FreeTypeFreeXFont(FontPtr pFont, int freeProps)
FreeTypeFreeFont(tf);
}
if(freeProps && pFont->info.nprops>0) {
- xfree(pFont->info.isStringProp);
- xfree(pFont->info.props);
+ free(pFont->info.isStringProp);
+ free(pFont->info.props);
}
DestroyFontRec(pFont);
}
@@ -1633,13 +1622,13 @@ FreeTypeAddProperties(FTFontPtr font, FontScalablePtr vals, FontInfoPtr info,
( (font_properties && (post || t1info)) ? 3 : 0 ) +
2; /* type */
- info->props = (FontPropPtr)xalloc(maxprops * sizeof(FontPropRec));
+ info->props = malloc(maxprops * sizeof(FontPropRec));
if(info->props == NULL)
return AllocError;
- info->isStringProp = (char*)xalloc(maxprops);
+ info->isStringProp = malloc(maxprops);
if(info->isStringProp == NULL) {
- xfree(info->props);
+ free(info->props);
return AllocError;
}
@@ -2133,7 +2122,7 @@ restrict_code_range_by_str(int count,unsigned short *refFirstCol,
fflush(stderr);
#endif
nRanges++;
- ranges = (fsRange *)xrealloc(ranges, nRanges*sizeof(*ranges));
+ ranges = realloc(ranges, nRanges*sizeof(*ranges));
if (NULL == ranges)
break;
{
@@ -2164,7 +2153,7 @@ restrict_code_range_by_str(int count,unsigned short *refFirstCol,
}
result=i;
}
- xfree(ranges);
+ free(ranges);
}
return result;
}
@@ -2208,7 +2197,7 @@ FreeTypeSetUpTTCap( char *fileName, FontScalablePtr vals,
int dirLen = p1-fileName;
int baseLen = fileName+len - p2 -1;
- *dynStrRealFileName = (char *)xalloc(dirLen+baseLen+1);
+ *dynStrRealFileName = malloc(dirLen+baseLen+1);
if( *dynStrRealFileName == NULL ) {
result = AllocError;
goto quit;
@@ -2278,7 +2267,7 @@ FreeTypeSetUpTTCap( char *fileName, FontScalablePtr vals,
if( beginptr && 0 < *face_number ) {
char *slash;
*dynStrFTFileName = /* add -> ':'+strlen0+':'+strlen1+'\0' */
- (char *)xalloc(1+strlen(beginptr)+1+strlen(*dynStrRealFileName)+1);
+ malloc(1+strlen(beginptr)+1+strlen(*dynStrRealFileName)+1);
if( *dynStrFTFileName == NULL ){
result = AllocError;
goto quit;
@@ -2303,7 +2292,7 @@ FreeTypeSetUpTTCap( char *fileName, FontScalablePtr vals,
}
}
else{
- *dynStrFTFileName = (char *)xalloc(strlen(*dynStrRealFileName)+1);
+ *dynStrFTFileName = malloc(strlen(*dynStrRealFileName)+1);
if( *dynStrFTFileName == NULL ){
result = AllocError;
goto quit;
@@ -2823,7 +2812,7 @@ FreeTypeLoadFont(FTFontPtr font, FontInfoPtr info, FTFacePtr face,
font->nranges = vals->nranges;
font->ranges = 0;
if(font->nranges) {
- font->ranges = (fsRange*)xalloc(vals->nranges*sizeof(fsRange));
+ font->ranges = malloc(vals->nranges*sizeof(fsRange));
if(font->ranges == NULL)
return AllocError;
memcpy((char*)font->ranges, (char*)vals->ranges,
@@ -3151,12 +3140,11 @@ FreeTypeLoadXFont(char *fileName,
char *dynStrFTFileName = NULL; /* :1:foo.ttc */
char *dynStrTTCapCodeRange = NULL;
- font = (FTFontPtr)xalloc(sizeof(FTFontRec));
+ font = calloc(1, sizeof(FTFontRec));
if(font == NULL) {
xrc = AllocError;
goto quit;
}
- memset(font, 0, sizeof(FTFontRec));
xrc = FreeTypeSetUpTTCap(fileName, vals,
&dynStrRealFileName, &dynStrFTFileName,
@@ -3461,7 +3449,7 @@ FreeTypeLoadXFont(char *fileName,
}
/* header's metrics */
- instance->charcellMetrics = (xCharInfo*)xalloc(sizeof(xCharInfo));
+ instance->charcellMetrics = malloc(sizeof(xCharInfo));
if(instance->charcellMetrics == NULL) {
xrc = AllocError;
goto quit;
@@ -3492,7 +3480,7 @@ FreeTypeLoadXFont(char *fileName,
int c = ins_ttcap->force_c_representative_metrics_char_code;
/* header's metrics */
if( instance->forceConstantMetrics == NULL ){
- instance->forceConstantMetrics = (xCharInfo*)xalloc(sizeof(xCharInfo));
+ instance->forceConstantMetrics = malloc(sizeof(xCharInfo));
if(instance->forceConstantMetrics == NULL) {
xrc = AllocError;
goto quit;
@@ -3632,9 +3620,9 @@ FreeTypeLoadXFont(char *fileName,
}
quit:
- if ( dynStrTTCapCodeRange ) xfree(dynStrTTCapCodeRange);
- if ( dynStrFTFileName ) xfree(dynStrFTFileName);
- if ( dynStrRealFileName ) xfree(dynStrRealFileName);
+ if ( dynStrTTCapCodeRange ) free(dynStrTTCapCodeRange);
+ if ( dynStrFTFileName ) free(dynStrFTFileName);
+ if ( dynStrRealFileName ) free(dynStrRealFileName);
if ( xrc != Successful ) {
if( font ){
if( face && font->instance == NULL ) FreeTypeFreeFace(face);
@@ -3763,9 +3751,8 @@ FreeTypeGetGlyphs(FontPtr pFont, unsigned long count, unsigned char *chars,
else ht=ht_actual;
bpr = (((wd + (tf->instance->bmfmt.glyph<<3) - 1) >> 3) &
-tf->instance->bmfmt.glyph);
- raster = (char*)xalloc(ht * bpr);
+ raster = calloc(1, ht * bpr);
if(raster) {
- memset(raster, 0, ht * bpr);
tf->dummy_char.bits = raster;
*gp++ = &tf->dummy_char;
}
diff --git a/src/FreeType/xttcap.c b/src/FreeType/xttcap.c
index 49d2e8e..89e092b 100644
--- a/src/FreeType/xttcap.c
+++ b/src/FreeType/xttcap.c
@@ -235,7 +235,7 @@ SPropRecValList_add_record(SDynPropRecValList *pThisList,
{
char *p;
- if (NULL == (p = (char *)xalloc(strlen(strValue)+1))) {
+ if (NULL == (p = malloc(strlen(strValue)+1))) {
fprintf(stderr,
"truetype font property : "
"cannot allocate memory.\n");
@@ -259,8 +259,7 @@ SPropRecValList_add_record(SDynPropRecValList *pThisList,
/* add to list */
SPropRecValListNodeP *newNode;
- if (NULL == (newNode =
- (SPropRecValListNodeP *)xalloc(sizeof(*newNode)))) {
+ if (NULL == (newNode = malloc(sizeof(*newNode)))) {
fprintf(stderr,
"truetype font property : "
"cannot allocate memory.\n");
@@ -449,7 +448,7 @@ parse_one_line(SDynPropRecValList *pThisList, FILE *is)
char *buf = NULL;
char *recordHead, *valueHead = NULL;
- if (NULL == (buf = xalloc(LEN_LINEBUF))) {
+ if (NULL == (buf = malloc(LEN_LINEBUF))) {
fprintf(stderr,
"truetype font property file : cannot allocate memory.\n");
result = True;
@@ -484,7 +483,7 @@ parse_one_line(SDynPropRecValList *pThisList, FILE *is)
result = SPropRecValList_add_record(pThisList, recordHead, valueHead);
}
quit:
- xfree(buf);
+ free(buf);
abort:
return result;
}
@@ -625,13 +624,13 @@ SPropRecValList_add_by_font_cap(SDynPropRecValList *pThisList,
char *value;
len = term-p-1;
- value=(char *)xalloc(len+1);
+ value=malloc(len+1);
memcpy(value, p+1, len);
value[len]='\0';
SPropRecValList_add_record(pThisList,
"FaceNumber",
value);
- xfree(value);
+ free(value);
term=p;
}
break;
@@ -645,7 +644,7 @@ SPropRecValList_add_by_font_cap(SDynPropRecValList *pThisList,
int i;
char const *nextColon = strchr(strCapHead, ':');
if (0<nextColon-strCapHead) {
- char *duplicated = (char *)xalloc((nextColon-strCapHead)+1);
+ char *duplicated = malloc((nextColon-strCapHead)+1);
{
char *value;
@@ -674,7 +673,7 @@ SPropRecValList_add_by_font_cap(SDynPropRecValList *pThisList,
next:
;
}
- xfree(duplicated);
+ free(duplicated);
}
strCapHead = nextColon+1;
}
@@ -695,7 +694,7 @@ XttXstrdup(char const *str)
{
char *result;
- result = (char *)xalloc(strlen(str)+1);
+ result = malloc(strlen(str)+1);
if (result)
strcpy(result, str);
diff --git a/src/bitmap/bdfread.c b/src/bitmap/bdfread.c
index f9a3a5f..0835653 100644
--- a/src/bitmap/bdfread.c
+++ b/src/bitmap/bdfread.c
@@ -100,7 +100,7 @@ bdfReadBitmap(CharInfoPtr pCI, FontFilePtr file, int bit, int byte,
widthBytes = BYTES_PER_ROW(widthBits, glyph);
if (widthBytes * height > 0) {
- picture = (unsigned char *) xalloc(widthBytes * height);
+ picture = malloc(widthBytes * height);
if (!picture) {
bdfError("Couldn't allocate picture (%d*%d)\n", widthBytes, height);
goto BAILOUT;
@@ -190,7 +190,7 @@ bdfReadBitmap(CharInfoPtr pCI, FontFilePtr file, int bit, int byte,
return (TRUE);
BAILOUT:
if (picture)
- xfree(picture);
+ free(picture);
pCI->bits = NULL;
return (FALSE);
}
@@ -227,25 +227,25 @@ bdfFreeFontBits(FontPtr pFont)
bitmapFont = (BitmapFontPtr) pFont->fontPrivate;
bitmapExtra = (BitmapExtraPtr) bitmapFont->bitmapExtra;
- xfree(bitmapFont->ink_metrics);
+ free(bitmapFont->ink_metrics);
if(bitmapFont->encoding) {
nencoding = (pFont->info.lastCol - pFont->info.firstCol + 1) *
(pFont->info.lastRow - pFont->info.firstRow + 1);
for(i=0; i<NUM_SEGMENTS(nencoding); i++)
- xfree(bitmapFont->encoding[i]);
+ free(bitmapFont->encoding[i]);
}
- xfree(bitmapFont->encoding);
+ free(bitmapFont->encoding);
for (i = 0; i < bitmapFont->num_chars; i++)
- xfree(bitmapFont->metrics[i].bits);
- xfree(bitmapFont->metrics);
+ free(bitmapFont->metrics[i].bits);
+ free(bitmapFont->metrics);
if (bitmapExtra)
{
- xfree (bitmapExtra->glyphNames);
- xfree (bitmapExtra->sWidths);
- xfree (bitmapExtra);
+ free (bitmapExtra->glyphNames);
+ free (bitmapExtra->sWidths);
+ free (bitmapExtra);
}
- xfree(pFont->info.props);
- xfree(bitmapFont);
+ free(pFont->info.props);
+ free(bitmapFont);
}
@@ -297,17 +297,16 @@ bdfReadCharacters(FontFilePtr file, FontPtr pFont, bdfFileState *pState,
sizeof(CharInfoRec));
goto BAILOUT;
}
- ci = (CharInfoPtr) xalloc(nchars * sizeof(CharInfoRec));
+ ci = calloc(nchars, sizeof(CharInfoRec));
if (!ci) {
bdfError("Couldn't allocate pCI (%d*%d)\n", nchars,
sizeof(CharInfoRec));
goto BAILOUT;
}
- bzero((char *)ci, nchars * sizeof(CharInfoRec));
bitmapFont->metrics = ci;
if (bitmapExtra) {
- bitmapExtra->glyphNames = (Atom *) xalloc(nchars * sizeof(Atom));
+ bitmapExtra->glyphNames = malloc(nchars * sizeof(Atom));
if (!bitmapExtra->glyphNames) {
bdfError("Couldn't allocate glyphNames (%d*%d)\n",
nchars, sizeof(Atom));
@@ -315,7 +314,7 @@ bdfReadCharacters(FontFilePtr file, FontPtr pFont, bdfFileState *pState,
}
}
if (bitmapExtra) {
- bitmapExtra->sWidths = (int *) xalloc(nchars * sizeof(int));
+ bitmapExtra->sWidths = malloc(nchars * sizeof(int));
if (!bitmapExtra->sWidths) {
bdfError("Couldn't allocate sWidth (%d *%d)\n",
nchars, sizeof(int));
@@ -381,8 +380,7 @@ bdfReadCharacters(FontFilePtr file, FontPtr pFont, bdfFileState *pState,
if (char_col > pFont->info.lastCol)
pFont->info.lastCol = char_col;
if (bdfEncoding[char_row] == (CharInfoPtr *) NULL) {
- bdfEncoding[char_row] =
- (CharInfoPtr *) xalloc(256 * sizeof(CharInfoPtr));
+ bdfEncoding[char_row] = malloc(256 * sizeof(CharInfoPtr));
if (!bdfEncoding[char_row]) {
bdfError("Couldn't allocate row %d of encoding (%d*%d)\n",
char_row, INDICES, sizeof(CharInfoPtr));
@@ -491,9 +489,7 @@ bdfReadCharacters(FontFilePtr file, FontPtr pFont, bdfFileState *pState,
nencoding = (pFont->info.lastRow - pFont->info.firstRow + 1) *
(pFont->info.lastCol - pFont->info.firstCol + 1);
- bitmapFont->encoding =
- (CharInfoPtr **) xcalloc(NUM_SEGMENTS(nencoding),
- sizeof(CharInfoPtr*));
+ bitmapFont->encoding = calloc(NUM_SEGMENTS(nencoding),sizeof(CharInfoPtr*));
if (!bitmapFont->encoding) {
bdfError("Couldn't allocate ppCI (%d,%d)\n",
NUM_SEGMENTS(nencoding),
@@ -517,8 +513,8 @@ bdfReadCharacters(FontFilePtr file, FontPtr pFont, bdfFileState *pState,
else {
if (!bitmapFont->encoding[SEGMENT_MAJOR(i)]) {
bitmapFont->encoding[SEGMENT_MAJOR(i)]=
- (CharInfoPtr*)xcalloc(BITMAP_FONT_SEGMENT_SIZE,
- sizeof(CharInfoPtr));
+ calloc(BITMAP_FONT_SEGMENT_SIZE,
+ sizeof(CharInfoPtr));
if (!bitmapFont->encoding[SEGMENT_MAJOR(i)])
goto BAILOUT;
}
@@ -531,12 +527,12 @@ bdfReadCharacters(FontFilePtr file, FontPtr pFont, bdfFileState *pState,
}
for (i = 0; i < 256; i++)
if (bdfEncoding[i])
- xfree(bdfEncoding[i]);
+ free(bdfEncoding[i]);
return (TRUE);
BAILOUT:
for (i = 0; i < 256; i++)
if (bdfEncoding[i])
- xfree(bdfEncoding[i]);
+ free(bdfEncoding[i]);
/* bdfFreeFontBits will clean up the rest */
return (FALSE);
}
@@ -613,21 +609,20 @@ bdfReadProperties(FontFilePtr file, FontPtr pFont, bdfFileState *pState)
pFont->info.props = NULL;
pFont->info.nprops = 0;
- stringProps = (char *) xalloc((nProps + BDF_GENPROPS) * sizeof(char));
+ stringProps = malloc((nProps + BDF_GENPROPS) * sizeof(char));
pFont->info.isStringProp = stringProps;
if (stringProps == NULL) {
bdfError("Couldn't allocate stringProps (%d*%d)\n",
(nProps + BDF_GENPROPS), sizeof(Bool));
goto BAILOUT;
}
- pFont->info.props = props = (FontPropPtr) xalloc((nProps + BDF_GENPROPS) *
- sizeof(FontPropRec));
+ pFont->info.props = props = calloc(nProps + BDF_GENPROPS,
+ sizeof(FontPropRec));
if (props == NULL) {
bdfError("Couldn't allocate props (%d*%d)\n", nProps + BDF_GENPROPS,
sizeof(FontPropRec));
goto BAILOUT;
}
- bzero((char *)props, (nProps + BDF_GENPROPS) * sizeof(FontPropRec));
nextProp = 0;
props_left = nProps;
@@ -768,11 +763,11 @@ bdfReadProperties(FontFilePtr file, FontPtr pFont, bdfFileState *pState)
return (TRUE);
BAILOUT:
if (pFont->info.isStringProp) {
- xfree(pFont->info.isStringProp);
+ free(pFont->info.isStringProp);
pFont->info.isStringProp = NULL;
}
if (pFont->info.props) {
- xfree(pFont->info.props);
+ free(pFont->info.props);
pFont->info.props = NULL;
}
while (line && bdfIsPrefix(line, "ENDPROPERTIES"))
@@ -806,12 +801,11 @@ bdfReadFont(FontPtr pFont, FontFilePtr file,
if (!bdfReadHeader(file, &state))
goto BAILOUT;
- bitmapFont = (BitmapFontPtr) xalloc(sizeof(BitmapFontRec));
+ bitmapFont = calloc(1, sizeof(BitmapFontRec));
if (!bitmapFont) {
bdfError("Couldn't allocate bitmapFontRec (%d)\n", sizeof(BitmapFontRec));
goto BAILOUT;
}
- bzero((char *)bitmapFont, sizeof(BitmapFontRec));
pFont->fontPrivate = (pointer) bitmapFont;
bitmapFont->metrics = 0;
@@ -820,12 +814,11 @@ bdfReadFont(FontPtr pFont, FontFilePtr file,
bitmapFont->encoding = 0;
bitmapFont->pDefault = NULL;
- bitmapFont->bitmapExtra = (BitmapExtraPtr) xalloc(sizeof(BitmapExtraRec));
+ bitmapFont->bitmapExtra = calloc(1, sizeof(BitmapExtraRec));
if (!bitmapFont->bitmapExtra) {
bdfError("Couldn't allocate bitmapExtra (%d)\n", sizeof(BitmapExtraRec));
goto BAILOUT;
}
- bzero((char *)bitmapFont->bitmapExtra, sizeof(BitmapExtraRec));
bitmapFont->bitmapExtra->glyphNames = 0;
bitmapFont->bitmapExtra->sWidths = 0;
@@ -943,14 +936,14 @@ bdfPadToTerminal(FontPtr pFont)
new_size = BYTES_FOR_GLYPH(&new, pFont->glyph);
for (i = 0; i < bitmapFont->num_chars; i++) {
- new.bits = (char *) xalloc(new_size);
+ new.bits = malloc(new_size);
if (!new.bits) {
bdfError("Couldn't allocate bits (%d)\n", new_size);
return FALSE;
- }
+ }
FontCharReshape(pFont, &bitmapFont->metrics[i], &new);
new.metrics.attributes = bitmapFont->metrics[i].metrics.attributes;
- xfree(bitmapFont->metrics[i].bits);
+ free(bitmapFont->metrics[i].bits);
bitmapFont->metrics[i] = new;
}
bitmapExtra = bitmapFont->bitmapExtra;
diff --git a/src/bitmap/bdfutils.c b/src/bitmap/bdfutils.c
index 61406b8..17596c3 100644
--- a/src/bitmap/bdfutils.c
+++ b/src/bitmap/bdfutils.c
@@ -174,7 +174,7 @@ bdfGetPropertyValue(char *s)
}
/* quoted string: strip outer quotes and undouble inner quotes */
s++;
- pp = p = (char *) xalloc((unsigned) strlen(s) + 1);
+ pp = p = malloc((unsigned) strlen(s) + 1);
if (pp == NULL) {
bdfError("Couldn't allocate property value string (%d)\n", strlen(s) + 1);
return None;
@@ -184,7 +184,7 @@ bdfGetPropertyValue(char *s)
if (*(s + 1) != '"') {
*p++ = 0;
atom = bdfForceMakeAtom(pp, NULL);
- xfree(pp);
+ free(pp);
return atom;
} else {
s++;
@@ -192,7 +192,7 @@ bdfGetPropertyValue(char *s)
}
*p++ = *s++;
}
- xfree (pp);
+ free (pp);
bdfError("unterminated quoted string property: %s\n", (pointer) orig_s);
return None;
}
diff --git a/src/bitmap/bitmapfunc.c b/src/bitmap/bitmapfunc.c
index 27f0cd1..80d7da1 100644
--- a/src/bitmap/bitmapfunc.c
+++ b/src/bitmap/bitmapfunc.c
@@ -148,7 +148,7 @@ BitmapOpenBitmap (FontPathElementPtr fpe, FontPtr *ppFont, int flags,
FontFileClose (file);
if (ret != Successful) {
- xfree(pFont);
+ free(pFont);
} else {
*ppFont = pFont;
}
diff --git a/src/bitmap/bitmaputil.c b/src/bitmap/bitmaputil.c
index 3487f7f..3a7bbc7 100644
--- a/src/bitmap/bitmaputil.c
+++ b/src/bitmap/bitmaputil.c
@@ -212,7 +212,7 @@ bitmapAddInkMetrics(FontPtr pFont)
int i;
bitmapFont = (BitmapFontPtr) pFont->fontPrivate;
- bitmapFont->ink_metrics = (xCharInfo *) xalloc(bitmapFont->num_chars * sizeof(xCharInfo));
+ bitmapFont->ink_metrics = malloc(bitmapFont->num_chars * sizeof(xCharInfo));
if (!bitmapFont->ink_metrics) {
fprintf(stderr, "Error: Couldn't allocate ink_metrics (%d*%ld)\n",
bitmapFont->num_chars, (unsigned long)sizeof(xCharInfo));
diff --git a/src/bitmap/bitscale.c b/src/bitmap/bitscale.c
index 4b90f5d..824023f 100644
--- a/src/bitmap/bitscale.c
+++ b/src/bitmap/bitscale.c
@@ -614,19 +614,19 @@ ComputeScaledProperties(FontInfoPtr sourceFontInfo, /* the font to be scaled */
}
nProps = NPROPS + 1 + sizeof(fontPropTable) / sizeof(fontProp) +
sizeof(rawFontPropTable) / sizeof(fontProp);
- fp = (FontPropPtr) xalloc(sizeof(FontPropRec) * nProps);
+ fp = malloc(sizeof(FontPropRec) * nProps);
*pProps = fp;
if (!fp) {
fprintf(stderr, "Error: Couldn't allocate font properties (%ld*%d)\n",
(unsigned long)sizeof(FontPropRec), nProps);
return 1;
}
- isStringProp = (char *) xalloc (nProps);
+ isStringProp = malloc (nProps);
*pIsStringProp = isStringProp;
if (!isStringProp)
{
fprintf(stderr, "Error: Couldn't allocate isStringProp (%d)\n", nProps);
- xfree (fp);
+ free (fp);
return 1;
}
ptr2 = name;
@@ -867,7 +867,7 @@ ScaleFont(FontPtr opf, /* originating font */
lastRow = opfi->lastRow;
}
- bitmapFont = (BitmapFontPtr) xalloc(sizeof(BitmapFontRec));
+ bitmapFont = malloc(sizeof(BitmapFontRec));
if (!bitmapFont) {
fprintf(stderr, "Error: Couldn't allocate bitmapFont (%ld)\n",
(unsigned long)sizeof(BitmapFontRec));
@@ -888,15 +888,13 @@ ScaleFont(FontPtr opf, /* originating font */
bitmapFont->encoding = 0;
bitmapFont->bitmapExtra = 0;
bitmapFont->pDefault = 0;
- bitmapFont->metrics = (CharInfoPtr) xalloc(nchars * sizeof(CharInfoRec));
+ bitmapFont->metrics = malloc(nchars * sizeof(CharInfoRec));
if (!bitmapFont->metrics) {
fprintf(stderr, "Error: Couldn't allocate metrics (%d*%ld)\n",
nchars, (unsigned long)sizeof(CharInfoRec));
goto bail;
}
- bitmapFont->encoding =
- (CharInfoPtr **) xcalloc(NUM_SEGMENTS(nchars),
- sizeof(CharInfoPtr*));
+ bitmapFont->encoding = calloc(NUM_SEGMENTS(nchars), sizeof(CharInfoPtr*));
if (!bitmapFont->encoding) {
fprintf(stderr, "Error: Couldn't allocate encoding (%d*%ld)\n",
nchars, (unsigned long)sizeof(CharInfoPtr));
@@ -974,8 +972,7 @@ ScaleFont(FontPtr opf, /* originating font */
if(!bitmapFont->encoding[SEGMENT_MAJOR(i)]) {
bitmapFont->encoding[SEGMENT_MAJOR(i)]=
- (CharInfoPtr*)xcalloc(BITMAP_FONT_SEGMENT_SIZE,
- sizeof(CharInfoPtr));
+ calloc(BITMAP_FONT_SEGMENT_SIZE, sizeof(CharInfoPtr));
if(!bitmapFont->encoding[SEGMENT_MAJOR(i)])
goto bail;
}
@@ -1117,15 +1114,15 @@ ScaleFont(FontPtr opf, /* originating font */
return pf;
bail:
if (pf)
- xfree(pf);
+ free(pf);
if (bitmapFont) {
- xfree(bitmapFont->metrics);
- xfree(bitmapFont->ink_metrics);
- xfree(bitmapFont->bitmaps);
+ free(bitmapFont->metrics);
+ free(bitmapFont->ink_metrics);
+ free(bitmapFont->bitmaps);
if(bitmapFont->encoding)
for(i=0; i<NUM_SEGMENTS(nchars); i++)
- xfree(bitmapFont->encoding[i]);
- xfree(bitmapFont->encoding);
+ free(bitmapFont->encoding[i]);
+ free(bitmapFont->encoding);
}
return NULL;
}
@@ -1206,23 +1203,19 @@ ScaleBitmap(FontPtr pFont, CharInfoPtr opci, CharInfoPtr pci,
/* Looks like we need to anti-alias. Create a workspace to
contain the grayscale character plus an additional row and
column for scratch */
- char_grayscale =
- (unsigned char *)xalloc((width + 1) * (height + 1));
+ char_grayscale = malloc((width + 1) * (height + 1));
if (char_grayscale)
{
- diffusion_workspace =
- (INT32 *)xalloc((newWidth + 2) * 2 * sizeof(int));
+ diffusion_workspace = calloc((newWidth + 2) * 2, sizeof(int));
if (!diffusion_workspace)
{
fprintf(stderr, "Warning: Couldn't allocate diffusion"
" workspace (%ld)\n",
(newWidth + 2) * 2 * (unsigned long)sizeof(int));
- xfree(char_grayscale);
+ free(char_grayscale);
char_grayscale = (unsigned char *)0;
}
/* Initialize our error diffusion workspace for later use */
- bzero((char *)diffusion_workspace + sizeof(INT32),
- (newWidth + 3) * sizeof(int));
thisrow = diffusion_workspace + 1;
nextrow = diffusion_workspace + newWidth + 3;
} else {
@@ -1472,8 +1465,8 @@ ScaleBitmap(FontPtr pFont, CharInfoPtr opci, CharInfoPtr pci,
if (char_grayscale)
{
- xfree(char_grayscale);
- xfree(diffusion_workspace);
+ free(char_grayscale);
+ free(diffusion_workspace);
}
}
@@ -1524,12 +1517,11 @@ BitmapScaleBitmaps(FontPtr pf, /* scaled font */
/* Will need to remember to free in the Unload routine */
- bitmapFont->bitmaps = (char *) xalloc(bytestoalloc);
+ bitmapFont->bitmaps = calloc(1, bytestoalloc);
if (!bitmapFont->bitmaps) {
fprintf(stderr, "Error: Couldn't allocate bitmaps (%d)\n", bytestoalloc);
goto bail;
}
- bzero(bitmapFont->bitmaps, bytestoalloc);
glyphBytes = bitmapFont->bitmaps;
for (i = 0; i < nchars; i++)
@@ -1547,15 +1539,15 @@ BitmapScaleBitmaps(FontPtr pf, /* scaled font */
bail:
if (pf)
- xfree(pf);
+ free(pf);
if (bitmapFont) {
- xfree(bitmapFont->metrics);
- xfree(bitmapFont->ink_metrics);
- xfree(bitmapFont->bitmaps);
+ free(bitmapFont->metrics);
+ free(bitmapFont->ink_metrics);
+ free(bitmapFont->bitmaps);
if(bitmapFont->encoding)
for(i=0; i<NUM_SEGMENTS(nchars); i++)
- xfree(bitmapFont->encoding[i]);
- xfree(bitmapFont->encoding);
+ free(bitmapFont->encoding[i]);
+ free(bitmapFont->encoding);
}
return NULL;
}
@@ -1698,18 +1690,18 @@ bitmapUnloadScalable (FontPtr pFont)
bitmapFont = (BitmapFontPtr) pFont->fontPrivate;
pfi = &pFont->info;
- xfree (pfi->props);
- xfree (pfi->isStringProp);
+ free (pfi->props);
+ free (pfi->isStringProp);
if(bitmapFont->encoding) {
nencoding = (pFont->info.lastCol - pFont->info.firstCol + 1) *
(pFont->info.lastRow - pFont->info.firstRow + 1);
for(i=0; i<NUM_SEGMENTS(nencoding); i++)
- xfree(bitmapFont->encoding[i]);
+ free(bitmapFont->encoding[i]);
}
- xfree (bitmapFont->encoding);
- xfree (bitmapFont->bitmaps);
- xfree (bitmapFont->ink_metrics);
- xfree (bitmapFont->metrics);
- xfree (pFont->fontPrivate);
+ free (bitmapFont->encoding);
+ free (bitmapFont->bitmaps);
+ free (bitmapFont->ink_metrics);
+ free (bitmapFont->metrics);
+ free (pFont->fontPrivate);
DestroyFontRec (pFont);
}
diff --git a/src/bitmap/pcfread.c b/src/bitmap/pcfread.c
index 2d4d19e..182144a 100644
--- a/src/bitmap/pcfread.c
+++ b/src/bitmap/pcfread.c
@@ -137,7 +137,7 @@ pcfReadTOC(FontFilePtr file, int *countp)
pcfError("pcfReadTOC(): invalid file format\n");
return NULL;
}
- tables = (PCFTablePtr) xalloc(count * sizeof(PCFTableRec));
+ tables = malloc(count * sizeof(PCFTableRec));
if (!tables) {
pcfError("pcfReadTOC(): Couldn't allocate tables (%d*%d)\n", count, sizeof(PCFTableRec));
return (PCFTablePtr) NULL;
@@ -154,7 +154,7 @@ pcfReadTOC(FontFilePtr file, int *countp)
return tables;
Bail:
- xfree(tables);
+ free(tables);
return (PCFTablePtr) NULL;
}
@@ -261,12 +261,12 @@ pcfGetProperties(FontInfoPtr pFontInfo, FontFilePtr file,
goto Bail;
}
if (IS_EOF(file)) goto Bail;
- props = (FontPropPtr) xalloc(nprops * sizeof(FontPropRec));
+ props = malloc(nprops * sizeof(FontPropRec));
if (!props) {
pcfError("pcfGetProperties(): Couldn't allocate props (%d*%d)\n", nprops, sizeof(FontPropRec));
goto Bail;
}
- isStringProp = (char *) xalloc(nprops * sizeof(char));
+ isStringProp = malloc(nprops * sizeof(char));
if (!isStringProp) {
pcfError("pcfGetProperties(): Couldn't allocate isStringProp (%d*%d)\n", nprops, sizeof(char));
goto Bail;
@@ -299,7 +299,7 @@ pcfGetProperties(FontInfoPtr pFontInfo, FontFilePtr file,
string_size = pcfGetINT32(file, format);
if (string_size < 0) goto Bail;
if (IS_EOF(file)) goto Bail;
- strings = (char *) xalloc(string_size);
+ strings = malloc(string_size);
if (!strings) {
pcfError("pcfGetProperties(): Couldn't allocate strings (%d)\n", string_size);
goto Bail;
@@ -315,14 +315,14 @@ pcfGetProperties(FontInfoPtr pFontInfo, FontFilePtr file,
strlen(strings + props[i].value), TRUE);
}
}
- xfree(strings);
+ free(strings);
pFontInfo->isStringProp = isStringProp;
pFontInfo->props = props;
pFontInfo->nprops = nprops;
return TRUE;
Bail:
- xfree(isStringProp);
- xfree(props);
+ free(isStringProp);
+ free(props);
return FALSE;
}
@@ -442,7 +442,7 @@ pcfReadFont(FontPtr pFont, FontFilePtr file,
pcfError("pcfReadFont(): invalid file format\n");
goto Bail;
}
- metrics = (CharInfoPtr) xalloc(nmetrics * sizeof(CharInfoRec));
+ metrics = malloc(nmetrics * sizeof(CharInfoRec));
if (!metrics) {
pcfError("pcfReadFont(): Couldn't allocate metrics (%d*%d)\n", nmetrics, sizeof(CharInfoRec));
goto Bail;
@@ -468,7 +468,7 @@ pcfReadFont(FontPtr pFont, FontFilePtr file,
if (nbitmaps != nmetrics || IS_EOF(file))
goto Bail;
/* nmetrics is already ok, so nbitmap also is */
- offsets = (CARD32 *) xalloc(nbitmaps * sizeof(CARD32));
+ offsets = malloc(nbitmaps * sizeof(CARD32));
if (!offsets) {
pcfError("pcfReadFont(): Couldn't allocate offsets (%d*%d)\n", nbitmaps, sizeof(CARD32));
goto Bail;
@@ -486,7 +486,7 @@ pcfReadFont(FontPtr pFont, FontFilePtr file,
sizebitmaps = bitmapSizes[PCF_GLYPH_PAD_INDEX(format)];
/* guard against completely empty font */
- bitmaps = xalloc(sizebitmaps ? sizebitmaps : 1);
+ bitmaps = malloc(sizebitmaps ? sizebitmaps : 1);
if (!bitmaps) {
pcfError("pcfReadFont(): Couldn't allocate bitmaps (%d)\n", sizebitmaps ? sizebitmaps : 1);
goto Bail;
@@ -517,7 +517,7 @@ pcfReadFont(FontPtr pFont, FontFilePtr file,
xCharInfo *metric;
sizepadbitmaps = bitmapSizes[PCF_SIZE_TO_INDEX(glyph)];
- padbitmaps = (char *) xalloc(sizepadbitmaps);
+ padbitmaps = malloc(sizepadbitmaps);
if (!padbitmaps) {
pcfError("pcfReadFont(): Couldn't allocate padbitmaps (%d)\n", sizepadbitmaps);
goto Bail;
@@ -532,13 +532,13 @@ pcfReadFont(FontPtr pFont, FontFilePtr file,
metric->rightSideBearing - metric->leftSideBearing,
metric->ascent + metric->descent);
}
- xfree(bitmaps);
+ free(bitmaps);
bitmaps = padbitmaps;
}
for (i = 0; i < nbitmaps; i++)
metrics[i].bits = bitmaps + offsets[i];
- xfree(offsets);
+ free(offsets);
offsets = NULL;
/* ink metrics ? */
@@ -558,7 +558,7 @@ pcfReadFont(FontPtr pFont, FontFilePtr file,
if (nink_metrics != nmetrics)
goto Bail;
/* nmetrics already checked */
- ink_metrics = (xCharInfo *) xalloc(nink_metrics * sizeof(xCharInfo));
+ ink_metrics = malloc(nink_metrics * sizeof(xCharInfo));
if (!ink_metrics) {
pcfError("pcfReadFont(): Couldn't allocate ink_metrics (%d*%d)\n", nink_metrics, sizeof(xCharInfo));
goto Bail;
@@ -594,8 +594,7 @@ pcfReadFont(FontPtr pFont, FontFilePtr file,
nencoding = (pFont->info.lastCol - pFont->info.firstCol + 1) *
(pFont->info.lastRow - pFont->info.firstRow + 1);
- encoding = (CharInfoPtr **) xcalloc(NUM_SEGMENTS(nencoding),
- sizeof(CharInfoPtr*));
+ encoding = calloc(NUM_SEGMENTS(nencoding), sizeof(CharInfoPtr*));
if (!encoding) {
pcfError("pcfReadFont(): Couldn't allocate encoding (%d*%d)\n", nencoding, sizeof(CharInfoPtr));
goto Bail;
@@ -610,8 +609,7 @@ pcfReadFont(FontPtr pFont, FontFilePtr file,
} else {
if(!encoding[SEGMENT_MAJOR(i)]) {
encoding[SEGMENT_MAJOR(i)]=
- (CharInfoPtr*)xcalloc(BITMAP_FONT_SEGMENT_SIZE,
- sizeof(CharInfoPtr));
+ calloc(BITMAP_FONT_SEGMENT_SIZE, sizeof(CharInfoPtr));
if(!encoding[SEGMENT_MAJOR(i)])
goto Bail;
}
@@ -625,7 +623,7 @@ pcfReadFont(FontPtr pFont, FontFilePtr file,
if (!pcfGetAccel (&pFont->info, file, tables, ntables, PCF_BDF_ACCELERATORS))
goto Bail;
- bitmapFont = (BitmapFontPtr) xalloc(sizeof *bitmapFont);
+ bitmapFont = malloc(sizeof *bitmapFont);
if (!bitmapFont) {
pcfError("pcfReadFont(): Couldn't allocate bitmapFont (%d)\n", sizeof *bitmapFont);
goto Bail;
@@ -664,24 +662,24 @@ pcfReadFont(FontPtr pFont, FontFilePtr file,
pFont->byte = byte;
pFont->glyph = glyph;
pFont->scan = scan;
- xfree(tables);
+ free(tables);
return Successful;
Bail:
- xfree(ink_metrics);
+ free(ink_metrics);
if(encoding) {
for(i=0; i<NUM_SEGMENTS(nencoding); i++)
- xfree(encoding[i]);
+ free(encoding[i]);
}
- xfree(encoding);
- xfree(bitmaps);
- xfree(metrics);
- xfree(pFont->info.props);
+ free(encoding);
+ free(bitmaps);
+ free(metrics);
+ free(pFont->info.props);
pFont->info.nprops = 0;
pFont->info.props = 0;
- xfree (pFont->info.isStringProp);
- xfree(bitmapFont);
- xfree(tables);
- xfree(offsets);
+ free (pFont->info.isStringProp);
+ free(bitmapFont);
+ free(tables);
+ free(offsets);
return AllocError;
}
@@ -749,13 +747,13 @@ pcfReadFontInfo(FontInfoPtr pFontInfo, FontFilePtr file)
if (!pcfGetAccel (pFontInfo, file, tables, ntables, PCF_BDF_ACCELERATORS))
goto Bail;
- xfree(tables);
+ free(tables);
return Successful;
Bail:
pFontInfo->nprops = 0;
- xfree (pFontInfo->props);
- xfree (pFontInfo->isStringProp);
- xfree(tables);
+ free (pFontInfo->props);
+ free (pFontInfo->isStringProp);
+ free(tables);
return AllocError;
}
@@ -766,18 +764,18 @@ pcfUnloadFont(FontPtr pFont)
int i,nencoding;
bitmapFont = (BitmapFontPtr) pFont->fontPrivate;
- xfree(bitmapFont->ink_metrics);
+ free(bitmapFont->ink_metrics);
if(bitmapFont->encoding) {
nencoding = (pFont->info.lastCol - pFont->info.firstCol + 1) *
(pFont->info.lastRow - pFont->info.firstRow + 1);
for(i=0; i<NUM_SEGMENTS(nencoding); i++)
- xfree(bitmapFont->encoding[i]);
- }
- xfree(bitmapFont->encoding);
- xfree(bitmapFont->bitmaps);
- xfree(bitmapFont->metrics);
- xfree(pFont->info.isStringProp);
- xfree(pFont->info.props);
- xfree(bitmapFont);
+ free(bitmapFont->encoding[i]);
+ }
+ free(bitmapFont->encoding);
+ free(bitmapFont->bitmaps);
+ free(bitmapFont->metrics);
+ free(pFont->info.isStringProp);
+ free(pFont->info.props);
+ free(bitmapFont);
DestroyFontRec(pFont);
}
diff --git a/src/bitmap/pcfwrite.c b/src/bitmap/pcfwrite.c
index 8d5e942..5d1aab1 100644
--- a/src/bitmap/pcfwrite.c
+++ b/src/bitmap/pcfwrite.c
@@ -236,7 +236,7 @@ pcfWriteFont(FontPtr pFont, FontFilePtr file)
ink_minbounds = &pFont->info.ink_minbounds;
ink_maxbounds = &pFont->info.ink_maxbounds;
}
- offsetProps = (FontPropPtr) xalloc(pFont->info.nprops * sizeof(FontPropRec));
+ offsetProps = malloc(pFont->info.nprops * sizeof(FontPropRec));
if (!offsetProps) {
pcfError("pcfWriteFont(): Couldn't allocate offsetProps (%d*%d)", pFont->info.nprops, sizeof(FontPropRec));
return AllocError;
@@ -358,7 +358,7 @@ pcfWriteFont(FontPtr pFont, FontFilePtr file)
if (current_position > table->offset) {
printf("can't go backwards... %d > %d\n",
(int)current_position, (int)table->offset);
- xfree(offsetProps);
+ free(offsetProps);
return BadFontName;
}
while (current_position < table->offset)
@@ -463,6 +463,6 @@ pcfWriteFont(FontPtr pFont, FontFilePtr file)
}
}
- xfree(offsetProps);
+ free(offsetProps);
return Successful;
}
diff --git a/src/bitmap/snfread.c b/src/bitmap/snfread.c
index b35073b..53a72da 100644
--- a/src/bitmap/snfread.c
+++ b/src/bitmap/snfread.c
@@ -147,14 +147,14 @@ snfReadProps(snfFontInfoPtr snfInfo, FontInfoPtr pFontInfo, FontFilePtr file)
bytestoalloc = snfInfo->nProps * sizeof(snfFontPropRec) +
BYTESOFSTRINGINFO(snfInfo);
- propspace = (char *) xalloc(bytestoalloc);
+ propspace = malloc(bytestoalloc);
if (!propspace) {
snfError("snfReadProps(): Couldn't allocate propspace (%d)\n", bytestoalloc);
return AllocError;
}
if (FontFileRead(file, propspace, bytestoalloc) != bytestoalloc) {
- xfree(propspace);
+ free(propspace);
return BadFontName;
}
psnfp = (snfFontPropPtr) propspace;
@@ -172,7 +172,7 @@ snfReadProps(snfFontInfoPtr snfInfo, FontInfoPtr pFontInfo, FontFilePtr file)
pfp->value = psnfp->value;
}
- xfree(propspace);
+ free(propspace);
return Successful;
}
@@ -266,16 +266,16 @@ snfReadFont(FontPtr pFont, FontFilePtr file,
if (fi.inkMetrics)
bytestoalloc += num_chars * sizeof(xCharInfo); /* ink_metrics */
- fontspace = (char *) xalloc(bytestoalloc);
+ fontspace = malloc(bytestoalloc);
if (!fontspace) {
snfError("snfReadFont(): Couldn't allocate fontspace (%d)\n", bytestoalloc);
return AllocError;
}
- bitmaps = (char *) xalloc (bitmapsSize);
+ bitmaps = malloc (bitmapsSize);
if (!bitmaps)
{
snfError("snfReadFont(): Couldn't allocate bitmaps (%d)\n", bitmapsSize);
- xfree (fontspace);
+ free (fontspace);
return AllocError;
}
/*
@@ -308,8 +308,7 @@ snfReadFont(FontPtr pFont, FontFilePtr file,
if (bitmapFont->metrics[i].bits) {
if (!bitmapFont->encoding[SEGMENT_MAJOR(i)]) {
bitmapFont->encoding[SEGMENT_MAJOR(i)]=
- (CharInfoPtr*)xcalloc(BITMAP_FONT_SEGMENT_SIZE,
- sizeof(CharInfoPtr));
+ calloc(BITMAP_FONT_SEGMENT_SIZE, sizeof(CharInfoPtr));
if (!bitmapFont->encoding[SEGMENT_MAJOR(i)]) {
ret = AllocError;
break;
@@ -320,12 +319,12 @@ snfReadFont(FontPtr pFont, FontFilePtr file,
}
if (ret != Successful) {
- xfree(bitmaps);
+ free(bitmaps);
if(bitmapFont->encoding) {
for(j=0; j<SEGMENT_MAJOR(i); j++)
- xfree(bitmapFont->encoding[i]);
+ free(bitmapFont->encoding[i]);
}
- xfree(fontspace);
+ free(fontspace);
return ret;
}
/*
@@ -333,8 +332,8 @@ snfReadFont(FontPtr pFont, FontFilePtr file,
*/
if (FontFileRead(file, bitmaps, bitmapsSize) != bitmapsSize) {
- xfree(bitmaps);
- xfree(fontspace);
+ free(bitmaps);
+ free(fontspace);
return BadFontName;
}
@@ -366,11 +365,11 @@ snfReadFont(FontPtr pFont, FontFilePtr file,
sizepadbitmaps += BYTES_FOR_GLYPH(metric,glyph);
metric++;
}
- padbitmaps = (char *) xalloc(sizepadbitmaps);
+ padbitmaps = malloc(sizepadbitmaps);
if (!padbitmaps) {
snfError("snfReadFont(): Couldn't allocate padbitmaps (%d)\n", sizepadbitmaps);
- xfree (bitmaps);
- xfree (fontspace);
+ free (bitmaps);
+ free (fontspace);
return AllocError;
}
metric = bitmapFont->metrics;
@@ -385,14 +384,14 @@ snfReadFont(FontPtr pFont, FontFilePtr file,
padbitmaps += sizechar;
metric++;
}
- xfree(bitmaps);
+ free(bitmaps);
}
/* now read and atom'ize properties */
ret = snfReadProps(&fi, &pFont->info, file);
if (ret != Successful) {
- xfree(fontspace);
+ free(fontspace);
return ret;
}
snfCopyInfo(&fi, &pFont->info);
@@ -406,7 +405,7 @@ snfReadFont(FontPtr pFont, FontFilePtr file,
for (i = 0; ret == Successful && i < num_chars; i++)
ret = snfReadxCharInfo(file, &bitmapFont->ink_metrics[i]);
if (ret != Successful) {
- xfree(fontspace);
+ free(fontspace);
return ret;
}
} else {
@@ -455,15 +454,15 @@ snfReadFontInfo(FontInfoPtr pFontInfo, FontFilePtr file)
return ret;
snfCopyInfo(&fi, pFontInfo);
- pFontInfo->props = (FontPropPtr) xalloc(fi.nProps * sizeof(FontPropRec));
+ pFontInfo->props = malloc(fi.nProps * sizeof(FontPropRec));
if (!pFontInfo->props) {
snfError("snfReadFontInfo(): Couldn't allocate props (%d*%d)\n", fi.nProps, sizeof(FontPropRec));
return AllocError;
}
- pFontInfo->isStringProp = (char *) xalloc(fi.nProps * sizeof(char));
+ pFontInfo->isStringProp = malloc(fi.nProps * sizeof(char));
if (!pFontInfo->isStringProp) {
snfError("snfReadFontInfo(): Couldn't allocate isStringProp (%d*%d)\n", fi.nProps, sizeof(char));
- xfree(pFontInfo->props);
+ free(pFontInfo->props);
return AllocError;
}
num_chars = n2dChars(&fi);
@@ -473,21 +472,21 @@ snfReadFontInfo(FontInfoPtr pFontInfo, FontFilePtr file)
ret = snfReadProps(&fi, pFontInfo, file);
if (ret != Successful) {
- xfree(pFontInfo->props);
- xfree(pFontInfo->isStringProp);
+ free(pFontInfo->props);
+ free(pFontInfo->isStringProp);
return ret;
}
if (fi.inkMetrics) {
ret = snfReadxCharInfo(file, &pFontInfo->ink_minbounds);
if (ret != Successful) {
- xfree(pFontInfo->props);
- xfree(pFontInfo->isStringProp);
+ free(pFontInfo->props);
+ free(pFontInfo->isStringProp);
return ret;
}
ret = snfReadxCharInfo(file, &pFontInfo->ink_maxbounds);
if (ret != Successful) {
- xfree(pFontInfo->props);
- xfree(pFontInfo->isStringProp);
+ free(pFontInfo->props);
+ free(pFontInfo->isStringProp);
return ret;
}
} else {
@@ -504,8 +503,8 @@ snfUnloadFont(FontPtr pFont)
BitmapFontPtr bitmapFont;
bitmapFont = (BitmapFontPtr) pFont->fontPrivate;
- xfree (bitmapFont->bitmaps);
- xfree (bitmapFont);
+ free (bitmapFont->bitmaps);
+ free (bitmapFont);
DestroyFontRec (pFont);
}
diff --git a/src/builtins/dir.c b/src/builtins/dir.c
index dd2ea1a..bf351b1 100644
--- a/src/builtins/dir.c
+++ b/src/builtins/dir.c
@@ -1,6 +1,4 @@
/*
- * Id: dir.c,v 1.2 1999/11/02 06:16:47 keithp Exp $
- *
* Copyright 1999 SuSE, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and its
@@ -22,7 +20,6 @@
*
* Author: Keith Packard, SuSE, Inc.
*/
-/* $XFree86: xc/lib/font/builtins/dir.c,v 1.3 1999/12/30 02:29:49 robin Exp $ */
#ifdef HAVE_CONFIG_H
#include <config.h>
@@ -39,17 +36,13 @@ BuiltinDirsDup (const BuiltinDirPtr a_dirs,
if (!a_dirs)
return NULL ;
- dirs = xcalloc (a_dirs_len, sizeof (BuiltinDirRec)) ;
+ dirs = calloc (a_dirs_len, sizeof (BuiltinDirRec)) ;
if (!dirs)
return NULL ;
for (i=0; i < a_dirs_len; i++) {
- int len = strlen (a_dirs[i].file_name) ;
- dirs[i].file_name = xcalloc (1, len+1) ;
- memmove (dirs[i].file_name, a_dirs[i].file_name, len);
- len = strlen (a_dirs[i].font_name) ;
- dirs[i].font_name = xcalloc (1, len+1) ;
- memmove (dirs[i].font_name, a_dirs[i].font_name, len);
+ dirs[i].file_name = strdup(a_dirs[i].file_name);
+ dirs[i].font_name = strdup(a_dirs[i].font_name);
}
return dirs ;
}
@@ -104,14 +97,12 @@ BuiltinAliasesDup (const BuiltinAliasPtr a_aliases,
if (!a_aliases)
return NULL ;
- aliases = xcalloc (a_aliases_len, sizeof (BuiltinAliasRec)) ;
+ aliases = calloc (a_aliases_len, sizeof (BuiltinAliasRec)) ;
if (!aliases)
return NULL ;
for (i=0; i < a_aliases_len; i++) {
- int len = strlen (a_aliases[i].font_name) ;
- aliases[i].font_name = xcalloc (1, len+1) ;
- memmove (aliases[i].font_name, a_aliases[i].font_name, len);
+ aliases[i].font_name = strdup(a_aliases[i].font_name);
}
return aliases ;
}
diff --git a/src/builtins/file.c b/src/builtins/file.c
index a46b0a6..f08f67f 100644
--- a/src/builtins/file.c
+++ b/src/builtins/file.c
@@ -87,7 +87,7 @@ BuiltinClose (BufFilePtr f, int unused)
{
BuiltinIOPtr io = ((BuiltinIOPtr) f->private);
- xfree (io);
+ free (io);
return 1;
}
@@ -105,7 +105,7 @@ BuiltinFileOpen (char *name)
break;
if (i == builtin_files_count)
return NULL;
- io = (BuiltinIOPtr) xalloc (sizeof (BuiltinIORec));
+ io = malloc (sizeof (BuiltinIORec));
if (!io)
return NULL;
io->offset = 0;
@@ -113,7 +113,7 @@ BuiltinFileOpen (char *name)
raw = BufFileCreate ((char *) io, BuiltinFill, 0, BuiltinSkip, BuiltinClose);
if (!raw)
{
- xfree (io);
+ free (io);
return NULL;
}
if ((cooked = BufFilePushZIP (raw)))
diff --git a/src/builtins/render.c b/src/builtins/render.c
index 871665f..52c24b9 100644
--- a/src/builtins/render.c
+++ b/src/builtins/render.c
@@ -50,7 +50,7 @@ BuiltinOpenBitmap (FontPathElementPtr fpe, FontPtr *ppFont, int flags,
file = BuiltinFileOpen (fileName);
if (!file)
return BadFontName;
- pFont = (FontPtr) xalloc(sizeof(FontRec));
+ pFont = malloc(sizeof(FontRec));
if (!pFont) {
BuiltinFileClose (file, 0);
return AllocError;
@@ -69,7 +69,7 @@ BuiltinOpenBitmap (FontPathElementPtr fpe, FontPtr *ppFont, int flags,
BuiltinFileClose (file, 0);
if (ret != Successful)
- xfree(pFont);
+ free(pFont);
else
*ppFont = pFont;
return ret;
diff --git a/src/fc/fsconvert.c b/src/fc/fsconvert.c
index 8cdda2a..724bc5f 100644
--- a/src/fc/fsconvert.c
+++ b/src/fc/fsconvert.c
@@ -108,8 +108,7 @@ _fs_convert_props(fsPropInfo *pi, fsPropOffset *po, pointer pd,
|| nprops > SIZE_MAX/(sizeof(FontPropRec) + sizeof(char)))
return -1;
- dprop = (FontPropPtr) xalloc(sizeof(FontPropRec) * nprops +
- sizeof (char) * nprops);
+ dprop = malloc(sizeof(FontPropRec) * nprops + sizeof (char) * nprops);
if (!dprop)
return -1;
@@ -132,7 +131,7 @@ _fs_convert_props(fsPropInfo *pi, fsPropOffset *po, pointer pd,
local_off.value.length, 1);
if (dprop->value == BAD_RESOURCE)
{
- xfree (pfi->props);
+ free (pfi->props);
pfi->nprops = 0;
pfi->props = 0;
pfi->isStringProp = 0;
@@ -150,7 +149,7 @@ _fs_free_props (FontInfoPtr pfi)
{
if (pfi->props)
{
- xfree (pfi->props);
+ free (pfi->props);
pfi->nprops = 0;
pfi->props = 0;
}
@@ -616,12 +615,12 @@ _fs_unload_font(FontPtr pfont)
* fsdata points at FSFontRec, FSFontDataRec and name
*/
if (encoding)
- xfree(encoding);
+ free(encoding);
while ((glyphs = fsdata->glyphs))
{
fsdata->glyphs = glyphs->next;
- xfree (glyphs);
+ free (glyphs);
}
/* XXX we may get called after the resource DB has been cleaned out */
@@ -630,7 +629,7 @@ _fs_unload_font(FontPtr pfont)
_fs_free_props (&pfont->info);
- xfree(fsdata);
+ free(fsdata);
DestroyFontRec(pfont);
}
@@ -650,9 +649,7 @@ fs_create_font (FontPathElementPtr fpe,
pfont = CreateFontRec ();
if (!pfont)
return 0;
- fsfont = (FSFontPtr) xalloc (sizeof (FSFontRec) +
- sizeof (FSFontDataRec) +
- namelen + 1);
+ fsfont = malloc (sizeof (FSFontRec) + sizeof (FSFontDataRec) + namelen + 1);
if (!fsfont)
{
DestroyFontRec (pfont);
@@ -703,7 +700,7 @@ fs_create_font (FontPathElementPtr fpe,
/* save the ID */
if (!StoreFontClientFont(pfont, fsd->fontid))
{
- xfree (fsfont);
+ free (fsfont);
DestroyFontRec (pfont);
return 0;
}
@@ -717,7 +714,7 @@ fs_alloc_glyphs (FontPtr pFont, int size)
FSGlyphPtr glyphs;
FSFontPtr fsfont = (FSFontPtr) pFont->fontPrivate;
- glyphs = xalloc (sizeof (FSGlyphRec) + size);
+ glyphs = malloc (sizeof (FSGlyphRec) + size);
glyphs->next = fsfont->glyphs;
fsfont->glyphs = glyphs;
return (pointer) (glyphs + 1);
diff --git a/src/fc/fserve.c b/src/fc/fserve.c
index 3980fb0..3aa7598 100644
--- a/src/fc/fserve.c
+++ b/src/fc/fserve.c
@@ -266,7 +266,7 @@ fs_close_conn(FSFpePtr conn)
for (client = conn->clients; client; client = nclient)
{
nclient = client->next;
- xfree (client);
+ free (client);
}
conn->clients = NULL;
}
@@ -411,7 +411,7 @@ fs_new_block_rec(FontPathElementPtr fpe, pointer client, int type)
size = 0;
break;
}
- blockrec = (FSBlockDataPtr) xalloc(sizeof(FSBlockDataRec) + size);
+ blockrec = malloc(sizeof(FSBlockDataRec) + size);
if (!blockrec)
return (FSBlockDataPtr) 0;
blockrec->data = (pointer) (blockrec + 1);
@@ -462,9 +462,9 @@ _fs_remove_block_rec(FSFpePtr conn, FSBlockDataPtr blockrec)
{
FSBlockedGlyphPtr bglyph = (FSBlockedGlyphPtr)blockrec->data;
if (bglyph->num_expected_ranges)
- xfree(bglyph->expected_ranges);
+ free(bglyph->expected_ranges);
}
- xfree(blockrec);
+ free(blockrec);
_fs_set_pending_reply (conn);
}
@@ -477,7 +477,7 @@ _fs_signal_clients_depending(FSClientsDependingPtr *clients_depending)
{
*clients_depending = p->next;
ClientSignal(p->client);
- xfree(p);
+ free(p);
}
}
@@ -493,7 +493,7 @@ _fs_add_clients_depending(FSClientsDependingPtr *clients_depending, pointer clie
return Suspended;
}
- new = (FSClientsDependingPtr)xalloc (sizeof (FSClientsDependingRec));
+ new = malloc (sizeof (FSClientsDependingRec));
if (!new)
return BadAlloc;
@@ -981,7 +981,7 @@ fs_read_extent_info(FontPathElementPtr fpe, FSBlockDataPtr blockrec)
numInfos *= 2;
haveInk = TRUE;
}
- ci = pCI = (CharInfoPtr) xalloc(sizeof(CharInfoRec) * numInfos);
+ ci = pCI = malloc(sizeof(CharInfoRec) * numInfos);
if (!pCI)
{
@@ -2156,7 +2156,7 @@ _fs_load_glyphs(pointer client, FontPtr pfont, Bool range_flag,
if (nranges)
{
_fs_clean_aborted_loadglyphs(pfont, nranges, ranges);
- xfree(ranges);
+ free(ranges);
}
return _fs_add_clients_depending(clients_depending, client);
}
@@ -2184,7 +2184,7 @@ _fs_load_glyphs(pointer client, FontPtr pfont, Bool range_flag,
/* Since we're not ready to send the load_glyphs request yet,
clean up the damage caused by the fs_build_range() call. */
_fs_clean_aborted_loadglyphs(pfont, nranges, ranges);
- xfree(ranges);
+ free(ranges);
/* Now try to reopen the font. */
return fs_send_open_font(client, pfont->fpe,
@@ -2571,7 +2571,7 @@ fs_client_died(pointer client, FontPathElementPtr fpe)
_fs_add_req_log(conn, FS_FreeAC);
_fs_write (conn, (char *) &freeac, sizeof (fsFreeACReq));
*prev = cur->next;
- xfree (cur);
+ free (cur);
break;
}
}
@@ -2625,7 +2625,7 @@ _fs_client_access (FSFpePtr conn, pointer client, Bool sync)
}
if (!cur)
{
- cur = (FSClientPtr) xalloc (sizeof (FSClientRec));
+ cur = malloc (sizeof (FSClientRec));
if (!cur)
return;
cur->client = client;
@@ -2810,15 +2810,14 @@ _fs_recv_conn_setup (FSFpePtr conn)
*/
if (conn->alts)
{
- xfree (conn->alts);
+ free (conn->alts);
conn->alts = 0;
conn->numAlts = 0;
}
if (setup->num_alternates)
{
- alts = (FSFpeAltPtr) xalloc (setup->num_alternates *
- sizeof (FSFpeAltRec) +
- (setup->alternate_len << 2));
+ alts = malloc (setup->num_alternates * sizeof (FSFpeAltRec) +
+ (setup->alternate_len << 2));
if (alts)
{
alt_names = (char *) (setup + 1);
@@ -3151,13 +3150,12 @@ _fs_init_conn (char *servername)
{
FSFpePtr conn;
- conn = xalloc (sizeof (FSFpeRec) + strlen (servername) + 1);
+ conn = calloc (1, sizeof (FSFpeRec) + strlen (servername) + 1);
if (!conn)
return 0;
- memset (conn, '\0', sizeof (FSFpeRec));
if (!_fs_io_init (conn))
{
- xfree (conn);
+ free (conn);
return 0;
}
conn->servername = (char *) (conn + 1);
@@ -3173,8 +3171,8 @@ _fs_free_conn (FSFpePtr conn)
_fs_close_server (conn);
_fs_io_fini (conn);
if (conn->alts)
- xfree (conn->alts);
- xfree (conn);
+ free (conn->alts);
+ free (conn);
}
/*
diff --git a/src/fc/fsio.c b/src/fc/fsio.c
index 2b55f85..cbb1a67 100644
--- a/src/fc/fsio.c
+++ b/src/fc/fsio.c
@@ -284,7 +284,7 @@ _fs_flush (FSFpePtr conn)
{
_fs_unmark_block (conn, FS_BROKEN_WRITE|FS_PENDING_WRITE);
if (conn->outBuf.size > FS_BUF_INC)
- conn->outBuf.buf = xrealloc (conn->outBuf.buf, FS_BUF_INC);
+ conn->outBuf.buf = realloc (conn->outBuf.buf, FS_BUF_INC);
conn->outBuf.remove = conn->outBuf.insert = 0;
}
return FSIO_READY;
@@ -310,7 +310,7 @@ _fs_resize (FSBufPtr buf, long size)
if (buf->size - buf->remove < size)
{
new_size = ((buf->remove + size + FS_BUF_INC) / FS_BUF_INC) * FS_BUF_INC;
- new = xrealloc (buf->buf, new_size);
+ new = realloc (buf->buf, new_size);
if (!new)
return FSIO_ERROR;
buf->buf = new;
@@ -327,7 +327,7 @@ _fs_downsize (FSBufPtr buf, long size)
buf->insert = buf->remove = 0;
if (buf->size > size)
{
- buf->buf = xrealloc (buf->buf, size);
+ buf->buf = realloc (buf->buf, size);
buf->size = size;
}
}
@@ -346,16 +346,16 @@ Bool
_fs_io_init (FSFpePtr conn)
{
conn->outBuf.insert = conn->outBuf.remove = 0;
- conn->outBuf.buf = xalloc (FS_BUF_INC);
+ conn->outBuf.buf = malloc (FS_BUF_INC);
if (!conn->outBuf.buf)
return FALSE;
conn->outBuf.size = FS_BUF_INC;
conn->inBuf.insert = conn->inBuf.remove = 0;
- conn->inBuf.buf = xalloc (FS_BUF_INC);
+ conn->inBuf.buf = malloc (FS_BUF_INC);
if (!conn->inBuf.buf)
{
- xfree (conn->outBuf.buf);
+ free (conn->outBuf.buf);
conn->outBuf.buf = 0;
return FALSE;
}
@@ -368,9 +368,9 @@ void
_fs_io_fini (FSFpePtr conn)
{
if (conn->outBuf.buf)
- xfree (conn->outBuf.buf);
+ free (conn->outBuf.buf);
if (conn->inBuf.buf)
- xfree (conn->inBuf.buf);
+ free (conn->inBuf.buf);
}
static int
diff --git a/src/fontfile/bitsource.c b/src/fontfile/bitsource.c
index ae27de8..d828ce8 100644
--- a/src/fontfile/bitsource.c
+++ b/src/fontfile/bitsource.c
@@ -51,7 +51,7 @@ FontFileRegisterBitmapSource (FontPathElementPtr fpe)
if (FontFileBitmapSources.count == FontFileBitmapSources.size)
{
newsize = FontFileBitmapSources.size + 4;
- new = (FontPathElementPtr *) xrealloc (FontFileBitmapSources.fpe, newsize * sizeof *new);
+ new = realloc (FontFileBitmapSources.fpe, newsize * sizeof *new);
if (!new)
return FALSE;
FontFileBitmapSources.size = newsize;
@@ -73,7 +73,7 @@ FontFileUnregisterBitmapSource (FontPathElementPtr fpe)
if (FontFileBitmapSources.count == 0)
{
FontFileBitmapSources.size = 0;
- xfree (FontFileBitmapSources.fpe);
+ free (FontFileBitmapSources.fpe);
FontFileBitmapSources.fpe = 0;
}
else
@@ -99,7 +99,7 @@ FontFileEmptyBitmapSource(void)
FontFileBitmapSources.count = 0;
FontFileBitmapSources.size = 0;
- xfree (FontFileBitmapSources.fpe);
+ free (FontFileBitmapSources.fpe);
FontFileBitmapSources.fpe = 0;
}
diff --git a/src/fontfile/bufio.c b/src/fontfile/bufio.c
index a5746e3..9eb00bc 100644
--- a/src/fontfile/bufio.c
+++ b/src/fontfile/bufio.c
@@ -51,7 +51,7 @@ BufFileCreate (char *private,
{
BufFilePtr f;
- f = (BufFilePtr) xalloc (sizeof *f);
+ f = malloc (sizeof *f);
if (!f)
return 0;
f->private = private;
@@ -201,6 +201,6 @@ BufFileClose (BufFilePtr f, int doClose)
{
int ret;
ret = (*f->close) (f, doClose);
- xfree (f);
+ free (f);
return ret;
}
diff --git a/src/fontfile/bunzip2.c b/src/fontfile/bunzip2.c
index 9964de6..d8b9321 100644
--- a/src/fontfile/bunzip2.c
+++ b/src/fontfile/bunzip2.c
@@ -54,7 +54,7 @@ BufFilePushBZIP2 (BufFilePtr f)
{
xzip_buf *x;
- x = (xzip_buf *) xalloc (sizeof (xzip_buf));
+ x = malloc (sizeof (xzip_buf));
if (!x) return NULL;
bzero(&(x->z), sizeof(bz_stream));
@@ -64,7 +64,7 @@ BufFilePushBZIP2 (BufFilePtr f)
0, /* verbosity: 0 silent, 4 max */
0); /* 0: go faster, 1: use less memory */
if (x->zstat != BZ_OK) {
- xfree(x);
+ free(x);
return NULL;
}
@@ -87,7 +87,7 @@ BufBzip2FileClose(BufFilePtr f, int flag)
xzip_buf *x = (xzip_buf *)f->private;
BZ2_bzDecompressEnd (&(x->z));
BufFileClose (x->f, flag);
- xfree (x);
+ free (x);
return 1;
}
diff --git a/src/fontfile/catalogue.c b/src/fontfile/catalogue.c
index d494236..3a04a75 100644
--- a/src/fontfile/catalogue.c
+++ b/src/fontfile/catalogue.c
@@ -61,8 +61,7 @@ CatalogueAddFPE (CataloguePtr cat, FontPathElementPtr fpe)
else
cat->fpeAlloc *= 2;
- new = xrealloc(cat->fpeList,
- cat->fpeAlloc * sizeof(FontPathElementPtr));
+ new = realloc(cat->fpeList, cat->fpeAlloc * sizeof(FontPathElementPtr));
if (new == NULL)
return AllocError;
@@ -115,8 +114,8 @@ CatalogueUnrefFPEs (FontPathElementPtr fpe)
if (subfpe->refcount == 0)
{
FontFileFreeFPE (subfpe);
- xfree(subfpe->name);
- xfree(subfpe);
+ free(subfpe->name);
+ free(subfpe);
}
}
@@ -150,7 +149,7 @@ CatalogueRescan (FontPathElementPtr fpe, Bool forceScan)
dir = opendir(path);
if (dir == NULL)
{
- xfree(cat);
+ free(cat);
return BadFontPath;
}
@@ -180,7 +179,7 @@ CatalogueRescan (FontPathElementPtr fpe, Bool forceScan)
len += strlen(attrib);
}
- subfpe = xalloc(sizeof *subfpe);
+ subfpe = malloc(sizeof *subfpe);
if (subfpe == NULL)
continue;
@@ -190,10 +189,10 @@ CatalogueRescan (FontPathElementPtr fpe, Bool forceScan)
* (which uses font->fpe->type) goes to CatalogueCloseFont. */
subfpe->type = fpe->type;
subfpe->name_length = len;
- subfpe->name = xalloc (len + 1);
+ subfpe->name = malloc (len + 1);
if (subfpe == NULL)
{
- xfree(subfpe);
+ free(subfpe);
continue;
}
@@ -207,15 +206,15 @@ CatalogueRescan (FontPathElementPtr fpe, Bool forceScan)
if (FontFileInitFPE (subfpe) != Successful)
{
- xfree(subfpe->name);
- xfree(subfpe);
+ free(subfpe->name);
+ free(subfpe);
continue;
}
if (CatalogueAddFPE(cat, subfpe) != Successful)
{
FontFileFreeFPE (subfpe);
- xfree(subfpe);
+ free(subfpe);
continue;
}
}
@@ -235,7 +234,7 @@ CatalogueInitFPE (FontPathElementPtr fpe)
{
CataloguePtr cat;
- cat = (CataloguePtr) xalloc(sizeof *cat);
+ cat = malloc(sizeof *cat);
if (cat == NULL)
return AllocError;
@@ -271,8 +270,8 @@ CatalogueFreeFPE (FontPathElementPtr fpe)
return FontFileFreeFPE (fpe);
CatalogueUnrefFPEs (fpe);
- xfree(cat->fpeList);
- xfree(cat);
+ free(cat->fpeList);
+ free(cat);
return Successful;
}
@@ -356,8 +355,7 @@ CatalogueStartListFonts(pointer client, FontPathElementPtr fpe,
CatalogueRescan (fpe, FALSE);
- data = (LFWIDataPtr) xalloc (sizeof *data +
- sizeof data->privates[0] * cat->fpeCount);
+ data = malloc (sizeof *data + sizeof data->privates[0] * cat->fpeCount);
if (!data)
return AllocError;
data->privates = (pointer *) (data + 1);
@@ -377,7 +375,7 @@ CatalogueStartListFonts(pointer client, FontPathElementPtr fpe,
bail:
for (j = 0; j < i; j++)
/* FIXME: we have no way to free the per-fpe privates. */;
- xfree (data);
+ free (data);
return AllocError;
}
@@ -402,7 +400,7 @@ CatalogueListNextFontWithInfo(pointer client, FontPathElementPtr fpe,
if (data->current == cat->fpeCount)
{
- xfree(data);
+ free(data);
return BadFontName;
}
@@ -439,7 +437,7 @@ CatalogueListNextFontOrAlias(pointer client, FontPathElementPtr fpe,
if (data->current == cat->fpeCount)
{
- xfree(data);
+ free(data);
return BadFontName;
}
diff --git a/src/fontfile/decompress.c b/src/fontfile/decompress.c
index a4c5468..cdfb492 100644
--- a/src/fontfile/decompress.c
+++ b/src/fontfile/decompress.c
@@ -162,7 +162,7 @@ BufFilePushCompressed (BufFilePtr f)
hsize = hsize_table[maxbits - 12];
extra = (1 << maxbits) * sizeof (char_type) +
hsize * sizeof (unsigned short);
- file = (CompressedFile *) xalloc (sizeof (CompressedFile) + extra);
+ file = malloc (sizeof (CompressedFile) + extra);
if (!file)
return 0;
file->file = f;
@@ -203,7 +203,7 @@ BufCompressedClose (BufFilePtr f, int doClose)
file = (CompressedFile *) f->private;
raw = file->file;
- xfree (file);
+ free (file);
BufFileClose (raw, doClose);
return 1;
}
diff --git a/src/fontfile/dirfile.c b/src/fontfile/dirfile.c
index 1489938..40692c8 100755
--- a/src/fontfile/dirfile.c
+++ b/src/fontfile/dirfile.c
@@ -378,7 +378,7 @@ lexAlias(FILE *file, char **lexToken)
char *nbuf;
nsize = tokenSize ? (tokenSize << 1) : 64;
- nbuf = (char *) xrealloc(tokenBuf, nsize);
+ nbuf = realloc(tokenBuf, nsize);
if (!nbuf)
return EALLOC;
tokenBuf = nbuf;
diff --git a/src/fontfile/fontdir.c b/src/fontfile/fontdir.c
index 00c7511..4d1baa9 100644
--- a/src/fontfile/fontdir.c
+++ b/src/fontfile/fontdir.c
@@ -51,7 +51,7 @@ FontFileInitTable (FontTablePtr table, int size)
return FALSE;
if (size)
{
- table->entries = (FontEntryPtr) xalloc(sizeof(FontEntryRec) * size);
+ table->entries = malloc(sizeof(FontEntryRec) * size);
if (!table->entries)
return FALSE;
}
@@ -70,26 +70,26 @@ FontFileFreeEntry (FontEntryPtr entry)
int i;
if (entry->name.name)
- xfree(entry->name.name);
+ free(entry->name.name);
entry->name.name = NULL;
switch (entry->type)
{
case FONT_ENTRY_SCALABLE:
- xfree (entry->u.scalable.fileName);
+ free (entry->u.scalable.fileName);
extra = entry->u.scalable.extra;
for (i = 0; i < extra->numScaled; i++)
if (extra->scaled[i].vals.ranges)
- xfree (extra->scaled[i].vals.ranges);
- xfree (extra->scaled);
- xfree (extra);
+ free (extra->scaled[i].vals.ranges);
+ free (extra->scaled);
+ free (extra);
break;
case FONT_ENTRY_BITMAP:
- xfree (entry->u.bitmap.fileName);
+ free (entry->u.bitmap.fileName);
entry->u.bitmap.fileName = NULL;
break;
case FONT_ENTRY_ALIAS:
- xfree (entry->u.alias.resolved);
+ free (entry->u.alias.resolved);
entry->u.alias.resolved = NULL;
break;
#ifdef NOTYET
@@ -106,7 +106,7 @@ FontFileFreeTable (FontTablePtr table)
for (i = 0; i < table->used; i++)
FontFileFreeEntry (&table->entries[i]);
- xfree (table->entries);
+ free (table->entries);
}
FontDirectoryPtr
@@ -136,19 +136,19 @@ FontFileMakeDir(char *dirName, int size)
if (dirlen) /* leave out slash for builtins */
#endif
needslash = 1;
- dir = (FontDirectoryPtr) xalloc(sizeof *dir + dirlen + needslash + 1 +
- (attriblen ? attriblen + 1 : 0));
+ dir = malloc(sizeof *dir + dirlen + needslash + 1 +
+ (attriblen ? attriblen + 1 : 0));
if (!dir)
return (FontDirectoryPtr)0;
if (!FontFileInitTable (&dir->scalable, 0))
{
- xfree (dir);
+ free (dir);
return (FontDirectoryPtr)0;
}
if (!FontFileInitTable (&dir->nonScalable, size))
{
FontFileFreeTable (&dir->scalable);
- xfree (dir);
+ free (dir);
return (FontDirectoryPtr)0;
}
dir->directory = (char *) (dir + 1);
@@ -172,7 +172,7 @@ FontFileFreeDir (FontDirectoryPtr dir)
{
FontFileFreeTable (&dir->scalable);
FontFileFreeTable (&dir->nonScalable);
- xfree(dir);
+ free(dir);
}
FontEntryPtr
@@ -186,8 +186,7 @@ FontFileAddEntry(FontTablePtr table, FontEntryPtr prototype)
return (FontEntryPtr) 0; /* "cannot" happen */
if (table->used == table->size) {
newsize = table->size + 100;
- entry = (FontEntryPtr) xrealloc(table->entries,
- newsize * sizeof(FontEntryRec));
+ entry = realloc(table->entries, newsize * sizeof(FontEntryRec));
if (!entry)
return (FontEntryPtr)0;
table->size = newsize;
@@ -195,7 +194,7 @@ FontFileAddEntry(FontTablePtr table, FontEntryPtr prototype)
}
entry = &table->entries[table->used];
*entry = *prototype;
- entry->name.name = (char *) xalloc(prototype->name.length + 1);
+ entry->name.name = malloc(prototype->name.length + 1);
if (!entry->name.name)
return (FontEntryPtr)0;
memcpy (entry->name.name, prototype->name.name, prototype->name.length);
@@ -439,7 +438,7 @@ FontFileSaveString (char *s)
{
char *n;
- n = (char *) xalloc (strlen (s) + 1);
+ n = malloc (strlen (s) + 1);
if (!n)
return 0;
strcpy (n, s);
@@ -695,7 +694,7 @@ FontFileAddFontFile (FontDirectoryPtr dir, char *fontName, char *fileName)
return FALSE;
if (!(bitmap = FontFileAddEntry (&dir->nonScalable, &entry)))
{
- xfree (entry.u.bitmap.fileName);
+ free (entry.u.bitmap.fileName);
return FALSE;
}
}
@@ -723,7 +722,7 @@ FontFileAddFontFile (FontDirectoryPtr dir, char *fontName, char *fileName)
{
existing->u.scalable.extra->defaults = vals;
- xfree (existing->u.scalable.fileName);
+ free (existing->u.scalable.fileName);
if (!(existing->u.scalable.fileName = FontFileSaveString (fileName)))
return FALSE;
}
@@ -738,10 +737,10 @@ FontFileAddFontFile (FontDirectoryPtr dir, char *fontName, char *fileName)
}
if (!(entry.u.scalable.fileName = FontFileSaveString (fileName)))
return FALSE;
- extra = (FontScalableExtraPtr) xalloc (sizeof (FontScalableExtraRec));
+ extra = malloc (sizeof (FontScalableExtraRec));
if (!extra)
{
- xfree (entry.u.scalable.fileName);
+ free (entry.u.scalable.fileName);
return FALSE;
}
bzero((char *)&extra->defaults, sizeof(extra->defaults));
@@ -791,8 +790,8 @@ FontFileAddFontFile (FontDirectoryPtr dir, char *fontName, char *fileName)
entry.u.scalable.extra = extra;
if (!(scalable = FontFileAddEntry (&dir->scalable, &entry)))
{
- xfree (extra);
- xfree (entry.u.scalable.fileName);
+ free (extra);
+ free (entry.u.scalable.fileName);
return FALSE;
}
if (vals.values_supplied & SIZE_SPECIFY_MASK)
@@ -826,7 +825,7 @@ FontFileAddFontAlias (FontDirectoryPtr dir, char *aliasName, char *fontName)
return FALSE;
if (!FontFileAddEntry (&dir->nonScalable, &entry))
{
- xfree (entry.u.alias.resolved);
+ free (entry.u.alias.resolved);
return FALSE;
}
return TRUE;
diff --git a/src/fontfile/fontfile.c b/src/fontfile/fontfile.c
index f900f75..d502569 100644
--- a/src/fontfile/fontfile.c
+++ b/src/fontfile/fontfile.c
@@ -325,7 +325,7 @@ FontFileOpenFont (pointer client, FontPathElementPtr fpe, Mask flags,
if (ret != BadFontName)
{
- if (ranges) xfree(ranges);
+ if (ranges) free(ranges);
return ret;
}
@@ -476,7 +476,7 @@ FontFileOpenFont (pointer client, FontPathElementPtr fpe, Mask flags,
ret = BadFontName;
if (ranges)
- xfree(ranges);
+ free(ranges);
return ret;
}
@@ -730,7 +730,7 @@ _FontFileListFonts (pointer client, FontPathElementPtr fpe,
scaleNames = MakeFontNamesRecord (0);
if (!scaleNames)
{
- if (ranges) xfree(ranges);
+ if (ranges) free(ranges);
return AllocError;
}
FontFileFindNamesInScalableDir (&dir->scalable, &zeroName, max,
@@ -747,7 +747,7 @@ _FontFileListFonts (pointer client, FontPathElementPtr fpe,
scaleNames = MakeFontNamesRecord (0);
if (!scaleNames)
{
- if (ranges) xfree(ranges);
+ if (ranges) free(ranges);
return AllocError;
}
FontFileFindNamesInScalableDir (&dir->nonScalable, &zeroName,
@@ -760,7 +760,7 @@ _FontFileListFonts (pointer client, FontPathElementPtr fpe,
&max);
FreeFontNames (scaleNames);
- if (ranges) xfree(ranges);
+ if (ranges) free(ranges);
}
else
{
@@ -802,13 +802,13 @@ FontFileStartListFonts(pointer client, FontPathElementPtr fpe,
LFWIDataPtr data;
int ret;
- data = (LFWIDataPtr) xalloc (sizeof *data);
+ data = malloc (sizeof *data);
if (!data)
return AllocError;
data->names = MakeFontNamesRecord (0);
if (!data->names)
{
- xfree (data);
+ free (data);
return AllocError;
}
ret = _FontFileListFonts (client, fpe, pat, len,
@@ -816,7 +816,7 @@ FontFileStartListFonts(pointer client, FontPathElementPtr fpe,
if (ret != Successful)
{
FreeFontNames (data->names);
- xfree (data);
+ free (data);
return ret;
}
data->current = 0;
@@ -928,7 +928,7 @@ FontFileListOneFontWithInfo (pointer client, FontPathElementPtr fpe,
if (ret != BadFontName)
{
- if (ranges) xfree(ranges);
+ if (ranges) free(ranges);
return ret;
}
@@ -1034,7 +1034,7 @@ FontFileListOneFontWithInfo (pointer client, FontPathElementPtr fpe,
(fpe, *pFontInfo, entry, fileName);
}
if (ranges) {
- xfree(ranges);
+ free(ranges);
ranges = NULL;
}
}
@@ -1048,7 +1048,7 @@ FontFileListOneFontWithInfo (pointer client, FontPathElementPtr fpe,
ret = BadFontName;
if (ranges)
- xfree(ranges);
+ free(ranges);
return ret;
}
@@ -1066,7 +1066,7 @@ FontFileListNextFontWithInfo(pointer client, FontPathElementPtr fpe,
if (data->current == data->names->nnames)
{
FreeFontNames (data->names);
- xfree (data);
+ free (data);
return BadFontName;
}
name = data->names->names[data->current];
@@ -1102,7 +1102,7 @@ FontFileListNextFontOrAlias(pointer client, FontPathElementPtr fpe,
if (data->current == data->names->nnames)
{
FreeFontNames (data->names);
- xfree (data);
+ free (data);
return BadFontName;
}
name = data->names->names[data->current];
diff --git a/src/fontfile/fontscale.c b/src/fontfile/fontscale.c
index a6eafc7..8002dde 100644
--- a/src/fontfile/fontscale.c
+++ b/src/fontfile/fontscale.c
@@ -51,8 +51,7 @@ FontFileAddScaledInstance (FontEntryPtr entry, FontScalablePtr vals,
if (extra->numScaled == extra->sizeScaled)
{
newsize = extra->sizeScaled + 4;
- new = (FontScaledPtr) xrealloc (extra->scaled,
- newsize * sizeof (FontScaledRec));
+ new = realloc (extra->scaled, newsize * sizeof (FontScaledRec));
if (!new)
return FALSE;
extra->sizeScaled = newsize;
@@ -107,7 +106,7 @@ FontFileRemoveScaledInstance (FontEntryPtr entry, FontPtr pFont)
if (extra->scaled[i].pFont == pFont)
{
if (extra->scaled[i].vals.ranges)
- xfree (extra->scaled[i].vals.ranges);
+ free (extra->scaled[i].vals.ranges);
extra->numScaled--;
for (; i < extra->numScaled; i++)
extra->scaled[i] = extra->scaled[i+1];
diff --git a/src/fontfile/gunzip.c b/src/fontfile/gunzip.c
index 8c9c317..6cf192b 100644
--- a/src/fontfile/gunzip.c
+++ b/src/fontfile/gunzip.c
@@ -29,7 +29,7 @@ BufFilePushZIP (BufFilePtr f)
{
xzip_buf *x;
- x = (xzip_buf *) xalloc (sizeof (xzip_buf));
+ x = malloc (sizeof (xzip_buf));
if (!x) return 0;
/* these are just for raw calloc/free */
x->z.zalloc = Z_NULL;
@@ -46,7 +46,7 @@ BufFilePushZIP (BufFilePtr f)
zlib header checking [undocumented, for gzip compatibility only?] */
x->zstat = inflateInit2(&(x->z), -MAX_WBITS);
if (x->zstat != Z_OK) {
- xfree(x);
+ free(x);
return 0;
}
@@ -57,7 +57,7 @@ BufFilePushZIP (BufFilePtr f)
x->z.avail_in = 0;
if (BufCheckZipHeader(x->f)) {
- xfree(x);
+ free(x);
return 0;
}
@@ -74,7 +74,7 @@ BufZipFileClose(BufFilePtr f, int flag)
xzip_buf *x = (xzip_buf *)f->private;
inflateEnd (&(x->z));
BufFileClose (x->f, flag);
- xfree (x);
+ free (x);
return 1;
}
diff --git a/src/fontfile/renderers.c b/src/fontfile/renderers.c
index f110ba8..bdbdab0 100644
--- a/src/fontfile/renderers.c
+++ b/src/fontfile/renderers.c
@@ -62,7 +62,7 @@ FontFilePriorityRegisterRenderer (FontRendererPtr renderer, int priority)
rendererGeneration = serverGeneration;
renderers.number = 0;
if (renderers.renderers)
- xfree(renderers.renderers);
+ free(renderers.renderers);
renderers.renderers = NULL;
}
@@ -84,7 +84,7 @@ FontFilePriorityRegisterRenderer (FontRendererPtr renderer, int priority)
}
if(i >= renderers.number) {
- new = xrealloc (renderers.renderers, sizeof(*new) * (i + 1));
+ new = realloc (renderers.renderers, sizeof(*new) * (i + 1));
if (!new)
return FALSE;
renderers.renderers = new;
diff --git a/src/util/atom.c b/src/util/atom.c
index b770dc9..bfb05cc 100644
--- a/src/util/atom.c
+++ b/src/util/atom.c
@@ -84,14 +84,13 @@ ResizeHashTable (void)
newHashSize = 1024;
else
newHashSize = hashSize * 2;
- newHashTable = (AtomListPtr *) xalloc (newHashSize * sizeof (AtomListPtr));
+ newHashTable = calloc (newHashSize, sizeof (AtomListPtr));
if (!newHashTable) {
fprintf(stderr, "ResizeHashTable(): Error: Couldn't allocate"
" newHashTable (%ld)\n",
newHashSize * (unsigned long)sizeof (AtomListPtr));
return FALSE;
}
- bzero ((char *) newHashTable, newHashSize * sizeof (AtomListPtr));
newHashMask = newHashSize - 1;
newRehash = (newHashMask - 2);
for (i = 0; i < hashSize; i++)
@@ -111,7 +110,7 @@ ResizeHashTable (void)
newHashTable[h] = hashTable[i];
}
}
- xfree (hashTable);
+ free (hashTable);
hashTable = newHashTable;
hashSize = newHashSize;
hashMask = newHashMask;
@@ -127,7 +126,7 @@ ResizeReverseMap (void)
reverseMapSize = 1000;
else
reverseMapSize *= 2;
- reverseMap = (AtomListPtr *) xrealloc (reverseMap, reverseMapSize * sizeof (AtomListPtr));
+ reverseMap = realloc (reverseMap, reverseMapSize * sizeof (AtomListPtr));
if (!reverseMap) {
fprintf(stderr, "ResizeReverseMap(): Error: Couldn't reallocate"
" reverseMap (%ld)\n",
@@ -187,7 +186,7 @@ MakeAtom(char *string, unsigned len, int makeit)
}
if (!makeit)
return None;
- a = (AtomListPtr) xalloc (sizeof (AtomListRec) + len + 1);
+ a = malloc (sizeof (AtomListRec) + len + 1);
if (a == NULL) {
fprintf(stderr, "MakeAtom(): Error: Couldn't allocate AtomListRec"
" (%ld)\n", (unsigned long)sizeof (AtomListRec) + len + 1);
diff --git a/src/util/fontnames.c b/src/util/fontnames.c
index 2d3a517..d03cea7 100644
--- a/src/util/fontnames.c
+++ b/src/util/fontnames.c
@@ -49,11 +49,11 @@ FreeFontNames(FontNamesPtr pFN)
if (!pFN)
return;
for (i = 0; i < pFN->nnames; i++) {
- xfree(pFN->names[i]);
+ free(pFN->names[i]);
}
- xfree(pFN->names);
- xfree(pFN->length);
- xfree(pFN);
+ free(pFN->names);
+ free(pFN->length);
+ free(pFN);
}
FontNamesPtr
@@ -61,18 +61,18 @@ MakeFontNamesRecord(unsigned int size)
{
FontNamesPtr pFN;
- pFN = (FontNamesPtr) xalloc(sizeof(FontNamesRec));
+ pFN = malloc(sizeof(FontNamesRec));
if (pFN) {
pFN->nnames = 0;
pFN->size = size;
if (size)
{
- pFN->length = (int *) xalloc(size * sizeof(int));
- pFN->names = (char **) xalloc(size * sizeof(char *));
+ pFN->length = malloc(size * sizeof(int));
+ pFN->names = malloc(size * sizeof(char *));
if (!pFN->length || !pFN->names) {
- xfree(pFN->length);
- xfree(pFN->names);
- xfree(pFN);
+ free(pFN->length);
+ free(pFN->names);
+ free(pFN);
pFN = (FontNamesPtr) 0;
}
}
@@ -91,7 +91,7 @@ AddFontNamesName(FontNamesPtr names, char *name, int length)
int index = names->nnames;
char *nelt;
- nelt = (char *) xalloc(length + 1);
+ nelt = malloc(length + 1);
if (!nelt)
return AllocError;
if (index >= names->size) {
@@ -101,16 +101,16 @@ AddFontNamesName(FontNamesPtr names, char *name, int length)
if (size == 0)
size = 8;
- nlength = (int *) xrealloc(names->length, size * sizeof(int));
- nnames = (char **) xrealloc(names->names, size * sizeof(char *));
+ nlength = realloc(names->length, size * sizeof(int));
+ nnames = realloc(names->names, size * sizeof(char *));
if (nlength && nnames) {
names->size = size;
names->length = nlength;
names->names = nnames;
} else {
- xfree(nelt);
- xfree(nlength);
- xfree(nnames);
+ free(nelt);
+ free(nlength);
+ free(nnames);
return AllocError;
}
}
diff --git a/src/util/fontutil.c b/src/util/fontutil.c
index 05fe5c2..181b1b2 100644
--- a/src/util/fontutil.c
+++ b/src/util/fontutil.c
@@ -149,7 +149,7 @@ QueryTextExtents(FontPtr pFont,
unsigned char defc[2];
int firstReal;
- charinfo = (xCharInfo **) xalloc(count * sizeof(xCharInfo *));
+ charinfo = malloc(count * sizeof(xCharInfo *));
if (!charinfo)
return FALSE;
encoding = TwoD16Bit;
@@ -188,7 +188,7 @@ QueryTextExtents(FontPtr pFont,
QueryGlyphExtents(pFont, (CharInfoPtr*) charinfo + firstReal,
n - firstReal, info);
pFont->info.constantMetrics = cm;
- xfree(charinfo);
+ free(charinfo);
return TRUE;
}
@@ -315,15 +315,13 @@ add_range(fsRange *newrange,
/* Grow the list if necessary */
if (*nranges == 0 || *range == (fsRange *)0)
{
- *range = (fsRange *)xalloc(range_alloc_granularity *
- SIZEOF(fsRange));
+ *range = malloc(range_alloc_granularity * SIZEOF(fsRange));
*nranges = 0;
}
else if (!(*nranges % range_alloc_granularity))
{
- *range = (fsRange *)xrealloc((char *)*range,
- (*nranges + range_alloc_granularity) *
- SIZEOF(fsRange));
+ *range = realloc(*range, (*nranges + range_alloc_granularity) *
+ SIZEOF(fsRange));
}
/* If alloc failed, just return a null list */
diff --git a/src/util/miscutil.c b/src/util/miscutil.c
index c44527a..6e5d52e 100644
--- a/src/util/miscutil.c
+++ b/src/util/miscutil.c
@@ -43,10 +43,6 @@ from The Open Group.
#ifdef __SUNPRO_C
#pragma weak serverGeneration
-#pragma weak Xalloc
-#pragma weak Xrealloc
-#pragma weak Xfree
-#pragma weak Xcalloc
#pragma weak CopyISOLatin1Lowered
#pragma weak register_fpe_functions
#endif
@@ -54,34 +50,6 @@ from The Open Group.
/* make sure everything initializes themselves at least once */
weak long serverGeneration = 1;
-weak void *
-Xalloc (unsigned long m)
-{
- return malloc (m);
-}
-
-weak void *
-Xrealloc (void *n, unsigned long m)
-{
- if (!n)
- return malloc (m);
- else
- return realloc (n, m);
-}
-
-weak void
-Xfree (void *n)
-{
- if (n)
- free (n);
-}
-
-weak void *
-Xcalloc (unsigned long n)
-{
- return calloc (n, 1);
-}
-
weak void
CopyISOLatin1Lowered (char *dst, char *src, int len)
{
diff --git a/src/util/patcache.c b/src/util/patcache.c
index 0351b1a..5411810 100644
--- a/src/util/patcache.c
+++ b/src/util/patcache.c
@@ -77,7 +77,7 @@ EmptyFontPatternCache (FontPatternCachePtr cache)
cache->entries[i].next = &cache->entries[i+1];
cache->entries[i].prev = 0;
cache->entries[i].pFont = 0;
- xfree (cache->entries[i].pattern);
+ free (cache->entries[i].pattern);
cache->entries[i].pattern = 0;
cache->entries[i].patlen = 0;
}
@@ -91,7 +91,7 @@ MakeFontPatternCache (void)
{
FontPatternCachePtr cache;
int i;
- cache = (FontPatternCachePtr) xalloc (sizeof *cache);
+ cache = malloc (sizeof *cache);
if (!cache)
return 0;
for (i = 0; i < NENTRIES; i++) {
@@ -110,8 +110,8 @@ FreeFontPatternCache (FontPatternCachePtr cache)
int i;
for (i = 0; i < NENTRIES; i++)
- xfree (cache->entries[i].pattern);
- xfree (cache);
+ free (cache->entries[i].pattern);
+ free (cache);
}
/* compute id for string */
@@ -139,7 +139,7 @@ CacheFontPattern (FontPatternCachePtr cache,
char *newpat;
int i;
- newpat = (char *) xalloc (patlen);
+ newpat = malloc (patlen);
if (!newpat)
return;
if (cache->free)
@@ -157,7 +157,7 @@ CacheFontPattern (FontPatternCachePtr cache,
if (e->next)
e->next->prev = e->prev;
*e->prev = e->next;
- xfree (e->pattern);
+ free (e->pattern);
}
/* set pattern */
memcpy (newpat, pattern, patlen);
@@ -214,7 +214,7 @@ RemoveCachedFontPattern (FontPatternCachePtr cache,
*e->prev = e->next;
e->next = cache->free;
cache->free = e;
- xfree (e->pattern);
+ free (e->pattern);
e->pattern = 0;
}
}
diff --git a/src/util/private.c b/src/util/private.c
index 85e90e5..6b760b4 100644
--- a/src/util/private.c
+++ b/src/util/private.c
@@ -53,7 +53,7 @@ CreateFontRec (void)
size = sizeof(FontRec) + (sizeof(pointer) * _FontPrivateAllocateIndex);
- pFont = (FontPtr)xalloc(size);
+ pFont = malloc(size);
if(pFont) {
bzero((char*)pFont, size);
@@ -69,8 +69,8 @@ void
DestroyFontRec (FontPtr pFont)
{
if (pFont->devPrivates && pFont->devPrivates != (pointer)(&pFont[1]))
- xfree(pFont->devPrivates);
- xfree(pFont);
+ free(pFont->devPrivates);
+ free(pFont);
}
void
@@ -86,11 +86,12 @@ _FontSetNewPrivate (FontPtr pFont, int n, pointer ptr)
if (n > pFont->maxPrivate) {
if (pFont->devPrivates && pFont->devPrivates != (pointer)(&pFont[1])) {
- new = (pointer *) xrealloc (pFont->devPrivates, (n + 1) * sizeof (pointer));
+ new = realloc (pFont->devPrivates, (n + 1) * sizeof (pointer));
if (!new)
return FALSE;
} else {
- new = (pointer *) xalloc ((n + 1) * sizeof (pointer));
+ /* omg realloc */
+ new = malloc ((n + 1) * sizeof (pointer));
if (!new)
return FALSE;
if (pFont->devPrivates)