Commit d7e1965a authored by Behdad Esfahbod's avatar Behdad Esfahbod

Remove memory accounting and reporting

That belongs in tools like cairo/util/malloc-stat.so
parent d823bb3c
......@@ -78,7 +78,6 @@ FcAtomicCreate (const FcChar8 *file)
FcAtomic *atomic = malloc (total_len);
if (!atomic)
return 0;
FcMemAlloc (FC_MEM_ATOMIC, total_len);
atomic->file = (FcChar8 *) (atomic + 1);
strcpy ((char *) atomic->file, (char *) file);
......@@ -223,11 +222,6 @@ FcAtomicUnlock (FcAtomic *atomic)
void
FcAtomicDestroy (FcAtomic *atomic)
{
FcMemFree (FC_MEM_ATOMIC, sizeof (FcAtomic) +
strlen ((char *) atomic->file) * 4 + 4 +
sizeof (NEW_NAME) + sizeof (LCK_NAME) +
sizeof (TMP_NAME));
free (atomic);
}
#define __fcatomic__
......
......@@ -32,7 +32,6 @@ FcBlanksCreate (void)
b = malloc (sizeof (FcBlanks));
if (!b)
return 0;
FcMemAlloc (FC_MEM_BLANKS, sizeof (FcBlanks));
b->nblank = 0;
b->sblank = 0;
b->blanks = 0;
......@@ -43,11 +42,7 @@ void
FcBlanksDestroy (FcBlanks *b)
{
if (b->blanks)
{
FcMemFree (FC_MEM_BLANKS, b->sblank * sizeof (FcChar32));
free (b->blanks);
}
FcMemFree (FC_MEM_BLANKS, sizeof (FcBlanks));
free (b);
}
......@@ -70,9 +65,6 @@ FcBlanksAdd (FcBlanks *b, FcChar32 ucs4)
c = (FcChar32 *) malloc (sblank * sizeof (FcChar32));
if (!c)
return FcFalse;
if (b->sblank)
FcMemFree (FC_MEM_BLANKS, b->sblank * sizeof (FcChar32));
FcMemAlloc (FC_MEM_BLANKS, sblank * sizeof (FcChar32));
b->sblank = sblank;
b->blanks = c;
}
......
......@@ -47,7 +47,6 @@ FcConfigCreate (void)
config = malloc (sizeof (FcConfig));
if (!config)
goto bail0;
FcMemAlloc (FC_MEM_CONFIG, sizeof (FcConfig));
config->configDirs = FcStrSetCreate ();
if (!config->configDirs)
......@@ -115,7 +114,6 @@ bail2:
FcStrSetDestroy (config->configDirs);
bail1:
free (config);
FcMemFree (FC_MEM_CONFIG, sizeof (FcConfig));
bail0:
return 0;
}
......@@ -190,7 +188,6 @@ FcSubstDestroy (FcSubst *s)
if (s->edit)
FcEditDestroy (s->edit);
free (s);
FcMemFree (FC_MEM_SUBST, sizeof (FcSubst));
s = n;
}
}
......@@ -205,7 +202,6 @@ FcConfigAllocExpr (FcConfig *config)
new_page = malloc (sizeof (FcExprPage));
if (!new_page)
return 0;
FcMemAlloc (FC_MEM_EXPR, sizeof (FcExprPage));
new_page->next_page = config->expr_pool;
new_page->next = new_page->exprs;
......@@ -265,13 +261,11 @@ FcConfigDestroy (FcConfig *config)
while (page)
{
FcExprPage *next = page->next_page;
FcMemFree (FC_MEM_EXPR, sizeof (FcExprPage));
free (page);
page = next;
}
free (config);
FcMemFree (FC_MEM_CONFIG, sizeof (FcConfig));
}
/*
......@@ -640,7 +634,6 @@ FcConfigAddEdit (FcConfig *config,
subst = (FcSubst *) malloc (sizeof (FcSubst));
if (!subst)
return FcFalse;
FcMemAlloc (FC_MEM_SUBST, sizeof (FcSubst));
for (; *prev; prev = &(*prev)->next);
*prev = subst;
subst->next = 0;
......@@ -1054,7 +1047,6 @@ FcConfigEvaluate (FcPattern *p, FcExpr *e)
m = malloc (sizeof (FcMatrix));
if (m)
{
FcMemAlloc (FC_MEM_MATRIX, sizeof (FcMatrix));
FcMatrixMultiply (m, vl.u.m, vr.u.m);
v.u.m = m;
}
......@@ -1256,7 +1248,6 @@ FcConfigValues (FcPattern *p, FcExpr *e, FcValueBinding binding)
l = (FcValueList *) malloc (sizeof (FcValueList));
if (!l)
return 0;
FcMemAlloc (FC_MEM_VALLIST, sizeof (FcValueList));
if (FC_OP_GET_OP (e->op) == FcOpComma)
{
l->value = FcConfigEvaluate (p, e->u.tree.left);
......@@ -1272,7 +1263,6 @@ FcConfigValues (FcPattern *p, FcExpr *e, FcValueBinding binding)
{
FcValueList *next = FcValueListNext(l);
FcMemFree (FC_MEM_VALLIST, sizeof (FcValueList));
free (l);
l = next;
}
......@@ -1467,7 +1457,6 @@ FcConfigSubstituteWithPat (FcConfig *config,
st = (FcSubState *) malloc (config->maxObjects * sizeof (FcSubState));
if (!st && config->maxObjects)
return FcFalse;
FcMemAlloc (FC_MEM_SUBSTATE, config->maxObjects * sizeof (FcSubState));
if (FcDebug () & FC_DBG_EDIT)
{
......@@ -1653,7 +1642,6 @@ FcConfigSubstituteWithPat (FcConfig *config,
FcPatternPrint (p);
}
}
FcMemFree (FC_MEM_SUBSTATE, config->maxObjects * sizeof (FcSubState));
free (st);
if (FcDebug () & FC_DBG_EDIT)
{
......@@ -1766,7 +1754,6 @@ FcConfigFileExists (const FcChar8 *dir, const FcChar8 *file)
#endif
strcat ((char *) path, (char *) file);
FcMemAlloc (FC_MEM_STRING, osize);
if (access ((char *) path, R_OK) == 0)
return path;
......@@ -1891,7 +1878,6 @@ FcConfigXdgCacheHome (void)
ret = malloc (len + 7 + 1);
if (ret)
{
FcMemAlloc (FC_MEM_STRING, len + 7 + 1);
memcpy (ret, home, len);
memcpy (&ret[len], FC_DIR_SEPARATOR_S ".cache", 7);
ret[len + 7] = 0;
......@@ -1917,7 +1903,6 @@ FcConfigXdgConfigHome (void)
ret = malloc (len + 8 + 1);
if (ret)
{
FcMemAlloc (FC_MEM_STRING, len + 8 + 1);
memcpy (ret, home, len);
memcpy (&ret[len], FC_DIR_SEPARATOR_S ".config", 8);
ret[len + 8] = 0;
......@@ -1943,7 +1928,6 @@ FcConfigXdgDataHome (void)
ret = malloc (len + 13 + 1);
if (ret)
{
FcMemAlloc (FC_MEM_STRING, len + 13 + 1);
memcpy (ret, home, len);
memcpy (&ret[len], FC_DIR_SEPARATOR_S ".local" FC_DIR_SEPARATOR_S "share", 13);
ret[len + 13] = 0;
......
......@@ -35,7 +35,6 @@ FcCharSetCreate (void)
fcs = (FcCharSet *) malloc (sizeof (FcCharSet));
if (!fcs)
return 0;
FcMemAlloc (FC_MEM_CHARSET, sizeof (FcCharSet));
fcs->ref = 1;
fcs->num = 0;
fcs->leaves_offset = 0;
......@@ -64,19 +63,12 @@ FcCharSetDestroy (FcCharSet *fcs)
if (--fcs->ref > 0)
return;
for (i = 0; i < fcs->num; i++)
{
FcMemFree (FC_MEM_CHARLEAF, sizeof (FcCharLeaf));
free (FcCharSetLeaf (fcs, i));
}
if (fcs->num)
{
/* the numbers here are estimates */
FcMemFree (FC_MEM_CHARSET, fcs->num * sizeof (intptr_t));
free (FcCharSetLeaves (fcs));
FcMemFree (FC_MEM_CHARSET, fcs->num * sizeof (FcChar16));
free (FcCharSetNumbers (fcs));
}
FcMemFree (FC_MEM_CHARSET, sizeof (FcCharSet));
free (fcs);
}
}
......@@ -157,24 +149,16 @@ FcCharSetPutLeaf (FcCharSet *fcs,
unsigned int alloced = 8;
leaves = malloc (alloced * sizeof (*leaves));
numbers = malloc (alloced * sizeof (*numbers));
FcMemAlloc (FC_MEM_CHARSET, alloced * sizeof (*leaves));
FcMemAlloc (FC_MEM_CHARSET, alloced * sizeof (*numbers));
}
else
{
unsigned int alloced = fcs->num;
intptr_t *new_leaves, distance;
FcMemFree (FC_MEM_CHARSET, alloced * sizeof (*leaves));
FcMemFree (FC_MEM_CHARSET, alloced * sizeof (*numbers));
alloced *= 2;
new_leaves = realloc (leaves, alloced * sizeof (*leaves));
numbers = realloc (numbers, alloced * sizeof (*numbers));
FcMemAlloc (FC_MEM_CHARSET, alloced * sizeof (*leaves));
FcMemAlloc (FC_MEM_CHARSET, alloced * sizeof (*numbers));
distance = (intptr_t) new_leaves - (intptr_t) leaves;
if (new_leaves && distance)
{
......@@ -227,7 +211,6 @@ FcCharSetFindLeafCreate (FcCharSet *fcs, FcChar32 ucs4)
free (leaf);
return 0;
}
FcMemAlloc (FC_MEM_CHARLEAF, sizeof (FcCharLeaf));
return leaf;
}
......@@ -239,7 +222,6 @@ FcCharSetInsertLeaf (FcCharSet *fcs, FcChar32 ucs4, FcCharLeaf *leaf)
pos = FcCharSetFindLeafPos (fcs, ucs4);
if (pos >= 0)
{
FcMemFree (FC_MEM_CHARLEAF, sizeof (FcCharLeaf));
free (FcCharSetLeaf (fcs, pos));
FcCharSetLeaves(fcs)[pos] = FcPtrToOffset (FcCharSetLeaves(fcs),
leaf);
......@@ -971,15 +953,12 @@ FcNameParseCharSet (FcChar8 *string)
bail1:
if (c->num)
{
FcMemFree (FC_MEM_CHARSET, c->num * sizeof (FcCharLeaf *));
free (FcCharSetLeaves (c));
}
if (c->num)
{
FcMemFree (FC_MEM_CHARSET, c->num * sizeof (FcChar16));
free (FcCharSetNumbers (c));
}
FcMemFree (FC_MEM_CHARSET, sizeof (FcCharSet));
free (c);
bail0:
return NULL;
......@@ -1116,7 +1095,6 @@ FcCharLeafEntCreate (FcCharSetFreezer *freezer)
freezer->current_block = freezer->leaf_blocks[freezer->leaf_block_count-1] = malloc (FC_CHAR_LEAF_BLOCK * sizeof (FcCharLeafEnt));
if (!freezer->current_block)
return 0;
FcMemAlloc (FC_MEM_CHARLEAF, FC_CHAR_LEAF_BLOCK * sizeof (FcCharLeafEnt));
freezer->leaf_remain = FC_CHAR_LEAF_BLOCK;
}
freezer->leaf_remain--;
......@@ -1223,7 +1201,6 @@ FcCharSetFreezeBase (FcCharSetFreezer *freezer, FcCharSet *fcs)
ent = malloc (size);
if (!ent)
return 0;
FcMemAlloc (FC_MEM_CHARSET, size);
freezer->charsets_allocated++;
......@@ -1299,16 +1276,9 @@ FcCharSetFreeze (FcCharSetFreezer *freezer, const FcCharSet *fcs)
freezer->leaves_seen += fcs->num;
bail1:
if (b->num)
{
FcMemFree (FC_MEM_CHARSET, b->num * sizeof (FcCharLeaf *));
free (FcCharSetLeaves (b));
}
if (b->num)
{
FcMemFree (FC_MEM_CHARSET, b->num * sizeof (FcChar16));
free (FcCharSetNumbers (b));
}
FcMemFree (FC_MEM_CHARSET, sizeof (FcCharSet));
free (b);
bail0:
return n;
......@@ -1340,9 +1310,6 @@ FcCharSetFreezerDestroy (FcCharSetFreezer *freezer)
for (ent = freezer->set_hash_table[i]; ent; ent = next)
{
next = ent->next;
FcMemFree (FC_MEM_CHARSET, (sizeof (FcCharSetEnt) +
ent->set.num * sizeof (FcCharLeaf *) +
ent->set.num * sizeof (FcChar16)));
free (ent);
}
}
......@@ -1358,10 +1325,7 @@ FcCharSetFreezerDestroy (FcCharSetFreezer *freezer)
}
for (i = 0; i < freezer->leaf_block_count; i++)
{
free (freezer->leaf_blocks[i]);
FcMemFree (FC_MEM_CHARLEAF, FC_CHAR_LEAF_BLOCK * sizeof (FcCharLeafEnt));
}
free (freezer->leaf_blocks);
free (freezer);
......
......@@ -33,7 +33,6 @@ FcFontSetCreate (void)
s = (FcFontSet *) malloc (sizeof (FcFontSet));
if (!s)
return 0;
FcMemAlloc (FC_MEM_FONTSET, sizeof (FcFontSet));
s->nfont = 0;
s->sfont = 0;
s->fonts = 0;
......@@ -48,11 +47,7 @@ FcFontSetDestroy (FcFontSet *s)
for (i = 0; i < s->nfont; i++)
FcPatternDestroy (s->fonts[i]);
if (s->fonts)
{
FcMemFree (FC_MEM_FONTPTR, s->sfont * sizeof (FcPattern *));
free (s->fonts);
}
FcMemFree (FC_MEM_FONTSET, sizeof (FcFontSet));
free (s);
}
......@@ -71,9 +66,6 @@ FcFontSetAdd (FcFontSet *s, FcPattern *font)
f = (FcPattern **) malloc (sfont * sizeof (FcPattern *));
if (!f)
return FcFalse;
if (s->sfont)
FcMemFree (FC_MEM_FONTPTR, s->sfont * sizeof (FcPattern *));
FcMemAlloc (FC_MEM_FONTPTR, sfont * sizeof (FcPattern *));
s->sfont = sfont;
s->fonts = f;
}
......
......@@ -88,8 +88,6 @@ FcInitLoadConfig (void)
if (!p)
goto bail;
prefix = p;
FcMemFree (FC_MEM_STRING, plen + 1);
FcMemAlloc (FC_MEM_STRING, plen + 12);
memcpy (&prefix[plen], FC_DIR_SEPARATOR_S "fontconfig", 11);
prefix[plen + 11] = 0;
fprintf (stderr,
......@@ -145,8 +143,6 @@ FcInit (void)
if (!config)
return FcFalse;
FcConfigSetCurrent (config);
if (FcDebug() & FC_DBG_MEMORY)
FcMemReport ();
return FcTrue;
}
......@@ -161,8 +157,6 @@ FcFini (void)
FcObjectFini ();
FcCacheFini ();
if (FcDebug() & FC_DBG_MEMORY)
FcMemReport ();
}
/*
......@@ -205,105 +199,6 @@ FcInitBringUptoDate (void)
return FcInitReinitialize ();
}
static struct {
char name[16];
int alloc_count;
int alloc_mem;
int free_count;
int free_mem;
} FcInUse[FC_MEM_NUM] = {
{ "charset" },
{ "charleaf" },
{ "fontset" },
{ "fontptr" },
{ "objectset" },
{ "objectptr" },
{ "matrix" },
{ "pattern" },
{ "patelt" },
{ "vallist" },
{ "substate" },
{ "string" },
{ "listbuck" },
{ "strset" },
{ "strlist" },
{ "config" },
{ "langset" },
{ "atomic" },
{ "blanks" },
{ "cache" },
{ "strbuf" },
{ "subst" },
{ "objecttype" },
{ "constant" },
{ "test" },
{ "expr" },
{ "vstack" },
{ "attr" },
{ "pstack" },
{ "sharedstr" },
};
static int FcAllocCount, FcAllocMem;
static int FcFreeCount, FcFreeMem;
static int FcMemNotice = 1*1024*1024;
static int FcAllocNotify, FcFreeNotify;
void
FcMemReport (void)
{
int i;
printf ("Fc Memory Usage:\n");
printf ("\t Which Alloc Free Active\n");
printf ("\t count bytes count bytes count bytes\n");
for (i = 0; i < FC_MEM_NUM; i++)
printf ("%16.16s%8d%8d%8d%8d%8d%8d\n",
FcInUse[i].name,
FcInUse[i].alloc_count, FcInUse[i].alloc_mem,
FcInUse[i].free_count, FcInUse[i].free_mem,
FcInUse[i].alloc_count - FcInUse[i].free_count,
FcInUse[i].alloc_mem - FcInUse[i].free_mem);
printf ("%16.16s%8d%8d%8d%8d%8d%8d\n",
"Total",
FcAllocCount, FcAllocMem,
FcFreeCount, FcFreeMem,
FcAllocCount - FcFreeCount,
FcAllocMem - FcFreeMem);
FcAllocNotify = 0;
FcFreeNotify = 0;
}
void
FcMemAlloc (int kind, int size)
{
if (FcDebug() & FC_DBG_MEMORY)
{
FcInUse[kind].alloc_count++;
FcInUse[kind].alloc_mem += size;
FcAllocCount++;
FcAllocMem += size;
FcAllocNotify += size;
if (FcAllocNotify > FcMemNotice)
FcMemReport ();
}
}
void
FcMemFree (int kind, int size)
{
if (FcDebug() & FC_DBG_MEMORY)
{
FcInUse[kind].free_count++;
FcInUse[kind].free_mem += size;
FcFreeCount++;
FcFreeMem += size;
FcFreeNotify += size;
if (FcFreeNotify > FcMemNotice)
FcMemReport ();
}
}
#define __fcinit__
#include "fcaliastail.h"
#undef __fcinit__
......@@ -84,44 +84,10 @@ extern pfnSHGetFolderPathA pSHGetFolderPathA;
#define FC_DBG_PARSE 64
#define FC_DBG_SCAN 128
#define FC_DBG_SCANV 256
#define FC_DBG_MEMORY 512
#define FC_DBG_CONFIG 1024
#define FC_DBG_LANGSET 2048
#define FC_DBG_OBJTYPES 4096
#define FC_MEM_CHARSET 0
#define FC_MEM_CHARLEAF 1
#define FC_MEM_FONTSET 2
#define FC_MEM_FONTPTR 3
#define FC_MEM_OBJECTSET 4
#define FC_MEM_OBJECTPTR 5
#define FC_MEM_MATRIX 6
#define FC_MEM_PATTERN 7
#define FC_MEM_PATELT 8
#define FC_MEM_VALLIST 9
#define FC_MEM_SUBSTATE 10
#define FC_MEM_STRING 11
#define FC_MEM_LISTBUCK 12
#define FC_MEM_STRSET 13
#define FC_MEM_STRLIST 14
#define FC_MEM_CONFIG 15
#define FC_MEM_LANGSET 16
#define FC_MEM_ATOMIC 17
#define FC_MEM_BLANKS 18
#define FC_MEM_CACHE 19
#define FC_MEM_STRBUF 20
#define FC_MEM_SUBST 21
#define FC_MEM_OBJECTTYPE 22
#define FC_MEM_CONSTANT 23
#define FC_MEM_TEST 24
#define FC_MEM_EXPR 25
#define FC_MEM_VSTACK 26
#define FC_MEM_ATTR 27
#define FC_MEM_PSTACK 28
#define FC_MEM_SHAREDSTR 29
#define FC_MEM_NUM 30
#define _FC_ASSERT_STATIC1(_line, _cond) typedef int _static_assert_on_line_##_line##_failed[(_cond)?1:-1]
#define _FC_ASSERT_STATIC0(_line, _cond) _FC_ASSERT_STATIC1 (_line, (_cond))
#define FC_ASSERT_STATIC(_cond) _FC_ASSERT_STATIC0 (__LINE__, (_cond))
......@@ -810,17 +776,6 @@ FcTestDestroy (FcTest *test);
FcPrivate void
FcEditDestroy (FcEdit *e);
/* fcinit.c */
FcPrivate void
FcMemReport (void);
FcPrivate void
FcMemAlloc (int kind, int size);
FcPrivate void
FcMemFree (int kind, int size);
/* fclang.c */
FcPrivate FcLangSet *
FcFreeTypeLangSet (const FcCharSet *charset,
......
......@@ -182,7 +182,7 @@ FcLangNormalize (const FcChar8 *lang)
{
FcChar8 *result = NULL, *s, *orig;
char *territory, *encoding, *modifier;
size_t llen, tlen = 0, mlen = 0, ssize;
size_t llen, tlen = 0, mlen = 0;
if (!lang || !*lang)
return NULL;
......@@ -197,10 +197,6 @@ FcLangNormalize (const FcChar8 *lang)
s = FcStrCopy (lang);
if (!s)
goto bail;
/* store the original length of 's' here to let FcMemFree know
* the correct size since we breaks 's' from now on.
*/
ssize = strlen ((const char *)s) + 1;
/* from the comments in glibc:
*
......@@ -289,8 +285,6 @@ FcLangNormalize (const FcChar8 *lang)
/* we'll miss the opportunity to reduce the correct size
* of the allocated memory for the string after that.
*/
FcMemFree (FC_MEM_STRING, ssize);
FcMemAlloc (FC_MEM_STRING, strlen((const char *)s) + 1);
s = NULL;
goto bail1;
}
......@@ -307,8 +301,6 @@ FcLangNormalize (const FcChar8 *lang)
/* we'll miss the opportunity to reduce the correct size
* of the allocated memory for the string after that.
*/
FcMemFree (FC_MEM_STRING, ssize);
FcMemAlloc (FC_MEM_STRING, strlen((const char *)s) + 1);
s = NULL;
goto bail1;
}
......@@ -329,8 +321,6 @@ FcLangNormalize (const FcChar8 *lang)
/* we'll miss the opportunity to reduce the correct size
* of the allocated memory for the string after that.
*/
FcMemFree (FC_MEM_STRING, ssize);
FcMemAlloc (FC_MEM_STRING, strlen((const char *)s) + 1);
s = NULL;
}
bail1:
......@@ -338,10 +328,7 @@ FcLangNormalize (const FcChar8 *lang)
FcStrFree (orig);
bail0:
if (s)
{
free (s);
FcMemFree (FC_MEM_STRING, ssize);
}
bail:
if (FcDebug () & FC_DBG_LANGSET)
{
......@@ -465,7 +452,6 @@ FcLangSetCreate (void)
ls = malloc (sizeof (FcLangSet));
if (!ls)
return 0;
FcMemAlloc (FC_MEM_LANGSET, sizeof (FcLangSet));
memset (ls->map, '\0', sizeof (ls->map));
ls->map_size = NUM_LANG_SET_MAP;
ls->extra = 0;
......@@ -477,7 +463,6 @@ FcLangSetDestroy (FcLangSet *ls)
{
if (ls->extra)
FcStrSetDestroy (ls->extra);
FcMemFree (FC_MEM_LANGSET, sizeof (FcLangSet));
free (ls);
}
......
......@@ -33,7 +33,6 @@ FcObjectSetCreate (void)
os = (FcObjectSet *) malloc (sizeof (FcObjectSet));
if (!os)
return 0;
FcMemAlloc (FC_MEM_OBJECTSET, sizeof (FcObjectSet));
os->nobject = 0;
os->sobject = 0;
os->objects = 0;
......@@ -57,9 +56,6 @@ FcObjectSetAdd (FcObjectSet *os, const char *object)
objects = (const char **) malloc (s * sizeof (const char *));
if (!objects)
return FcFalse;
if (os->sobject)
FcMemFree (FC_MEM_OBJECTPTR, os->sobject * sizeof (const char *));
FcMemAlloc (FC_MEM_OBJECTPTR, s * sizeof (const char *));
os->objects = objects;
os->sobject = s;
}
......@@ -101,10 +97,8 @@ FcObjectSetDestroy (FcObjectSet *os)
for (i = 0; i < os->nobject; i++)
FcSharedStrFree ((FcChar8 *)os->objects[i]);
FcMemFree (FC_MEM_OBJECTPTR, os->sobject * sizeof (const char *));
free ((void *) os->objects);
}
FcMemFree (FC_MEM_OBJECTSET, sizeof (FcObjectSet));
free (os);
}
......@@ -342,7 +336,6 @@ FcListHashTableCleanup (FcListHashTable *table)
{
next = bucket->next;
FcPatternDestroy (bucket->pattern);
FcMemFree (FC_MEM_LISTBUCK, sizeof (FcListBucket));
free (bucket);
}
table->buckets[i] = 0;
......@@ -418,7 +411,6 @@ FcListAppend (FcListHashTable *table,
bucket = (FcListBucket *) malloc (sizeof (FcListBucket));
if (!bucket)
goto bail0;
FcMemAlloc (FC_MEM_LISTBUCK, sizeof (FcListBucket));
bucket->next = 0;
bucket->hash = hash;
bucket->pattern = FcPatternCreate ();
......@@ -469,7 +461,6 @@ FcListAppend (FcListHashTable *table,
bail2:
FcPatternDestroy (bucket->pattern);
bail1:
FcMemFree (FC_MEM_LISTBUCK, sizeof (FcListBucket));
free (bucket);
bail0:
return FcFalse;
......@@ -569,7 +560,6 @@ FcFontSetList (FcConfig *config,
if (!FcFontSetAdd (ret, bucket->pattern))
goto bail2;
table.buckets[i] = bucket->next;
FcMemFree (FC_MEM_LISTBUCK, sizeof (FcListBucket));
free (bucket);
}
......
......@@ -38,7 +38,6 @@ FcMatrixCopy (const FcMatrix *mat)
r = (FcMatrix *) malloc (sizeof (*r) );
if (!r)
return 0;
FcMemAlloc (FC_MEM_MATRIX, sizeof (FcMatrix));
*r = *mat;
return r;
}
......@@ -47,10 +46,7 @@ void
FcMatrixFree (FcMatrix *mat)
{
if (mat != &FcIdentityMatrix)
{
FcMemFree (FC_MEM_MATRIX, sizeof (FcMatrix));
free (mat);
}
}
FcBool
......
......@@ -481,7 +481,6 @@ FcNameRegisterConstants (const FcConstant *consts, int nconsts)
l = (FcConstantList *) malloc (sizeof (FcConstantList));
if (!l)
return FcFalse;
FcMemAlloc (FC_MEM_CONSTANT, sizeof (FcConstantList));
l->consts = consts;
l->nconsts = nconsts;
l->next = _FcConstants;
......@@ -501,7 +500,6 @@ FcNameUnregisterConstants (const FcConstant *consts, int nconsts)
if (l->consts == consts && l->nconsts == nconsts)
{
*prev = l->next;
FcMemFree (FC_MEM_CONSTANT, sizeof (FcConstantList));
free ((void *) l);
return FcTrue;
}
......
......@@ -34,7 +34,6 @@ FcPatternCreate (void)
p = (FcPattern *) malloc (sizeof (FcPattern));
if (!p)
return 0;
FcMemAlloc (FC_MEM_PATTERN, sizeof (FcPattern));
p->num = 0;
p->size = 0;
p->elts_offset = FcPtrToOffset (p, NULL);
......@@ -123,15 +122,7 @@ FcValueSave (FcValue v)
FcValueListPtr
FcValueListCreate (void)
{
FcValueListPtr ret;
ret = calloc (1, sizeof (FcValueList));
if (ret)
{
FcMemAlloc(FC_MEM_VALLIST, sizeof (FcValueList));
}
return ret;
return calloc (1, sizeof (FcValueList));
}
void
......@@ -160,7 +151,6 @@ FcValueListDestroy (FcValueListPtr l)
break;
}
next = FcValueListNext(l);
FcMemFree (FC_MEM_VALLIST, sizeof (FcValueList));
free(l);
}
}
......@@ -382,9 +372,7 @@ FcPatternDestroy (FcPattern *p)
for (i = 0; i < p->num; i++)
FcValueListDestroy (FcPatternEltValues(&elts[i]));
FcMemFree (FC_MEM_PATELT, p->size * sizeof (FcPatternElt));
free (elts);
FcMemFree (FC_MEM_PATTERN, sizeof (FcPattern));
free (p);
}
......@@ -454,9 +442,6 @@ FcPatternObjectInsertElt (FcPattern *p, FcObject object)
if (!e)
return FcFalse;
p->elts_offset = FcPtrToOffset (p, e);
if (p->size)
FcMemFree (FC_MEM_PATELT, p->size * sizeof (FcPatternElt));
FcMemAlloc (FC_MEM_PATELT, s * sizeof (FcPatternElt));
while (p->size < s)
{
e[p->size].object = 0;
......@@ -662,7 +647,6 @@ FcPatternObjectAddWithBinding (FcPattern *p,
bail2:
FcValueDestroy (value);
bail1:
FcMemFree (FC_MEM_VALLIST, sizeof (FcValueList));
free (new);
bail0:
return FcFalse;
......@@ -1187,7 +1171,6 @@ FcSharedStrFree (const FcChar8 *name)
*p = b->next;
size = sizeof (struct objectBucket) + strlen ((char *)name) + 1;
size = (size + 3) & ~3;
FcMemFree (FC_MEM_SHAREDSTR, size);
free (b);
}
return FcTrue;
......@@ -1216,7 +1199,6 @@ FcSharedStr (const FcChar8 *name)
*/
size = (size + 3) & ~3;