Remove memory accounting and reporting
That belongs in tools like cairo/util/malloc-stat.so
This commit is contained in:
parent
d823bb3cad
commit
d7e1965aa0
|
@ -78,7 +78,6 @@ FcAtomicCreate (const FcChar8 *file)
|
||||||
FcAtomic *atomic = malloc (total_len);
|
FcAtomic *atomic = malloc (total_len);
|
||||||
if (!atomic)
|
if (!atomic)
|
||||||
return 0;
|
return 0;
|
||||||
FcMemAlloc (FC_MEM_ATOMIC, total_len);
|
|
||||||
|
|
||||||
atomic->file = (FcChar8 *) (atomic + 1);
|
atomic->file = (FcChar8 *) (atomic + 1);
|
||||||
strcpy ((char *) atomic->file, (char *) file);
|
strcpy ((char *) atomic->file, (char *) file);
|
||||||
|
@ -223,11 +222,6 @@ FcAtomicUnlock (FcAtomic *atomic)
|
||||||
void
|
void
|
||||||
FcAtomicDestroy (FcAtomic *atomic)
|
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);
|
free (atomic);
|
||||||
}
|
}
|
||||||
#define __fcatomic__
|
#define __fcatomic__
|
||||||
|
|
|
@ -32,7 +32,6 @@ FcBlanksCreate (void)
|
||||||
b = malloc (sizeof (FcBlanks));
|
b = malloc (sizeof (FcBlanks));
|
||||||
if (!b)
|
if (!b)
|
||||||
return 0;
|
return 0;
|
||||||
FcMemAlloc (FC_MEM_BLANKS, sizeof (FcBlanks));
|
|
||||||
b->nblank = 0;
|
b->nblank = 0;
|
||||||
b->sblank = 0;
|
b->sblank = 0;
|
||||||
b->blanks = 0;
|
b->blanks = 0;
|
||||||
|
@ -43,11 +42,7 @@ void
|
||||||
FcBlanksDestroy (FcBlanks *b)
|
FcBlanksDestroy (FcBlanks *b)
|
||||||
{
|
{
|
||||||
if (b->blanks)
|
if (b->blanks)
|
||||||
{
|
|
||||||
FcMemFree (FC_MEM_BLANKS, b->sblank * sizeof (FcChar32));
|
|
||||||
free (b->blanks);
|
free (b->blanks);
|
||||||
}
|
|
||||||
FcMemFree (FC_MEM_BLANKS, sizeof (FcBlanks));
|
|
||||||
free (b);
|
free (b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,9 +65,6 @@ FcBlanksAdd (FcBlanks *b, FcChar32 ucs4)
|
||||||
c = (FcChar32 *) malloc (sblank * sizeof (FcChar32));
|
c = (FcChar32 *) malloc (sblank * sizeof (FcChar32));
|
||||||
if (!c)
|
if (!c)
|
||||||
return FcFalse;
|
return FcFalse;
|
||||||
if (b->sblank)
|
|
||||||
FcMemFree (FC_MEM_BLANKS, b->sblank * sizeof (FcChar32));
|
|
||||||
FcMemAlloc (FC_MEM_BLANKS, sblank * sizeof (FcChar32));
|
|
||||||
b->sblank = sblank;
|
b->sblank = sblank;
|
||||||
b->blanks = c;
|
b->blanks = c;
|
||||||
}
|
}
|
||||||
|
|
16
src/fccfg.c
16
src/fccfg.c
|
@ -47,7 +47,6 @@ FcConfigCreate (void)
|
||||||
config = malloc (sizeof (FcConfig));
|
config = malloc (sizeof (FcConfig));
|
||||||
if (!config)
|
if (!config)
|
||||||
goto bail0;
|
goto bail0;
|
||||||
FcMemAlloc (FC_MEM_CONFIG, sizeof (FcConfig));
|
|
||||||
|
|
||||||
config->configDirs = FcStrSetCreate ();
|
config->configDirs = FcStrSetCreate ();
|
||||||
if (!config->configDirs)
|
if (!config->configDirs)
|
||||||
|
@ -115,7 +114,6 @@ bail2:
|
||||||
FcStrSetDestroy (config->configDirs);
|
FcStrSetDestroy (config->configDirs);
|
||||||
bail1:
|
bail1:
|
||||||
free (config);
|
free (config);
|
||||||
FcMemFree (FC_MEM_CONFIG, sizeof (FcConfig));
|
|
||||||
bail0:
|
bail0:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -190,7 +188,6 @@ FcSubstDestroy (FcSubst *s)
|
||||||
if (s->edit)
|
if (s->edit)
|
||||||
FcEditDestroy (s->edit);
|
FcEditDestroy (s->edit);
|
||||||
free (s);
|
free (s);
|
||||||
FcMemFree (FC_MEM_SUBST, sizeof (FcSubst));
|
|
||||||
s = n;
|
s = n;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -205,7 +202,6 @@ FcConfigAllocExpr (FcConfig *config)
|
||||||
new_page = malloc (sizeof (FcExprPage));
|
new_page = malloc (sizeof (FcExprPage));
|
||||||
if (!new_page)
|
if (!new_page)
|
||||||
return 0;
|
return 0;
|
||||||
FcMemAlloc (FC_MEM_EXPR, sizeof (FcExprPage));
|
|
||||||
|
|
||||||
new_page->next_page = config->expr_pool;
|
new_page->next_page = config->expr_pool;
|
||||||
new_page->next = new_page->exprs;
|
new_page->next = new_page->exprs;
|
||||||
|
@ -265,13 +261,11 @@ FcConfigDestroy (FcConfig *config)
|
||||||
while (page)
|
while (page)
|
||||||
{
|
{
|
||||||
FcExprPage *next = page->next_page;
|
FcExprPage *next = page->next_page;
|
||||||
FcMemFree (FC_MEM_EXPR, sizeof (FcExprPage));
|
|
||||||
free (page);
|
free (page);
|
||||||
page = next;
|
page = next;
|
||||||
}
|
}
|
||||||
|
|
||||||
free (config);
|
free (config);
|
||||||
FcMemFree (FC_MEM_CONFIG, sizeof (FcConfig));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -640,7 +634,6 @@ FcConfigAddEdit (FcConfig *config,
|
||||||
subst = (FcSubst *) malloc (sizeof (FcSubst));
|
subst = (FcSubst *) malloc (sizeof (FcSubst));
|
||||||
if (!subst)
|
if (!subst)
|
||||||
return FcFalse;
|
return FcFalse;
|
||||||
FcMemAlloc (FC_MEM_SUBST, sizeof (FcSubst));
|
|
||||||
for (; *prev; prev = &(*prev)->next);
|
for (; *prev; prev = &(*prev)->next);
|
||||||
*prev = subst;
|
*prev = subst;
|
||||||
subst->next = 0;
|
subst->next = 0;
|
||||||
|
@ -1054,7 +1047,6 @@ FcConfigEvaluate (FcPattern *p, FcExpr *e)
|
||||||
m = malloc (sizeof (FcMatrix));
|
m = malloc (sizeof (FcMatrix));
|
||||||
if (m)
|
if (m)
|
||||||
{
|
{
|
||||||
FcMemAlloc (FC_MEM_MATRIX, sizeof (FcMatrix));
|
|
||||||
FcMatrixMultiply (m, vl.u.m, vr.u.m);
|
FcMatrixMultiply (m, vl.u.m, vr.u.m);
|
||||||
v.u.m = m;
|
v.u.m = m;
|
||||||
}
|
}
|
||||||
|
@ -1256,7 +1248,6 @@ FcConfigValues (FcPattern *p, FcExpr *e, FcValueBinding binding)
|
||||||
l = (FcValueList *) malloc (sizeof (FcValueList));
|
l = (FcValueList *) malloc (sizeof (FcValueList));
|
||||||
if (!l)
|
if (!l)
|
||||||
return 0;
|
return 0;
|
||||||
FcMemAlloc (FC_MEM_VALLIST, sizeof (FcValueList));
|
|
||||||
if (FC_OP_GET_OP (e->op) == FcOpComma)
|
if (FC_OP_GET_OP (e->op) == FcOpComma)
|
||||||
{
|
{
|
||||||
l->value = FcConfigEvaluate (p, e->u.tree.left);
|
l->value = FcConfigEvaluate (p, e->u.tree.left);
|
||||||
|
@ -1272,7 +1263,6 @@ FcConfigValues (FcPattern *p, FcExpr *e, FcValueBinding binding)
|
||||||
{
|
{
|
||||||
FcValueList *next = FcValueListNext(l);
|
FcValueList *next = FcValueListNext(l);
|
||||||
|
|
||||||
FcMemFree (FC_MEM_VALLIST, sizeof (FcValueList));
|
|
||||||
free (l);
|
free (l);
|
||||||
l = next;
|
l = next;
|
||||||
}
|
}
|
||||||
|
@ -1467,7 +1457,6 @@ FcConfigSubstituteWithPat (FcConfig *config,
|
||||||
st = (FcSubState *) malloc (config->maxObjects * sizeof (FcSubState));
|
st = (FcSubState *) malloc (config->maxObjects * sizeof (FcSubState));
|
||||||
if (!st && config->maxObjects)
|
if (!st && config->maxObjects)
|
||||||
return FcFalse;
|
return FcFalse;
|
||||||
FcMemAlloc (FC_MEM_SUBSTATE, config->maxObjects * sizeof (FcSubState));
|
|
||||||
|
|
||||||
if (FcDebug () & FC_DBG_EDIT)
|
if (FcDebug () & FC_DBG_EDIT)
|
||||||
{
|
{
|
||||||
|
@ -1653,7 +1642,6 @@ FcConfigSubstituteWithPat (FcConfig *config,
|
||||||
FcPatternPrint (p);
|
FcPatternPrint (p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FcMemFree (FC_MEM_SUBSTATE, config->maxObjects * sizeof (FcSubState));
|
|
||||||
free (st);
|
free (st);
|
||||||
if (FcDebug () & FC_DBG_EDIT)
|
if (FcDebug () & FC_DBG_EDIT)
|
||||||
{
|
{
|
||||||
|
@ -1766,7 +1754,6 @@ FcConfigFileExists (const FcChar8 *dir, const FcChar8 *file)
|
||||||
#endif
|
#endif
|
||||||
strcat ((char *) path, (char *) file);
|
strcat ((char *) path, (char *) file);
|
||||||
|
|
||||||
FcMemAlloc (FC_MEM_STRING, osize);
|
|
||||||
if (access ((char *) path, R_OK) == 0)
|
if (access ((char *) path, R_OK) == 0)
|
||||||
return path;
|
return path;
|
||||||
|
|
||||||
|
@ -1891,7 +1878,6 @@ FcConfigXdgCacheHome (void)
|
||||||
ret = malloc (len + 7 + 1);
|
ret = malloc (len + 7 + 1);
|
||||||
if (ret)
|
if (ret)
|
||||||
{
|
{
|
||||||
FcMemAlloc (FC_MEM_STRING, len + 7 + 1);
|
|
||||||
memcpy (ret, home, len);
|
memcpy (ret, home, len);
|
||||||
memcpy (&ret[len], FC_DIR_SEPARATOR_S ".cache", 7);
|
memcpy (&ret[len], FC_DIR_SEPARATOR_S ".cache", 7);
|
||||||
ret[len + 7] = 0;
|
ret[len + 7] = 0;
|
||||||
|
@ -1917,7 +1903,6 @@ FcConfigXdgConfigHome (void)
|
||||||
ret = malloc (len + 8 + 1);
|
ret = malloc (len + 8 + 1);
|
||||||
if (ret)
|
if (ret)
|
||||||
{
|
{
|
||||||
FcMemAlloc (FC_MEM_STRING, len + 8 + 1);
|
|
||||||
memcpy (ret, home, len);
|
memcpy (ret, home, len);
|
||||||
memcpy (&ret[len], FC_DIR_SEPARATOR_S ".config", 8);
|
memcpy (&ret[len], FC_DIR_SEPARATOR_S ".config", 8);
|
||||||
ret[len + 8] = 0;
|
ret[len + 8] = 0;
|
||||||
|
@ -1943,7 +1928,6 @@ FcConfigXdgDataHome (void)
|
||||||
ret = malloc (len + 13 + 1);
|
ret = malloc (len + 13 + 1);
|
||||||
if (ret)
|
if (ret)
|
||||||
{
|
{
|
||||||
FcMemAlloc (FC_MEM_STRING, len + 13 + 1);
|
|
||||||
memcpy (ret, home, len);
|
memcpy (ret, home, len);
|
||||||
memcpy (&ret[len], FC_DIR_SEPARATOR_S ".local" FC_DIR_SEPARATOR_S "share", 13);
|
memcpy (&ret[len], FC_DIR_SEPARATOR_S ".local" FC_DIR_SEPARATOR_S "share", 13);
|
||||||
ret[len + 13] = 0;
|
ret[len + 13] = 0;
|
||||||
|
|
|
@ -35,7 +35,6 @@ FcCharSetCreate (void)
|
||||||
fcs = (FcCharSet *) malloc (sizeof (FcCharSet));
|
fcs = (FcCharSet *) malloc (sizeof (FcCharSet));
|
||||||
if (!fcs)
|
if (!fcs)
|
||||||
return 0;
|
return 0;
|
||||||
FcMemAlloc (FC_MEM_CHARSET, sizeof (FcCharSet));
|
|
||||||
fcs->ref = 1;
|
fcs->ref = 1;
|
||||||
fcs->num = 0;
|
fcs->num = 0;
|
||||||
fcs->leaves_offset = 0;
|
fcs->leaves_offset = 0;
|
||||||
|
@ -64,19 +63,12 @@ FcCharSetDestroy (FcCharSet *fcs)
|
||||||
if (--fcs->ref > 0)
|
if (--fcs->ref > 0)
|
||||||
return;
|
return;
|
||||||
for (i = 0; i < fcs->num; i++)
|
for (i = 0; i < fcs->num; i++)
|
||||||
{
|
|
||||||
FcMemFree (FC_MEM_CHARLEAF, sizeof (FcCharLeaf));
|
|
||||||
free (FcCharSetLeaf (fcs, i));
|
free (FcCharSetLeaf (fcs, i));
|
||||||
}
|
|
||||||
if (fcs->num)
|
if (fcs->num)
|
||||||
{
|
{
|
||||||
/* the numbers here are estimates */
|
|
||||||
FcMemFree (FC_MEM_CHARSET, fcs->num * sizeof (intptr_t));
|
|
||||||
free (FcCharSetLeaves (fcs));
|
free (FcCharSetLeaves (fcs));
|
||||||
FcMemFree (FC_MEM_CHARSET, fcs->num * sizeof (FcChar16));
|
|
||||||
free (FcCharSetNumbers (fcs));
|
free (FcCharSetNumbers (fcs));
|
||||||
}
|
}
|
||||||
FcMemFree (FC_MEM_CHARSET, sizeof (FcCharSet));
|
|
||||||
free (fcs);
|
free (fcs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -157,24 +149,16 @@ FcCharSetPutLeaf (FcCharSet *fcs,
|
||||||
unsigned int alloced = 8;
|
unsigned int alloced = 8;
|
||||||
leaves = malloc (alloced * sizeof (*leaves));
|
leaves = malloc (alloced * sizeof (*leaves));
|
||||||
numbers = malloc (alloced * sizeof (*numbers));
|
numbers = malloc (alloced * sizeof (*numbers));
|
||||||
FcMemAlloc (FC_MEM_CHARSET, alloced * sizeof (*leaves));
|
|
||||||
FcMemAlloc (FC_MEM_CHARSET, alloced * sizeof (*numbers));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
unsigned int alloced = fcs->num;
|
unsigned int alloced = fcs->num;
|
||||||
intptr_t *new_leaves, distance;
|
intptr_t *new_leaves, distance;
|
||||||
|
|
||||||
FcMemFree (FC_MEM_CHARSET, alloced * sizeof (*leaves));
|
|
||||||
FcMemFree (FC_MEM_CHARSET, alloced * sizeof (*numbers));
|
|
||||||
|
|
||||||
alloced *= 2;
|
alloced *= 2;
|
||||||
new_leaves = realloc (leaves, alloced * sizeof (*leaves));
|
new_leaves = realloc (leaves, alloced * sizeof (*leaves));
|
||||||
numbers = realloc (numbers, alloced * sizeof (*numbers));
|
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;
|
distance = (intptr_t) new_leaves - (intptr_t) leaves;
|
||||||
if (new_leaves && distance)
|
if (new_leaves && distance)
|
||||||
{
|
{
|
||||||
|
@ -227,7 +211,6 @@ FcCharSetFindLeafCreate (FcCharSet *fcs, FcChar32 ucs4)
|
||||||
free (leaf);
|
free (leaf);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
FcMemAlloc (FC_MEM_CHARLEAF, sizeof (FcCharLeaf));
|
|
||||||
return leaf;
|
return leaf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -239,7 +222,6 @@ FcCharSetInsertLeaf (FcCharSet *fcs, FcChar32 ucs4, FcCharLeaf *leaf)
|
||||||
pos = FcCharSetFindLeafPos (fcs, ucs4);
|
pos = FcCharSetFindLeafPos (fcs, ucs4);
|
||||||
if (pos >= 0)
|
if (pos >= 0)
|
||||||
{
|
{
|
||||||
FcMemFree (FC_MEM_CHARLEAF, sizeof (FcCharLeaf));
|
|
||||||
free (FcCharSetLeaf (fcs, pos));
|
free (FcCharSetLeaf (fcs, pos));
|
||||||
FcCharSetLeaves(fcs)[pos] = FcPtrToOffset (FcCharSetLeaves(fcs),
|
FcCharSetLeaves(fcs)[pos] = FcPtrToOffset (FcCharSetLeaves(fcs),
|
||||||
leaf);
|
leaf);
|
||||||
|
@ -971,15 +953,12 @@ FcNameParseCharSet (FcChar8 *string)
|
||||||
bail1:
|
bail1:
|
||||||
if (c->num)
|
if (c->num)
|
||||||
{
|
{
|
||||||
FcMemFree (FC_MEM_CHARSET, c->num * sizeof (FcCharLeaf *));
|
|
||||||
free (FcCharSetLeaves (c));
|
free (FcCharSetLeaves (c));
|
||||||
}
|
}
|
||||||
if (c->num)
|
if (c->num)
|
||||||
{
|
{
|
||||||
FcMemFree (FC_MEM_CHARSET, c->num * sizeof (FcChar16));
|
|
||||||
free (FcCharSetNumbers (c));
|
free (FcCharSetNumbers (c));
|
||||||
}
|
}
|
||||||
FcMemFree (FC_MEM_CHARSET, sizeof (FcCharSet));
|
|
||||||
free (c);
|
free (c);
|
||||||
bail0:
|
bail0:
|
||||||
return NULL;
|
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));
|
freezer->current_block = freezer->leaf_blocks[freezer->leaf_block_count-1] = malloc (FC_CHAR_LEAF_BLOCK * sizeof (FcCharLeafEnt));
|
||||||
if (!freezer->current_block)
|
if (!freezer->current_block)
|
||||||
return 0;
|
return 0;
|
||||||
FcMemAlloc (FC_MEM_CHARLEAF, FC_CHAR_LEAF_BLOCK * sizeof (FcCharLeafEnt));
|
|
||||||
freezer->leaf_remain = FC_CHAR_LEAF_BLOCK;
|
freezer->leaf_remain = FC_CHAR_LEAF_BLOCK;
|
||||||
}
|
}
|
||||||
freezer->leaf_remain--;
|
freezer->leaf_remain--;
|
||||||
|
@ -1223,7 +1201,6 @@ FcCharSetFreezeBase (FcCharSetFreezer *freezer, FcCharSet *fcs)
|
||||||
ent = malloc (size);
|
ent = malloc (size);
|
||||||
if (!ent)
|
if (!ent)
|
||||||
return 0;
|
return 0;
|
||||||
FcMemAlloc (FC_MEM_CHARSET, size);
|
|
||||||
|
|
||||||
freezer->charsets_allocated++;
|
freezer->charsets_allocated++;
|
||||||
|
|
||||||
|
@ -1299,16 +1276,9 @@ FcCharSetFreeze (FcCharSetFreezer *freezer, const FcCharSet *fcs)
|
||||||
freezer->leaves_seen += fcs->num;
|
freezer->leaves_seen += fcs->num;
|
||||||
bail1:
|
bail1:
|
||||||
if (b->num)
|
if (b->num)
|
||||||
{
|
|
||||||
FcMemFree (FC_MEM_CHARSET, b->num * sizeof (FcCharLeaf *));
|
|
||||||
free (FcCharSetLeaves (b));
|
free (FcCharSetLeaves (b));
|
||||||
}
|
|
||||||
if (b->num)
|
if (b->num)
|
||||||
{
|
|
||||||
FcMemFree (FC_MEM_CHARSET, b->num * sizeof (FcChar16));
|
|
||||||
free (FcCharSetNumbers (b));
|
free (FcCharSetNumbers (b));
|
||||||
}
|
|
||||||
FcMemFree (FC_MEM_CHARSET, sizeof (FcCharSet));
|
|
||||||
free (b);
|
free (b);
|
||||||
bail0:
|
bail0:
|
||||||
return n;
|
return n;
|
||||||
|
@ -1340,9 +1310,6 @@ FcCharSetFreezerDestroy (FcCharSetFreezer *freezer)
|
||||||
for (ent = freezer->set_hash_table[i]; ent; ent = next)
|
for (ent = freezer->set_hash_table[i]; ent; ent = next)
|
||||||
{
|
{
|
||||||
next = ent->next;
|
next = ent->next;
|
||||||
FcMemFree (FC_MEM_CHARSET, (sizeof (FcCharSetEnt) +
|
|
||||||
ent->set.num * sizeof (FcCharLeaf *) +
|
|
||||||
ent->set.num * sizeof (FcChar16)));
|
|
||||||
free (ent);
|
free (ent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1358,10 +1325,7 @@ FcCharSetFreezerDestroy (FcCharSetFreezer *freezer)
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < freezer->leaf_block_count; i++)
|
for (i = 0; i < freezer->leaf_block_count; i++)
|
||||||
{
|
|
||||||
free (freezer->leaf_blocks[i]);
|
free (freezer->leaf_blocks[i]);
|
||||||
FcMemFree (FC_MEM_CHARLEAF, FC_CHAR_LEAF_BLOCK * sizeof (FcCharLeafEnt));
|
|
||||||
}
|
|
||||||
|
|
||||||
free (freezer->leaf_blocks);
|
free (freezer->leaf_blocks);
|
||||||
free (freezer);
|
free (freezer);
|
||||||
|
|
|
@ -33,7 +33,6 @@ FcFontSetCreate (void)
|
||||||
s = (FcFontSet *) malloc (sizeof (FcFontSet));
|
s = (FcFontSet *) malloc (sizeof (FcFontSet));
|
||||||
if (!s)
|
if (!s)
|
||||||
return 0;
|
return 0;
|
||||||
FcMemAlloc (FC_MEM_FONTSET, sizeof (FcFontSet));
|
|
||||||
s->nfont = 0;
|
s->nfont = 0;
|
||||||
s->sfont = 0;
|
s->sfont = 0;
|
||||||
s->fonts = 0;
|
s->fonts = 0;
|
||||||
|
@ -48,11 +47,7 @@ FcFontSetDestroy (FcFontSet *s)
|
||||||
for (i = 0; i < s->nfont; i++)
|
for (i = 0; i < s->nfont; i++)
|
||||||
FcPatternDestroy (s->fonts[i]);
|
FcPatternDestroy (s->fonts[i]);
|
||||||
if (s->fonts)
|
if (s->fonts)
|
||||||
{
|
|
||||||
FcMemFree (FC_MEM_FONTPTR, s->sfont * sizeof (FcPattern *));
|
|
||||||
free (s->fonts);
|
free (s->fonts);
|
||||||
}
|
|
||||||
FcMemFree (FC_MEM_FONTSET, sizeof (FcFontSet));
|
|
||||||
free (s);
|
free (s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,9 +66,6 @@ FcFontSetAdd (FcFontSet *s, FcPattern *font)
|
||||||
f = (FcPattern **) malloc (sfont * sizeof (FcPattern *));
|
f = (FcPattern **) malloc (sfont * sizeof (FcPattern *));
|
||||||
if (!f)
|
if (!f)
|
||||||
return FcFalse;
|
return FcFalse;
|
||||||
if (s->sfont)
|
|
||||||
FcMemFree (FC_MEM_FONTPTR, s->sfont * sizeof (FcPattern *));
|
|
||||||
FcMemAlloc (FC_MEM_FONTPTR, sfont * sizeof (FcPattern *));
|
|
||||||
s->sfont = sfont;
|
s->sfont = sfont;
|
||||||
s->fonts = f;
|
s->fonts = f;
|
||||||
}
|
}
|
||||||
|
|
105
src/fcinit.c
105
src/fcinit.c
|
@ -88,8 +88,6 @@ FcInitLoadConfig (void)
|
||||||
if (!p)
|
if (!p)
|
||||||
goto bail;
|
goto bail;
|
||||||
prefix = p;
|
prefix = p;
|
||||||
FcMemFree (FC_MEM_STRING, plen + 1);
|
|
||||||
FcMemAlloc (FC_MEM_STRING, plen + 12);
|
|
||||||
memcpy (&prefix[plen], FC_DIR_SEPARATOR_S "fontconfig", 11);
|
memcpy (&prefix[plen], FC_DIR_SEPARATOR_S "fontconfig", 11);
|
||||||
prefix[plen + 11] = 0;
|
prefix[plen + 11] = 0;
|
||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
|
@ -145,8 +143,6 @@ FcInit (void)
|
||||||
if (!config)
|
if (!config)
|
||||||
return FcFalse;
|
return FcFalse;
|
||||||
FcConfigSetCurrent (config);
|
FcConfigSetCurrent (config);
|
||||||
if (FcDebug() & FC_DBG_MEMORY)
|
|
||||||
FcMemReport ();
|
|
||||||
return FcTrue;
|
return FcTrue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -161,8 +157,6 @@ FcFini (void)
|
||||||
|
|
||||||
FcObjectFini ();
|
FcObjectFini ();
|
||||||
FcCacheFini ();
|
FcCacheFini ();
|
||||||
if (FcDebug() & FC_DBG_MEMORY)
|
|
||||||
FcMemReport ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -205,105 +199,6 @@ FcInitBringUptoDate (void)
|
||||||
return FcInitReinitialize ();
|
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__
|
#define __fcinit__
|
||||||
#include "fcaliastail.h"
|
#include "fcaliastail.h"
|
||||||
#undef __fcinit__
|
#undef __fcinit__
|
||||||
|
|
45
src/fcint.h
45
src/fcint.h
|
@ -84,44 +84,10 @@ extern pfnSHGetFolderPathA pSHGetFolderPathA;
|
||||||
#define FC_DBG_PARSE 64
|
#define FC_DBG_PARSE 64
|
||||||
#define FC_DBG_SCAN 128
|
#define FC_DBG_SCAN 128
|
||||||
#define FC_DBG_SCANV 256
|
#define FC_DBG_SCANV 256
|
||||||
#define FC_DBG_MEMORY 512
|
|
||||||
#define FC_DBG_CONFIG 1024
|
#define FC_DBG_CONFIG 1024
|
||||||
#define FC_DBG_LANGSET 2048
|
#define FC_DBG_LANGSET 2048
|
||||||
#define FC_DBG_OBJTYPES 4096
|
#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_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_STATIC0(_line, _cond) _FC_ASSERT_STATIC1 (_line, (_cond))
|
||||||
#define FC_ASSERT_STATIC(_cond) _FC_ASSERT_STATIC0 (__LINE__, (_cond))
|
#define FC_ASSERT_STATIC(_cond) _FC_ASSERT_STATIC0 (__LINE__, (_cond))
|
||||||
|
@ -810,17 +776,6 @@ FcTestDestroy (FcTest *test);
|
||||||
FcPrivate void
|
FcPrivate void
|
||||||
FcEditDestroy (FcEdit *e);
|
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 */
|
/* fclang.c */
|
||||||
FcPrivate FcLangSet *
|
FcPrivate FcLangSet *
|
||||||
FcFreeTypeLangSet (const FcCharSet *charset,
|
FcFreeTypeLangSet (const FcCharSet *charset,
|
||||||
|
|
17
src/fclang.c
17
src/fclang.c
|
@ -182,7 +182,7 @@ FcLangNormalize (const FcChar8 *lang)
|
||||||
{
|
{
|
||||||
FcChar8 *result = NULL, *s, *orig;
|
FcChar8 *result = NULL, *s, *orig;
|
||||||
char *territory, *encoding, *modifier;
|
char *territory, *encoding, *modifier;
|
||||||
size_t llen, tlen = 0, mlen = 0, ssize;
|
size_t llen, tlen = 0, mlen = 0;
|
||||||
|
|
||||||
if (!lang || !*lang)
|
if (!lang || !*lang)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -197,10 +197,6 @@ FcLangNormalize (const FcChar8 *lang)
|
||||||
s = FcStrCopy (lang);
|
s = FcStrCopy (lang);
|
||||||
if (!s)
|
if (!s)
|
||||||
goto bail;
|
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:
|
/* from the comments in glibc:
|
||||||
*
|
*
|
||||||
|
@ -289,8 +285,6 @@ FcLangNormalize (const FcChar8 *lang)
|
||||||
/* we'll miss the opportunity to reduce the correct size
|
/* we'll miss the opportunity to reduce the correct size
|
||||||
* of the allocated memory for the string after that.
|
* 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;
|
s = NULL;
|
||||||
goto bail1;
|
goto bail1;
|
||||||
}
|
}
|
||||||
|
@ -307,8 +301,6 @@ FcLangNormalize (const FcChar8 *lang)
|
||||||
/* we'll miss the opportunity to reduce the correct size
|
/* we'll miss the opportunity to reduce the correct size
|
||||||
* of the allocated memory for the string after that.
|
* 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;
|
s = NULL;
|
||||||
goto bail1;
|
goto bail1;
|
||||||
}
|
}
|
||||||
|
@ -329,8 +321,6 @@ FcLangNormalize (const FcChar8 *lang)
|
||||||
/* we'll miss the opportunity to reduce the correct size
|
/* we'll miss the opportunity to reduce the correct size
|
||||||
* of the allocated memory for the string after that.
|
* 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;
|
s = NULL;
|
||||||
}
|
}
|
||||||
bail1:
|
bail1:
|
||||||
|
@ -338,10 +328,7 @@ FcLangNormalize (const FcChar8 *lang)
|
||||||
FcStrFree (orig);
|
FcStrFree (orig);
|
||||||
bail0:
|
bail0:
|
||||||
if (s)
|
if (s)
|
||||||
{
|
|
||||||
free (s);
|
free (s);
|
||||||
FcMemFree (FC_MEM_STRING, ssize);
|
|
||||||
}
|
|
||||||
bail:
|
bail:
|
||||||
if (FcDebug () & FC_DBG_LANGSET)
|
if (FcDebug () & FC_DBG_LANGSET)
|
||||||
{
|
{
|
||||||
|
@ -465,7 +452,6 @@ FcLangSetCreate (void)
|
||||||
ls = malloc (sizeof (FcLangSet));
|
ls = malloc (sizeof (FcLangSet));
|
||||||
if (!ls)
|
if (!ls)
|
||||||
return 0;
|
return 0;
|
||||||
FcMemAlloc (FC_MEM_LANGSET, sizeof (FcLangSet));
|
|
||||||
memset (ls->map, '\0', sizeof (ls->map));
|
memset (ls->map, '\0', sizeof (ls->map));
|
||||||
ls->map_size = NUM_LANG_SET_MAP;
|
ls->map_size = NUM_LANG_SET_MAP;
|
||||||
ls->extra = 0;
|
ls->extra = 0;
|
||||||
|
@ -477,7 +463,6 @@ FcLangSetDestroy (FcLangSet *ls)
|
||||||
{
|
{
|
||||||
if (ls->extra)
|
if (ls->extra)
|
||||||
FcStrSetDestroy (ls->extra);
|
FcStrSetDestroy (ls->extra);
|
||||||
FcMemFree (FC_MEM_LANGSET, sizeof (FcLangSet));
|
|
||||||
free (ls);
|
free (ls);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
10
src/fclist.c
10
src/fclist.c
|
@ -33,7 +33,6 @@ FcObjectSetCreate (void)
|
||||||
os = (FcObjectSet *) malloc (sizeof (FcObjectSet));
|
os = (FcObjectSet *) malloc (sizeof (FcObjectSet));
|
||||||
if (!os)
|
if (!os)
|
||||||
return 0;
|
return 0;
|
||||||
FcMemAlloc (FC_MEM_OBJECTSET, sizeof (FcObjectSet));
|
|
||||||
os->nobject = 0;
|
os->nobject = 0;
|
||||||
os->sobject = 0;
|
os->sobject = 0;
|
||||||
os->objects = 0;
|
os->objects = 0;
|
||||||
|
@ -57,9 +56,6 @@ FcObjectSetAdd (FcObjectSet *os, const char *object)
|
||||||
objects = (const char **) malloc (s * sizeof (const char *));
|
objects = (const char **) malloc (s * sizeof (const char *));
|
||||||
if (!objects)
|
if (!objects)
|
||||||
return FcFalse;
|
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->objects = objects;
|
||||||
os->sobject = s;
|
os->sobject = s;
|
||||||
}
|
}
|
||||||
|
@ -101,10 +97,8 @@ FcObjectSetDestroy (FcObjectSet *os)
|
||||||
for (i = 0; i < os->nobject; i++)
|
for (i = 0; i < os->nobject; i++)
|
||||||
FcSharedStrFree ((FcChar8 *)os->objects[i]);
|
FcSharedStrFree ((FcChar8 *)os->objects[i]);
|
||||||
|
|
||||||
FcMemFree (FC_MEM_OBJECTPTR, os->sobject * sizeof (const char *));
|
|
||||||
free ((void *) os->objects);
|
free ((void *) os->objects);
|
||||||
}
|
}
|
||||||
FcMemFree (FC_MEM_OBJECTSET, sizeof (FcObjectSet));
|
|
||||||
free (os);
|
free (os);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -342,7 +336,6 @@ FcListHashTableCleanup (FcListHashTable *table)
|
||||||
{
|
{
|
||||||
next = bucket->next;
|
next = bucket->next;
|
||||||
FcPatternDestroy (bucket->pattern);
|
FcPatternDestroy (bucket->pattern);
|
||||||
FcMemFree (FC_MEM_LISTBUCK, sizeof (FcListBucket));
|
|
||||||
free (bucket);
|
free (bucket);
|
||||||
}
|
}
|
||||||
table->buckets[i] = 0;
|
table->buckets[i] = 0;
|
||||||
|
@ -418,7 +411,6 @@ FcListAppend (FcListHashTable *table,
|
||||||
bucket = (FcListBucket *) malloc (sizeof (FcListBucket));
|
bucket = (FcListBucket *) malloc (sizeof (FcListBucket));
|
||||||
if (!bucket)
|
if (!bucket)
|
||||||
goto bail0;
|
goto bail0;
|
||||||
FcMemAlloc (FC_MEM_LISTBUCK, sizeof (FcListBucket));
|
|
||||||
bucket->next = 0;
|
bucket->next = 0;
|
||||||
bucket->hash = hash;
|
bucket->hash = hash;
|
||||||
bucket->pattern = FcPatternCreate ();
|
bucket->pattern = FcPatternCreate ();
|
||||||
|
@ -469,7 +461,6 @@ FcListAppend (FcListHashTable *table,
|
||||||
bail2:
|
bail2:
|
||||||
FcPatternDestroy (bucket->pattern);
|
FcPatternDestroy (bucket->pattern);
|
||||||
bail1:
|
bail1:
|
||||||
FcMemFree (FC_MEM_LISTBUCK, sizeof (FcListBucket));
|
|
||||||
free (bucket);
|
free (bucket);
|
||||||
bail0:
|
bail0:
|
||||||
return FcFalse;
|
return FcFalse;
|
||||||
|
@ -569,7 +560,6 @@ FcFontSetList (FcConfig *config,
|
||||||
if (!FcFontSetAdd (ret, bucket->pattern))
|
if (!FcFontSetAdd (ret, bucket->pattern))
|
||||||
goto bail2;
|
goto bail2;
|
||||||
table.buckets[i] = bucket->next;
|
table.buckets[i] = bucket->next;
|
||||||
FcMemFree (FC_MEM_LISTBUCK, sizeof (FcListBucket));
|
|
||||||
free (bucket);
|
free (bucket);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,6 @@ FcMatrixCopy (const FcMatrix *mat)
|
||||||
r = (FcMatrix *) malloc (sizeof (*r) );
|
r = (FcMatrix *) malloc (sizeof (*r) );
|
||||||
if (!r)
|
if (!r)
|
||||||
return 0;
|
return 0;
|
||||||
FcMemAlloc (FC_MEM_MATRIX, sizeof (FcMatrix));
|
|
||||||
*r = *mat;
|
*r = *mat;
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
@ -47,11 +46,8 @@ void
|
||||||
FcMatrixFree (FcMatrix *mat)
|
FcMatrixFree (FcMatrix *mat)
|
||||||
{
|
{
|
||||||
if (mat != &FcIdentityMatrix)
|
if (mat != &FcIdentityMatrix)
|
||||||
{
|
|
||||||
FcMemFree (FC_MEM_MATRIX, sizeof (FcMatrix));
|
|
||||||
free (mat);
|
free (mat);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
FcBool
|
FcBool
|
||||||
FcMatrixEqual (const FcMatrix *mat1, const FcMatrix *mat2)
|
FcMatrixEqual (const FcMatrix *mat1, const FcMatrix *mat2)
|
||||||
|
|
|
@ -481,7 +481,6 @@ FcNameRegisterConstants (const FcConstant *consts, int nconsts)
|
||||||
l = (FcConstantList *) malloc (sizeof (FcConstantList));
|
l = (FcConstantList *) malloc (sizeof (FcConstantList));
|
||||||
if (!l)
|
if (!l)
|
||||||
return FcFalse;
|
return FcFalse;
|
||||||
FcMemAlloc (FC_MEM_CONSTANT, sizeof (FcConstantList));
|
|
||||||
l->consts = consts;
|
l->consts = consts;
|
||||||
l->nconsts = nconsts;
|
l->nconsts = nconsts;
|
||||||
l->next = _FcConstants;
|
l->next = _FcConstants;
|
||||||
|
@ -501,7 +500,6 @@ FcNameUnregisterConstants (const FcConstant *consts, int nconsts)
|
||||||
if (l->consts == consts && l->nconsts == nconsts)
|
if (l->consts == consts && l->nconsts == nconsts)
|
||||||
{
|
{
|
||||||
*prev = l->next;
|
*prev = l->next;
|
||||||
FcMemFree (FC_MEM_CONSTANT, sizeof (FcConstantList));
|
|
||||||
free ((void *) l);
|
free ((void *) l);
|
||||||
return FcTrue;
|
return FcTrue;
|
||||||
}
|
}
|
||||||
|
|
20
src/fcpat.c
20
src/fcpat.c
|
@ -34,7 +34,6 @@ FcPatternCreate (void)
|
||||||
p = (FcPattern *) malloc (sizeof (FcPattern));
|
p = (FcPattern *) malloc (sizeof (FcPattern));
|
||||||
if (!p)
|
if (!p)
|
||||||
return 0;
|
return 0;
|
||||||
FcMemAlloc (FC_MEM_PATTERN, sizeof (FcPattern));
|
|
||||||
p->num = 0;
|
p->num = 0;
|
||||||
p->size = 0;
|
p->size = 0;
|
||||||
p->elts_offset = FcPtrToOffset (p, NULL);
|
p->elts_offset = FcPtrToOffset (p, NULL);
|
||||||
|
@ -123,15 +122,7 @@ FcValueSave (FcValue v)
|
||||||
FcValueListPtr
|
FcValueListPtr
|
||||||
FcValueListCreate (void)
|
FcValueListCreate (void)
|
||||||
{
|
{
|
||||||
FcValueListPtr ret;
|
return calloc (1, sizeof (FcValueList));
|
||||||
|
|
||||||
ret = calloc (1, sizeof (FcValueList));
|
|
||||||
if (ret)
|
|
||||||
{
|
|
||||||
FcMemAlloc(FC_MEM_VALLIST, sizeof (FcValueList));
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -160,7 +151,6 @@ FcValueListDestroy (FcValueListPtr l)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
next = FcValueListNext(l);
|
next = FcValueListNext(l);
|
||||||
FcMemFree (FC_MEM_VALLIST, sizeof (FcValueList));
|
|
||||||
free(l);
|
free(l);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -382,9 +372,7 @@ FcPatternDestroy (FcPattern *p)
|
||||||
for (i = 0; i < p->num; i++)
|
for (i = 0; i < p->num; i++)
|
||||||
FcValueListDestroy (FcPatternEltValues(&elts[i]));
|
FcValueListDestroy (FcPatternEltValues(&elts[i]));
|
||||||
|
|
||||||
FcMemFree (FC_MEM_PATELT, p->size * sizeof (FcPatternElt));
|
|
||||||
free (elts);
|
free (elts);
|
||||||
FcMemFree (FC_MEM_PATTERN, sizeof (FcPattern));
|
|
||||||
free (p);
|
free (p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -454,9 +442,6 @@ FcPatternObjectInsertElt (FcPattern *p, FcObject object)
|
||||||
if (!e)
|
if (!e)
|
||||||
return FcFalse;
|
return FcFalse;
|
||||||
p->elts_offset = FcPtrToOffset (p, e);
|
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)
|
while (p->size < s)
|
||||||
{
|
{
|
||||||
e[p->size].object = 0;
|
e[p->size].object = 0;
|
||||||
|
@ -662,7 +647,6 @@ FcPatternObjectAddWithBinding (FcPattern *p,
|
||||||
bail2:
|
bail2:
|
||||||
FcValueDestroy (value);
|
FcValueDestroy (value);
|
||||||
bail1:
|
bail1:
|
||||||
FcMemFree (FC_MEM_VALLIST, sizeof (FcValueList));
|
|
||||||
free (new);
|
free (new);
|
||||||
bail0:
|
bail0:
|
||||||
return FcFalse;
|
return FcFalse;
|
||||||
|
@ -1187,7 +1171,6 @@ FcSharedStrFree (const FcChar8 *name)
|
||||||
*p = b->next;
|
*p = b->next;
|
||||||
size = sizeof (struct objectBucket) + strlen ((char *)name) + 1;
|
size = sizeof (struct objectBucket) + strlen ((char *)name) + 1;
|
||||||
size = (size + 3) & ~3;
|
size = (size + 3) & ~3;
|
||||||
FcMemFree (FC_MEM_SHAREDSTR, size);
|
|
||||||
free (b);
|
free (b);
|
||||||
}
|
}
|
||||||
return FcTrue;
|
return FcTrue;
|
||||||
|
@ -1216,7 +1199,6 @@ FcSharedStr (const FcChar8 *name)
|
||||||
*/
|
*/
|
||||||
size = (size + 3) & ~3;
|
size = (size + 3) & ~3;
|
||||||
b = malloc (size);
|
b = malloc (size);
|
||||||
FcMemAlloc (FC_MEM_SHAREDSTR, size);
|
|
||||||
if (!b)
|
if (!b)
|
||||||
return NULL;
|
return NULL;
|
||||||
b->next = 0;
|
b->next = 0;
|
||||||
|
|
21
src/fcstr.c
21
src/fcstr.c
|
@ -44,7 +44,6 @@ FcStrCopy (const FcChar8 *s)
|
||||||
r = (FcChar8 *) malloc (len);
|
r = (FcChar8 *) malloc (len);
|
||||||
if (!r)
|
if (!r)
|
||||||
return 0;
|
return 0;
|
||||||
FcMemAlloc (FC_MEM_STRING, len);
|
|
||||||
memcpy (r, s, len);
|
memcpy (r, s, len);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
@ -59,7 +58,6 @@ FcStrPlus (const FcChar8 *s1, const FcChar8 *s2)
|
||||||
|
|
||||||
if (!s)
|
if (!s)
|
||||||
return 0;
|
return 0;
|
||||||
FcMemAlloc (FC_MEM_STRING, l);
|
|
||||||
memcpy (s, s1, s1l);
|
memcpy (s, s1, s1l);
|
||||||
memcpy (s + s1l, s2, s2l + 1);
|
memcpy (s + s1l, s2, s2l + 1);
|
||||||
return s;
|
return s;
|
||||||
|
@ -68,7 +66,6 @@ FcStrPlus (const FcChar8 *s1, const FcChar8 *s2)
|
||||||
void
|
void
|
||||||
FcStrFree (FcChar8 *s)
|
FcStrFree (FcChar8 *s)
|
||||||
{
|
{
|
||||||
FcMemFree (FC_MEM_STRING, strlen ((char *) s) + 1);
|
|
||||||
free (s);
|
free (s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -204,7 +201,6 @@ FcStrDowncase (const FcChar8 *s)
|
||||||
d = dst = malloc (len + 1);
|
d = dst = malloc (len + 1);
|
||||||
if (!d)
|
if (!d)
|
||||||
return 0;
|
return 0;
|
||||||
FcMemAlloc (FC_MEM_STRING, len + 1);
|
|
||||||
FcStrCaseWalkerInit (s, &w);
|
FcStrCaseWalkerInit (s, &w);
|
||||||
while ((*d++ = FcStrCaseWalkerNext (&w)));
|
while ((*d++ = FcStrCaseWalkerNext (&w)));
|
||||||
return dst;
|
return dst;
|
||||||
|
@ -780,7 +776,6 @@ FcStrBufDestroy (FcStrBuf *buf)
|
||||||
{
|
{
|
||||||
if (buf->allocated)
|
if (buf->allocated)
|
||||||
{
|
{
|
||||||
FcMemFree (FC_MEM_STRBUF, buf->size);
|
|
||||||
free (buf->buf);
|
free (buf->buf);
|
||||||
FcStrBufInit (buf, 0, 0);
|
FcStrBufInit (buf, 0, 0);
|
||||||
}
|
}
|
||||||
|
@ -797,7 +792,6 @@ FcStrBufDone (FcStrBuf *buf)
|
||||||
ret = malloc (buf->len + 1);
|
ret = malloc (buf->len + 1);
|
||||||
if (ret)
|
if (ret)
|
||||||
{
|
{
|
||||||
FcMemAlloc (FC_MEM_STRING, buf->len + 1);
|
|
||||||
memcpy (ret, buf->buf, buf->len);
|
memcpy (ret, buf->buf, buf->len);
|
||||||
ret[buf->len] = '\0';
|
ret[buf->len] = '\0';
|
||||||
}
|
}
|
||||||
|
@ -830,7 +824,6 @@ FcStrBufChar (FcStrBuf *buf, FcChar8 c)
|
||||||
if (buf->allocated)
|
if (buf->allocated)
|
||||||
{
|
{
|
||||||
size = buf->size * 2;
|
size = buf->size * 2;
|
||||||
FcMemFree (FC_MEM_STRBUF, buf->size);
|
|
||||||
new = realloc (buf->buf, size);
|
new = realloc (buf->buf, size);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -848,7 +841,6 @@ FcStrBufChar (FcStrBuf *buf, FcChar8 c)
|
||||||
buf->failed = FcTrue;
|
buf->failed = FcTrue;
|
||||||
return FcFalse;
|
return FcFalse;
|
||||||
}
|
}
|
||||||
FcMemAlloc (FC_MEM_STRBUF, size);
|
|
||||||
buf->size = size;
|
buf->size = size;
|
||||||
buf->buf = new;
|
buf->buf = new;
|
||||||
}
|
}
|
||||||
|
@ -939,7 +931,6 @@ FcStrDirname (const FcChar8 *file)
|
||||||
dir = malloc ((slash - file) + 1);
|
dir = malloc ((slash - file) + 1);
|
||||||
if (!dir)
|
if (!dir)
|
||||||
return 0;
|
return 0;
|
||||||
FcMemAlloc (FC_MEM_STRING, (slash - file) + 1);
|
|
||||||
strncpy ((char *) dir, (const char *) file, slash - file);
|
strncpy ((char *) dir, (const char *) file, slash - file);
|
||||||
dir[slash - file] = '\0';
|
dir[slash - file] = '\0';
|
||||||
return dir;
|
return dir;
|
||||||
|
@ -968,7 +959,6 @@ FcStrCanonAbsoluteFilename (const FcChar8 *s)
|
||||||
file = malloc (size);
|
file = malloc (size);
|
||||||
if (!file)
|
if (!file)
|
||||||
return NULL;
|
return NULL;
|
||||||
FcMemAlloc (FC_MEM_STRING, size);
|
|
||||||
slash = NULL;
|
slash = NULL;
|
||||||
f = file;
|
f = file;
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
@ -1088,7 +1078,6 @@ FcStrSetCreate (void)
|
||||||
FcStrSet *set = malloc (sizeof (FcStrSet));
|
FcStrSet *set = malloc (sizeof (FcStrSet));
|
||||||
if (!set)
|
if (!set)
|
||||||
return 0;
|
return 0;
|
||||||
FcMemAlloc (FC_MEM_STRSET, sizeof (FcStrSet));
|
|
||||||
set->ref = 1;
|
set->ref = 1;
|
||||||
set->num = 0;
|
set->num = 0;
|
||||||
set->size = 0;
|
set->size = 0;
|
||||||
|
@ -1110,14 +1099,10 @@ _FcStrSetAppend (FcStrSet *set, FcChar8 *s)
|
||||||
|
|
||||||
if (!strs)
|
if (!strs)
|
||||||
return FcFalse;
|
return FcFalse;
|
||||||
FcMemAlloc (FC_MEM_STRSET, (set->size + 2) * sizeof (FcChar8 *));
|
|
||||||
if (set->num)
|
if (set->num)
|
||||||
memcpy (strs, set->strs, set->num * sizeof (FcChar8 *));
|
memcpy (strs, set->strs, set->num * sizeof (FcChar8 *));
|
||||||
if (set->strs)
|
if (set->strs)
|
||||||
{
|
|
||||||
FcMemFree (FC_MEM_STRSET, (set->size + 1) * sizeof (FcChar8 *));
|
|
||||||
free (set->strs);
|
free (set->strs);
|
||||||
}
|
|
||||||
set->size = set->size + 1;
|
set->size = set->size + 1;
|
||||||
set->strs = strs;
|
set->strs = strs;
|
||||||
}
|
}
|
||||||
|
@ -1252,11 +1237,7 @@ FcStrSetDestroy (FcStrSet *set)
|
||||||
for (i = 0; i < set->num; i++)
|
for (i = 0; i < set->num; i++)
|
||||||
FcStrFree (set->strs[i]);
|
FcStrFree (set->strs[i]);
|
||||||
if (set->strs)
|
if (set->strs)
|
||||||
{
|
|
||||||
FcMemFree (FC_MEM_STRSET, (set->size + 1) * sizeof (FcChar8 *));
|
|
||||||
free (set->strs);
|
free (set->strs);
|
||||||
}
|
|
||||||
FcMemFree (FC_MEM_STRSET, sizeof (FcStrSet));
|
|
||||||
free (set);
|
free (set);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1269,7 +1250,6 @@ FcStrListCreate (FcStrSet *set)
|
||||||
list = malloc (sizeof (FcStrList));
|
list = malloc (sizeof (FcStrList));
|
||||||
if (!list)
|
if (!list)
|
||||||
return 0;
|
return 0;
|
||||||
FcMemAlloc (FC_MEM_STRLIST, sizeof (FcStrList));
|
|
||||||
list->set = set;
|
list->set = set;
|
||||||
set->ref++;
|
set->ref++;
|
||||||
list->n = 0;
|
list->n = 0;
|
||||||
|
@ -1288,7 +1268,6 @@ void
|
||||||
FcStrListDone (FcStrList *list)
|
FcStrListDone (FcStrList *list)
|
||||||
{
|
{
|
||||||
FcStrSetDestroy (list->set);
|
FcStrSetDestroy (list->set);
|
||||||
FcMemFree (FC_MEM_STRLIST, sizeof (FcStrList));
|
|
||||||
free (list);
|
free (list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
22
src/fcxml.c
22
src/fcxml.c
|
@ -65,7 +65,6 @@ FcTestDestroy (FcTest *test)
|
||||||
if (test->next)
|
if (test->next)
|
||||||
FcTestDestroy (test->next);
|
FcTestDestroy (test->next);
|
||||||
FcExprDestroy (test->expr);
|
FcExprDestroy (test->expr);
|
||||||
FcMemFree (FC_MEM_TEST, sizeof (FcTest));
|
|
||||||
free (test);
|
free (test);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -708,7 +707,6 @@ FcTestCreate (FcConfigParse *parse,
|
||||||
{
|
{
|
||||||
const FcObjectType *o;
|
const FcObjectType *o;
|
||||||
|
|
||||||
FcMemAlloc (FC_MEM_TEST, sizeof (FcTest));
|
|
||||||
test->next = 0;
|
test->next = 0;
|
||||||
test->kind = kind;
|
test->kind = kind;
|
||||||
test->qual = qual;
|
test->qual = qual;
|
||||||
|
@ -759,7 +757,6 @@ FcVStackCreateAndPush (FcConfigParse *parse)
|
||||||
new = malloc (sizeof (FcVStack));
|
new = malloc (sizeof (FcVStack));
|
||||||
if (!new)
|
if (!new)
|
||||||
return 0;
|
return 0;
|
||||||
FcMemAlloc (FC_MEM_VSTACK, sizeof (FcVStack));
|
|
||||||
}
|
}
|
||||||
new->tag = FcVStackNone;
|
new->tag = FcVStackNone;
|
||||||
new->prev = 0;
|
new->prev = 0;
|
||||||
|
@ -984,11 +981,8 @@ FcVStackPopAndDestroy (FcConfigParse *parse)
|
||||||
if (vstack == &parse->vstack_static[parse->vstack_static_used - 1])
|
if (vstack == &parse->vstack_static[parse->vstack_static_used - 1])
|
||||||
parse->vstack_static_used--;
|
parse->vstack_static_used--;
|
||||||
else
|
else
|
||||||
{
|
|
||||||
FcMemFree (FC_MEM_VSTACK, sizeof (FcVStack));
|
|
||||||
free (vstack);
|
free (vstack);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
FcVStackClear (FcConfigParse *parse)
|
FcVStackClear (FcConfigParse *parse)
|
||||||
|
@ -1036,7 +1030,6 @@ FcConfigSaveAttr (const XML_Char **attr, FcChar8 **buf, int size_bytes)
|
||||||
FcConfigMessage (0, FcSevereError, "out of memory");
|
FcConfigMessage (0, FcSevereError, "out of memory");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
FcMemAlloc (FC_MEM_ATTR, 1); /* size is too expensive */
|
|
||||||
}
|
}
|
||||||
s = (FcChar8 *) (new + (i + 1));
|
s = (FcChar8 *) (new + (i + 1));
|
||||||
for (i = 0; attr[i]; i++)
|
for (i = 0; attr[i]; i++)
|
||||||
|
@ -1061,7 +1054,6 @@ FcPStackPush (FcConfigParse *parse, FcElement element, const XML_Char **attr)
|
||||||
new = malloc (sizeof (FcPStack));
|
new = malloc (sizeof (FcPStack));
|
||||||
if (!new)
|
if (!new)
|
||||||
return FcFalse;
|
return FcFalse;
|
||||||
FcMemAlloc (FC_MEM_PSTACK, sizeof (FcPStack));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
new->prev = parse->pstack;
|
new->prev = parse->pstack;
|
||||||
|
@ -1087,18 +1079,12 @@ FcPStackPop (FcConfigParse *parse)
|
||||||
parse->pstack = old->prev;
|
parse->pstack = old->prev;
|
||||||
FcStrBufDestroy (&old->str);
|
FcStrBufDestroy (&old->str);
|
||||||
if (old->attr && old->attr != old->attr_buf_static)
|
if (old->attr && old->attr != old->attr_buf_static)
|
||||||
{
|
|
||||||
FcMemFree (FC_MEM_ATTR, 1); /* size is to expensive */
|
|
||||||
free (old->attr);
|
free (old->attr);
|
||||||
}
|
|
||||||
|
|
||||||
if (old == &parse->pstack_static[parse->pstack_static_used - 1])
|
if (old == &parse->pstack_static[parse->pstack_static_used - 1])
|
||||||
parse->pstack_static_used--;
|
parse->pstack_static_used--;
|
||||||
else
|
else
|
||||||
{
|
|
||||||
FcMemFree (FC_MEM_PSTACK, sizeof (FcPStack));
|
|
||||||
free (old);
|
free (old);
|
||||||
}
|
|
||||||
return FcTrue;
|
return FcTrue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1889,8 +1875,6 @@ FcParseDir (FcConfigParse *parse)
|
||||||
goto bail;
|
goto bail;
|
||||||
}
|
}
|
||||||
prefix = p;
|
prefix = p;
|
||||||
FcMemFree (FC_MEM_STRING, plen + 1);
|
|
||||||
FcMemAlloc (FC_MEM_STRING, plen + 1 + dlen + 1);
|
|
||||||
prefix[plen] = FC_DIR_SEPARATOR;
|
prefix[plen] = FC_DIR_SEPARATOR;
|
||||||
memcpy (&prefix[plen + 1], data, dlen);
|
memcpy (&prefix[plen + 1], data, dlen);
|
||||||
prefix[plen + 1 + dlen] = 0;
|
prefix[plen + 1 + dlen] = 0;
|
||||||
|
@ -1986,8 +1970,6 @@ FcParseCacheDir (FcConfigParse *parse)
|
||||||
goto bail;
|
goto bail;
|
||||||
}
|
}
|
||||||
prefix = p;
|
prefix = p;
|
||||||
FcMemFree (FC_MEM_STRING, plen + 1);
|
|
||||||
FcMemAlloc (FC_MEM_STRING, plen + 1 + dlen + 1);
|
|
||||||
prefix[plen] = FC_DIR_SEPARATOR;
|
prefix[plen] = FC_DIR_SEPARATOR;
|
||||||
memcpy (&prefix[plen + 1], data, dlen);
|
memcpy (&prefix[plen + 1], data, dlen);
|
||||||
prefix[plen + 1 + dlen] = 0;
|
prefix[plen + 1 + dlen] = 0;
|
||||||
|
@ -2005,7 +1987,6 @@ FcParseCacheDir (FcConfigParse *parse)
|
||||||
FcConfigMessage (parse, FcSevereError, "out of memory");
|
FcConfigMessage (parse, FcSevereError, "out of memory");
|
||||||
goto bail;
|
goto bail;
|
||||||
}
|
}
|
||||||
FcMemAlloc (FC_MEM_STRING, 1000);
|
|
||||||
rc = GetTempPath (800, (LPSTR) data);
|
rc = GetTempPath (800, (LPSTR) data);
|
||||||
if (rc == 0 || rc > 800)
|
if (rc == 0 || rc > 800)
|
||||||
{
|
{
|
||||||
|
@ -2035,7 +2016,6 @@ FcParseCacheDir (FcConfigParse *parse)
|
||||||
FcConfigMessage (parse, FcSevereError, "out of memory");
|
FcConfigMessage (parse, FcSevereError, "out of memory");
|
||||||
goto bail;
|
goto bail;
|
||||||
}
|
}
|
||||||
FcMemAlloc (FC_MEM_STRING, len);
|
|
||||||
strncpy((char *) data, szFPath, len);
|
strncpy((char *) data, szFPath, len);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -2089,8 +2069,6 @@ FcParseInclude (FcConfigParse *parse)
|
||||||
goto bail;
|
goto bail;
|
||||||
}
|
}
|
||||||
prefix = p;
|
prefix = p;
|
||||||
FcMemFree (FC_MEM_STRING, plen + 1);
|
|
||||||
FcMemAlloc (FC_MEM_STRING, plen + 1 + dlen + 1);
|
|
||||||
prefix[plen] = FC_DIR_SEPARATOR;
|
prefix[plen] = FC_DIR_SEPARATOR;
|
||||||
memcpy (&prefix[plen + 1], s, dlen);
|
memcpy (&prefix[plen + 1], s, dlen);
|
||||||
prefix[plen + 1 + dlen] = 0;
|
prefix[plen + 1 + dlen] = 0;
|
||||||
|
|
Loading…
Reference in New Issue