/*
- * $XFree86: xc/lib/fontconfig/src/fcxml.c,v 1.17 2002/07/31 01:36:37 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.
*
#include <stdarg.h>
#include "fcint.h"
-#ifndef HAVE_EXPAT
-#define HAVE_EXPAT 1
-#endif
-
-#ifndef HAVE_XML2
-#define HAVE_XML2 0
-#endif
-
-#if HAVE_EXPAT
#ifndef HAVE_XMLPARSE_H
#define HAVE_XMLPARSE_H 0
#endif
+
#if HAVE_XMLPARSE_H
#include <xmlparse.h>
#else
#include <expat.h>
#endif
-#endif
-
-#if HAVE_XML2
-#include "fclibxml2.h"
-#endif
FcTest *
FcTestCreate (FcMatchKind kind,
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 FcOpOr:
case FcOpAnd:
case FcOpEqual:
- case FcOpContains:
case FcOpNotEqual:
case FcOpLess:
case FcOpLessEqual:
case FcOpMore:
case FcOpMoreEqual:
+ case FcOpContains:
+ case FcOpNotContains:
case FcOpPlus:
case FcOpMinus:
case FcOpTimes:
case FcOpInvalid:
break;
}
+ FcMemFree (FC_MEM_EXPR, sizeof (FcExpr));
free (e);
}
FcElementLessEq,
FcElementMore,
FcElementMoreEq,
+ FcElementContains,
+ FcElementNotContains,
FcElementPlus,
FcElementMinus,
FcElementTimes,
{ "less_eq", FcElementLessEq },
{ "more", FcElementMore },
{ "more_eq", FcElementMoreEq },
+ { "contains", FcElementContains },
+ { "not_contains",FcElementNotContains },
{ "plus", FcElementPlus },
{ "minus", FcElementMinus },
{ "times", FcElementTimes },
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;
}
case m_yy: m.yy = v; break;
default: break;
}
+ FcVStackDestroy (vstack);
matrix_state--;
}
if (matrix_state != m_done)
ignore_missing = FcTrue;
if (!FcConfigParseAndLoad (parse->config, s, !ignore_missing))
parse->error = FcTrue;
- free (s);
+ FcStrFree (s);
}
typedef struct _FcOpMap {
{ "less", FcOpLess },
{ "less_eq", FcOpLessEqual },
{ "more", FcOpMore },
- { "more_eq", FcOpMoreEqual }
+ { "more_eq", FcOpMoreEqual },
+ { "contains", FcOpContains },
+ { "not_contains", FcOpNotContains }
};
#define NUM_COMPARE_OPS (sizeof fcCompareOps / sizeof fcCompareOps[0])
binding = FcValueBindingWeak;
else if (!strcmp ((char *) binding_string, "strong"))
binding = FcValueBindingStrong;
+ else if (!strcmp ((char *) binding_string, "same"))
+ binding = FcValueBindingSame;
else
{
FcConfigMessage (parse, FcSevereWarning, "invalid edit binding \"%s\"", binding_string);
}
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);
case FcElementMoreEq:
FcParseExpr (parse, FcOpMoreEqual);
break;
+ case FcElementContains:
+ FcParseExpr (parse, FcOpContains);
+ break;
+ case FcElementNotContains:
+ FcParseExpr (parse, FcOpNotContains);
+ break;
case FcElementPlus:
FcParseExpr (parse, FcOpPlus);
break;
goto bail0;
if (!FcStrSetAdd (config->configFiles, filename))
+ {
+ FcStrFree (filename);
goto bail0;
+ }
f = fopen ((char *) filename, "r");
- free (filename);
+ FcStrFree (filename);
if (!f)
goto bail0;