#
-# $XFree86: xc/lib/fontconfig/fontconfig/Makefile.in,v 1.2 2002/05/24 06:25:52 keithp Exp $
+# $XFree86: xc/lib/fontconfig/fontconfig/Makefile.in,v 1.3 2002/08/01 15:57:26 keithp Exp $
#
# Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc.
#
all::
install:: $(DESTDIR)$(INCLUDEDIR)
-install:: $(DESTDIR)$(INCLUDEDIR)/fcfreetype.h
-install:: $(DESTDIR)$(INCLUDEDIR)/fcprivate.h
-install:: $(DESTDIR)$(INCLUDEDIR)/fontconfig.h
+ $(INSTALL_DATA) fcfreetype.h $(DESTDIR)$(INCLUDEDIR)/fcfreetype.h
+ $(INSTALL_DATA) fcprivate.h $(DESTDIR)$(INCLUDEDIR)/fcprivate.h
+ $(INSTALL_DATA) fontconfig.h $(DESTDIR)$(INCLUDEDIR)/fontconfig.h
$(DESTDIR)$(INCLUDEDIR):
mkdir -p $@
-$(DESTDIR)$(INCLUDEDIR)/fcfreetype.h: fcfreetype.h
- $(INSTALL_DATA) $< $(DESTDIR)$(INCLUDEDIR)/$<
-
-$(DESTDIR)$(INCLUDEDIR)/fcprivate.h: fcprivate.h
- $(INSTALL_DATA) $< $(DESTDIR)$(INCLUDEDIR)/$<
-
-$(DESTDIR)$(INCLUDEDIR)/fontconfig.h: fontconfig.h
- $(INSTALL_DATA) $< $(DESTDIR)$(INCLUDEDIR)/$<
-
clean::
/*
- * $XFree86: xc/lib/fontconfig/src/fcatomic.c,v 1.1 2002/03/03 00:19:43 keithp Exp $
+ * $XFree86: xc/lib/fontconfig/src/fcatomic.c,v 1.2 2002/03/04 21:15:28 tsi Exp $
*
* Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc.
*
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);
void
FcAtomicDestroy (FcAtomic *atomic)
{
+ FcMemFree (FC_MEM_ATOMIC, sizeof (FcAtomic) +
+ strlen ((char *) atomic->file) * 4 + 1 +
+ sizeof (NEW_NAME) + sizeof (LCK_NAME) +
+ sizeof (TMP_NAME));
+
free (atomic);
}
b = malloc (sizeof (FcBlanks));
if (!b)
return 0;
+ FcMemAlloc (FC_MEM_BLANKS, sizeof (FcBlanks));
b->nblank = 0;
b->sblank = 0;
b->blanks = 0;
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);
}
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;
}
/*
- * $XFree86: xc/lib/fontconfig/src/fccache.c,v 1.11 2002/08/19 19:32:05 keithp Exp $
+ * $XFree86: xc/lib/fontconfig/src/fccache.c,v 1.12 2002/08/22 07:36:44 keithp Exp $
*
* Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
*
}
if (i == size)
{
- FcChar8 *new = malloc (size * 2);
+ FcChar8 *new = malloc (size * 2); /* freed in caller */
if (!new)
break;
memcpy (new, d, size);
len = (dir_len + 1 + strlen ((const char *) file) + 1);
if (len > sizeof (path_buf))
{
- path = malloc (len);
+ path = malloc (len); /* freed down below */
if (!path)
return FcFalse;
}
d = malloc (sizeof (FcGlobalCacheDir) + len + 1);
if (!d)
return 0;
+ FcMemAlloc (FC_MEM_CACHE, sizeof (FcGlobalCacheDir) + len + 1);
d->next = *prev;
*prev = d;
d->info.hash = hash;
strlen ((const char *) i.base) + 1);
if (!subdir)
return 0;
+ FcMemAlloc (FC_MEM_CACHE, sizeof (FcGlobalCacheSubdir) +
+ strlen ((const char *) i.base) + 1);
subdir->file = (FcChar8 *) (subdir + 1);
strcpy ((char *) subdir->file, (const char *) i.base);
subdir->next = parent->subdirs;
for (f = d->ents[h]; f; f = next)
{
next = f->next;
+ FcMemFree (FC_MEM_CACHE, sizeof (FcGlobalCacheFile) +
+ strlen ((char *) f->info.file) + 1 +
+ strlen ((char *) f->name) + 1);
free (f);
}
for (s = d->subdirs; s; s = nexts)
{
nexts = s->next;
+ FcMemFree (FC_MEM_CACHE, sizeof (FcGlobalCacheSubdir) +
+ strlen ((char *) s->file) + 1);
free (s);
}
+ FcMemFree (FC_MEM_CACHE, sizeof (FcGlobalCacheDir) + d->len + 1);
free (d);
}
FcGlobalCacheDir *d = FcGlobalCacheDirGet (cache, i.dir,
i.dir_len, FcTrue);
FcGlobalCacheFile *f, **prev;
+ int size;
if (!d)
return 0;
if (f->info.referenced)
cache->referenced--;
*prev = f->next;
+ FcMemFree (FC_MEM_CACHE, sizeof (FcGlobalCacheFile) +
+ strlen ((char *) f->info.file) + 1 +
+ strlen ((char *) f->name) + 1);
free (f);
}
- f = malloc (sizeof (FcGlobalCacheFile) +
- strlen ((char *) i.base) + 1 +
- strlen ((char *) name) + 1);
+ size = (sizeof (FcGlobalCacheFile) +
+ strlen ((char *) i.base) + 1 +
+ strlen ((char *) name) + 1);
+ f = malloc (size);
if (!f)
return 0;
+ FcMemAlloc (FC_MEM_CACHE, size);
f->next = *prev;
*prev = f;
f->info.hash = i.base_hash;
cache = malloc (sizeof (FcGlobalCache));
if (!cache)
return 0;
+ FcMemAlloc (FC_MEM_CACHE, sizeof (FcGlobalCache));
for (h = 0; h < FC_GLOBAL_CACHE_DIR_HASH_SIZE; h++)
cache->ents[h] = 0;
cache->entries = 0;
FcGlobalCacheDirDestroy (d);
}
}
+ FcMemFree (FC_MEM_CACHE, sizeof (FcGlobalCache));
free (cache);
}
bail2:
fclose (f);
bail1:
- free (cache_file);
+ FcStrFree (cache_file);
bail0:
return ret;
}
if (!name)
goto bail3;
ret = FcCacheWriteString (f, name);
- free (name);
+ FcStrFree (name);
if (!ret)
goto bail3;
if (PUTC ('\n', f) == EOF)
if (fclose (f) == EOF)
goto bail1;
- free (cache_file);
+ FcStrFree (cache_file);
if (FcDebug () & FC_DBG_CACHE)
printf (" cache written\n");
fclose (f);
bail1:
unlink ((char *) cache_file);
- free (cache_file);
+ FcStrFree (cache_file);
bail0:
return FcFalse;
}
/*
- * $XFree86: xc/lib/fontconfig/src/fccfg.c,v 1.21 2002/08/22 07:36:44 keithp Exp $
+ * $XFree86: xc/lib/fontconfig/src/fccfg.c,v 1.22 2002/08/22 18:53:22 keithp Exp $
*
* Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
*
subst = (FcSubst *) malloc (sizeof (FcSubst));
if (!subst)
return FcFalse;
+ FcMemAlloc (FC_MEM_SUBST, sizeof (FcSubst));
if (kind == FcMatchPattern)
prev = &config->substPattern;
else
strcat ((char *) path, "/");
strcat ((char *) path, (char *) file);
+ FcMemAlloc (FC_MEM_STRING, strlen ((char *) path) + 1);
if (access ((char *) path, R_OK) == 0)
return path;
- free (path);
+ FcStrFree (path);
return 0;
}
/*
- * $XFree86: xc/lib/fontconfig/src/fccharset.c,v 1.17 2002/07/13 05:43:25 keithp Exp $
+ * $XFree86: xc/lib/fontconfig/src/fccharset.c,v 1.18 2002/08/22 07:36:44 keithp Exp $
*
* Copyright © 2001 Keith Packard, member of The XFree86 Project, Inc.
*
leaves = realloc (fcs->leaves, (fcs->num + 1) * sizeof (FcCharLeaf *));
if (!leaves)
return FcFalse;
- FcMemAlloc (FC_MEM_CHARSET, sizeof (FcCharLeaf *));
+ if (fcs->num)
+ FcMemFree (FC_MEM_CHARSET, fcs->num * sizeof (FcCharLeaf *));
+ FcMemAlloc (FC_MEM_CHARSET, (fcs->num + 1) * sizeof (FcCharLeaf *));
fcs->leaves = leaves;
if (!fcs->numbers)
numbers = malloc (sizeof (FcChar16));
numbers = realloc (fcs->numbers, (fcs->num + 1) * sizeof (FcChar16));
if (!numbers)
return FcFalse;
- FcMemAlloc (FC_MEM_CHARSET, sizeof (FcChar16));
+ if (fcs->num)
+ FcMemFree (FC_MEM_CHARSET, fcs->num * sizeof (FcChar16));
+ FcMemAlloc (FC_MEM_CHARSET, (fcs->num + 1) * sizeof (FcChar16));
fcs->numbers = numbers;
memmove (fcs->leaves + pos + 1, fcs->leaves + pos,
if (unparse)
{
(void) FcGlobalCacheUpdate (cache, file, id, unparse);
- free (unparse);
+ FcStrFree (unparse);
}
}
}
return FcTrue;
}
+ /* freed below */
file = (FcChar8 *) malloc (strlen ((char *) dir) + 1 + FC_MAX_FILE_LEN + 1);
if (!file)
return FcFalse;
/*
- * $XFree86: xc/lib/fontconfig/src/fcfreetype.c,v 1.9 2002/07/13 05:43:25 keithp Exp $
+ * $XFree86: xc/lib/fontconfig/src/fcfreetype.c,v 1.10 2002/08/22 07:36:44 keithp Exp $
*
* Copyright © 2001 Keith Packard, member of The XFree86 Project, Inc.
*
continue;
/*
- * Allocate plenty of space
+ * Allocate plenty of space. Freed below
*/
utf8 = malloc (len * FC_UTF8_MAX_LEN + 1);
if (!utf8)
break;
case FcNameEncodingLatin1:
/*
- * Convert Latin1 to Utf8
+ * Convert Latin1 to Utf8. Freed below
*/
utf8 = malloc (src_len * 2 + 1);
if (!utf8)
if (!map)
continue;
+ /* freed below */
utf8 = malloc (src_len * 3 + 1);
if (!utf8)
continue;
end = (FcChar8 *) strrchr ((char *) start, '.');
if (!end)
end = start + strlen ((char *) start);
+ /* freed below */
family = malloc (end - start + 1);
strncpy ((char *) family, (char *) start, end - start);
family[end - start] = '\0';
/*
- * $XFree86: xc/lib/fontconfig/src/fcinit.c,v 1.6 2002/05/23 23:00:46 keithp Exp $
+ * $XFree86: xc/lib/fontconfig/src/fcinit.c,v 1.7 2002/08/22 07:36:44 keithp Exp $
*
* Copyright © 2001 Keith Packard, member of The XFree86 Project, Inc.
*
int free_count;
int free_mem;
} FcInUse[FC_MEM_NUM] = {
- { "charset", 0, 0 },
- { "charleaf", 0 ,0 },
- { "fontset", 0, 0 },
- { "fontptr", 0, 0 },
- { "objectset", 0, 0 },
- { "objectptr", 0, 0 },
- { "matrix", 0, 0 },
- { "pattern", 0, 0 },
- { "patelt", 0, 0 },
- { "vallist", 0, 0 },
- { "substate", 0, 0 },
- { "string", 0, 0 },
- { "listbuck", 0, 0 },
- { "strset", 0, 0 },
- { "strlist", 0, 0 },
- { "config", 0, 0 },
- { "langset", 0, 0 },
+ { "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" },
};
static int FcAllocCount, FcAllocMem;
#define FC_MEM_STRLIST 14
#define FC_MEM_CONFIG 15
#define FC_MEM_LANGSET 16
-
-#define FC_MEM_NUM 17
+#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_NUM 29
typedef enum _FcValueBinding {
FcValueBindingWeak, FcValueBindingStrong
/*
- * $XFree86: xc/lib/fontconfig/src/fcmatch.c,v 1.18 2002/08/19 19:32:05 keithp Exp $
+ * $XFree86: xc/lib/fontconfig/src/fcmatch.c,v 1.19 2002/08/22 07:36:44 keithp Exp $
*
* Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
*
}
if (!nnodes)
goto bail0;
+ /* freed below */
nodes = malloc (nnodes * sizeof (FcSortNode) + nnodes * sizeof (FcSortNode *));
if (!nodes)
goto bail0;
/*
- * $XFree86: xc/lib/fontconfig/src/fcname.c,v 1.12 2002/08/19 19:32:05 keithp Exp $
+ * $XFree86: xc/lib/fontconfig/src/fcname.c,v 1.13 2002/08/22 07:36:45 keithp Exp $
*
* Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
*
l = (FcObjectTypeList *) malloc (sizeof (FcObjectTypeList));
if (!l)
return FcFalse;
+ FcMemAlloc (FC_MEM_OBJECTTYPE, sizeof (FcObjectTypeList));
l->types = types;
l->ntypes = ntypes;
l->next = _FcObjectTypes;
if (l->types == types && l->ntypes == ntypes)
{
*prev = l->next;
+ FcMemFree (FC_MEM_OBJECTTYPE, sizeof (FcObjectTypeList));
free ((void *) l);
return FcTrue;
}
l = (FcConstantList *) malloc (sizeof (FcConstantList));
if (!l)
return FcFalse;
+ FcMemAlloc (FC_MEM_CONSTANT, sizeof (FcConstantList));
l->consts = consts;
l->nconsts = nconsts;
l->next = _FcConstants;
if (l->consts == consts && l->nconsts == nconsts)
{
*prev = l->next;
+ FcMemFree (FC_MEM_CONSTANT, sizeof (FcConstantList));
free ((void *) l);
return FcTrue;
}
const FcObjectType *t;
const FcConstant *c;
+ /* freed below */
save = malloc (strlen ((char *) name) + 1);
if (!save)
goto bail0;
/*
- * $XFree86: xc/lib/fontconfig/src/fcpat.c,v 1.13 2002/08/11 18:10:42 keithp Exp $
+ * $XFree86: xc/lib/fontconfig/src/fcpat.c,v 1.15 2002/08/22 07:36:45 keithp Exp $
*
* Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
*
b = (FcPattern *) malloc (size);
if (!b)
return 0;
+ FcMemAlloc (FC_MEM_PATTERN, size);
b->num = p->num;
b->size = b->num;
b->ref = 1;
{
if (buf->allocated)
{
+ FcMemFree (FC_MEM_STRBUF, buf->size);
free (buf->buf);
FcStrBufInit (buf, 0, 0);
}
ret = malloc (buf->len + 1);
if (ret)
{
+ FcMemAlloc (FC_MEM_STRING, buf->len + 1);
memcpy (ret, buf->buf, buf->len);
ret[buf->len] = '\0';
}
buf->failed = FcTrue;
return FcFalse;
}
+ if (buf->size)
+ FcMemFree (FC_MEM_STRBUF, buf->size);
+ FcMemAlloc (FC_MEM_STRBUF, size);
buf->size = size;
buf->buf = new;
}
/*
- * $XFree86: xc/lib/fontconfig/src/fcxml.c,v 1.20 2002/08/20 23:17:03 keithp Exp $
+ * $XFree86: xc/lib/fontconfig/src/fcxml.c,v 1.21 2002/08/22 18:53:22 keithp Exp $
*
* Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc.
*
if (test)
{
+ FcMemAlloc (FC_MEM_TEST, sizeof (FcTest));
test->next = 0;
test->kind = kind;
test->qual = qual;
FcTestDestroy (test->next);
FcExprDestroy (test->expr);
FcStrFree ((FcChar8 *) test->field);
+ FcMemFree (FC_MEM_TEST, sizeof (FcTest));
free (test);
}
if (e)
{
+ FcMemAlloc (FC_MEM_EXPR, sizeof (FcExpr));
e->op = FcOpInteger;
e->u.ival = i;
}
if (e)
{
+ FcMemAlloc (FC_MEM_EXPR, sizeof (FcExpr));
e->op = FcOpDouble;
e->u.dval = d;
}
if (e)
{
+ FcMemAlloc (FC_MEM_EXPR, sizeof (FcExpr));
e->op = FcOpString;
e->u.sval = FcStrCopy (s);
}
if (e)
{
+ FcMemAlloc (FC_MEM_EXPR, sizeof (FcExpr));
e->op = FcOpMatrix;
e->u.mval = FcMatrixCopy (m);
}
if (e)
{
+ FcMemAlloc (FC_MEM_EXPR, sizeof (FcExpr));
e->op = FcOpBool;
e->u.bval = b;
}
if (e)
{
+ FcMemAlloc (FC_MEM_EXPR, sizeof (FcExpr));
e->op = FcOpNil;
}
return e;
if (e)
{
+ FcMemAlloc (FC_MEM_EXPR, sizeof (FcExpr));
e->op = FcOpField;
e->u.field = (char *) FcStrCopy ((FcChar8 *) field);
}
if (e)
{
+ FcMemAlloc (FC_MEM_EXPR, sizeof (FcExpr));
e->op = FcOpConst;
e->u.constant = FcStrCopy (constant);
}
if (e)
{
+ FcMemAlloc (FC_MEM_EXPR, sizeof (FcExpr));
e->op = op;
e->u.tree.left = left;
e->u.tree.right = right;
case FcOpInvalid:
break;
}
+ FcMemFree (FC_MEM_EXPR, sizeof (FcExpr));
free (e);
}
new = malloc (sizeof (FcVStack));
if (!new)
return 0;
+ FcMemAlloc (FC_MEM_VSTACK, sizeof (FcVStack));
new->tag = FcVStackNone;
new->prev = 0;
return new;
FcEditDestroy (vstack->u.edit);
break;
}
+ FcMemFree (FC_MEM_VSTACK, sizeof (FcVStack));
free (vstack);
}
}
new = malloc ((i + 1) * sizeof (FcChar8 *) + slen);
if (!new)
return 0;
+ FcMemAlloc (FC_MEM_ATTR, 1); /* size is too expensive */
s = (FcChar8 *) (new + (i + 1));
for (i = 0; attr[i]; i++)
{
if (!new)
return FcFalse;
+ FcMemAlloc (FC_MEM_PSTACK, sizeof (FcPStack));
new->prev = parse->pstack;
new->element = element;
if (attr)
parse->pstack = old->prev;
FcStrBufDestroy (&old->str);
if (old->attr)
+ {
+ FcMemFree (FC_MEM_ATTR, 1); /* size is to expensive */
free (old->attr);
+ }
+ FcMemFree (FC_MEM_PSTACK, sizeof (FcPStack));
free (old);
return FcTrue;
}
ignore_missing = FcTrue;
if (!FcConfigParseAndLoad (parse->config, s, !ignore_missing))
parse->error = FcTrue;
- free (s);
+ FcStrFree (s);
}
typedef struct _FcOpMap {
}
if (!FcConfigAddDir (parse->config, data))
FcConfigMessage (parse, FcSevereError, "out of memory");
- free (data);
+ FcStrFree (data);
break;
case FcElementCache:
data = FcStrBufDone (&parse->pstack->str);
}
if (!FcConfigSetCache (parse->config, data))
FcConfigMessage (parse, FcSevereError, "out of memory");
- free (data);
+ FcStrFree (data);
break;
case FcElementInclude:
FcParseInclude (parse);
goto bail0;
if (!FcStrSetAdd (config->configFiles, filename))
+ {
+ FcStrFree (filename);
goto bail0;
+ }
f = fopen ((char *) filename, "r");
- free (filename);
+ FcStrFree (filename);
if (!f)
goto bail0;