summaryrefslogtreecommitdiff
path: root/src/util
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 /src/util
parent632a2e90a4b209facc84d7a18873f19a720ea7df (diff)
xalloc -> malloc, etc.
Diffstat (limited to 'src/util')
-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
6 files changed, 38 insertions, 72 deletions
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)