free (test);
}
-FcExpr *
-FcExprCreateInteger (int i)
+static FcExpr *
+FcExprAlloc (void)
{
FcExpr *e = (FcExpr *) malloc (sizeof (FcExpr));
+ if (e)
+ FcMemAlloc (FC_MEM_EXPR, sizeof (FcExpr));
+
+ return e;
+}
+
+FcExpr *
+FcExprCreateInteger (int i)
+{
+ FcExpr *e = FcExprAlloc ();
if (e)
{
- FcMemAlloc (FC_MEM_EXPR, sizeof (FcExpr));
e->op = FcOpInteger;
e->u.ival = i;
}
FcExpr *
FcExprCreateDouble (double d)
{
- FcExpr *e = (FcExpr *) malloc (sizeof (FcExpr));
-
+ FcExpr *e = FcExprAlloc ();
if (e)
{
- FcMemAlloc (FC_MEM_EXPR, sizeof (FcExpr));
e->op = FcOpDouble;
e->u.dval = d;
}
FcExpr *
FcExprCreateString (const FcChar8 *s)
{
- FcExpr *e = (FcExpr *) malloc (sizeof (FcExpr));
-
+ FcExpr *e = FcExprAlloc ();
if (e)
{
- FcMemAlloc (FC_MEM_EXPR, sizeof (FcExpr));
e->op = FcOpString;
e->u.sval = FcStrCopy (s);
}
FcExpr *
FcExprCreateMatrix (const FcMatrix *m)
{
- FcExpr *e = (FcExpr *) malloc (sizeof (FcExpr));
-
+ FcExpr *e = FcExprAlloc ();
if (e)
{
- FcMemAlloc (FC_MEM_EXPR, sizeof (FcExpr));
e->op = FcOpMatrix;
e->u.mval = FcMatrixCopy (m);
}
FcExpr *
FcExprCreateBool (FcBool b)
{
- FcExpr *e = (FcExpr *) malloc (sizeof (FcExpr));
-
+ FcExpr *e = FcExprAlloc ();
if (e)
{
- FcMemAlloc (FC_MEM_EXPR, sizeof (FcExpr));
e->op = FcOpBool;
e->u.bval = b;
}
FcExpr *
FcExprCreateNil (void)
{
- FcExpr *e = (FcExpr *) malloc (sizeof (FcExpr));
-
+ FcExpr *e = FcExprAlloc ();
if (e)
{
FcMemAlloc (FC_MEM_EXPR, sizeof (FcExpr));
FcExpr *
FcExprCreateField (const char *field)
{
- FcExpr *e = (FcExpr *) malloc (sizeof (FcExpr));
-
+ FcExpr *e = FcExprAlloc ();
if (e)
{
- FcMemAlloc (FC_MEM_EXPR, sizeof (FcExpr));
e->op = FcOpField;
e->u.object = FcObjectFromName (field);
}
FcExpr *
FcExprCreateConst (const FcChar8 *constant)
{
- FcExpr *e = (FcExpr *) malloc (sizeof (FcExpr));
-
+ FcExpr *e = FcExprAlloc ();
if (e)
{
- FcMemAlloc (FC_MEM_EXPR, sizeof (FcExpr));
e->op = FcOpConst;
e->u.constant = FcStrCopy (constant);
}
FcExpr *
FcExprCreateOp (FcExpr *left, FcOp op, FcExpr *right)
{
- FcExpr *e = (FcExpr *) malloc (sizeof (FcExpr));
-
+ FcExpr *e = FcExprAlloc ();
if (e)
{
- FcMemAlloc (FC_MEM_EXPR, sizeof (FcExpr));
e->op = op;
e->u.tree.left = left;
e->u.tree.right = right;