const char *
FcObjectPtrU (FcObjectPtr p);
-int
-FcObjectPtrCompare (FcObjectPtr a, FcObjectPtr b);
+static __inline__ int
+FcObjectPtrCompare (const FcObjectPtr a, const FcObjectPtr b)
+{
+ return a - b;
+}
void
FcObjectStaticNameFini (void);
void *
FcPatternDistributeBytes (FcCache * metadata, void * block_ptr);
-FcValueList *
-FcValueListPtrU(FcValueListPtr p);
+/* please don't access these outside of fcpat.c! only visible so that
+ * *PtrU can be inlined. */
+extern FcValueList ** fcvaluelists;
+extern FcPatternElt ** fcpatternelts;
+
+static __inline__ FcValueList *
+FcValueListPtrU (FcValueListPtr pi)
+{
+ if (pi.bank == FC_BANK_DYNAMIC)
+ return pi.u.dyn;
+
+ return &fcvaluelists[FcCacheBankToIndex(pi.bank)][pi.u.stat];
+}
+
+static __inline__ FcPatternElt *
+FcPatternEltU (FcPatternEltPtr pei)
+{
+ if (pei.bank == FC_BANK_DYNAMIC)
+ return pei.u.dyn;
+
+ return &fcpatternelts[FcCacheBankToIndex(pei.bank)][pei.u.stat];
+}
FcPatternElt *
FcPatternEltU (FcPatternEltPtr pei);
#include <stdio.h>
static double
-FcCompareNumber (const char *object, FcValue *value1, FcValue *value2)
+FcCompareNumber (FcValue *value1, FcValue *value2)
{
double v1, v2, v;
}
static double
-FcCompareString (const char *object, FcValue *v1, FcValue *v2)
+FcCompareString (FcValue *v1, FcValue *v2)
{
return (double) FcStrCmpIgnoreCase (fc_value_string(v1), fc_value_string(v2)) != 0;
}
static double
-FcCompareFamily (const char *object, FcValue *v1, FcValue *v2)
+FcCompareFamily (FcValue *v1, FcValue *v2)
{
/* rely on the guarantee in FcPatternAddWithBinding that
* families are always FcTypeString. */
}
static double
-FcCompareLang (const char *object, FcValue *v1, FcValue *v2)
+FcCompareLang (FcValue *v1, FcValue *v2)
{
FcLangResult result;
FcValue value1 = FcValueCanonicalize(v1), value2 = FcValueCanonicalize(v2);
}
static double
-FcCompareBool (const char *object, FcValue *v1, FcValue *v2)
+FcCompareBool (FcValue *v1, FcValue *v2)
{
if (fc_storage_type(v2) != FcTypeBool || fc_storage_type(v1) != FcTypeBool)
return -1.0;
}
static double
-FcCompareCharSet (const char *object, FcValue *v1, FcValue *v2)
+FcCompareCharSet (FcValue *v1, FcValue *v2)
{
return (double) FcCharSetSubtractCount (fc_value_charset(v1), fc_value_charset(v2));
}
static double
-FcCompareSize (const char *object, FcValue *value1, FcValue *value2)
+FcCompareSize (FcValue *value1, FcValue *value2)
{
double v1, v2, v;
typedef struct _FcMatcher {
const char *object;
- double (*compare) (const char *object, FcValue *value1, FcValue *value2);
+ double (*compare) (FcValue *value1, FcValue *value2);
int strong, weak;
} FcMatcher;
for (v2 = v2orig, v2_ptrU = FcValueListPtrU(v2); FcValueListPtrU(v2);
v2 = FcValueListPtrU(v2)->next)
{
- v = (*_FcMatchers[i].compare) (_FcMatchers[i].object,
- &v1_ptrU->value,
+ v = (*_FcMatchers[i].compare) (&v1_ptrU->value,
&v2_ptrU->value);
if (v < 0)
{
i2 = 0;
while (i1 < pat->num && i2 < fnt->num)
{
- i = FcObjectPtrCompare((FcPatternEltU(pat->elts)+i1)->object,
- (FcPatternEltU(fnt->elts)+i2)->object);
+ FcPatternElt *elt_i1 = FcPatternEltU(pat->elts)+i1;
+ FcPatternElt *elt_i2 = FcPatternEltU(fnt->elts)+i2;
+
+ i = FcObjectPtrCompare(elt_i1->object, elt_i2->object);
if (i > 0)
i2++;
else if (i < 0)
i1++;
else
{
- if (!FcCompareValueList (FcObjectPtrU((FcPatternEltU(pat->elts)+i1)->object),
- (FcPatternEltU(pat->elts)+i1)->values,
- (FcPatternEltU(fnt->elts)+i2)->values,
- 0,
- value,
- result))
+ if (!FcCompareValueList (FcObjectPtrU(elt_i1->object),
+ elt_i1->values, elt_i2->values,
+ 0, value, result))
return FcFalse;
i1++;
i2++;
}
}
return FcTrue;
-#if 0
- for (i1 = 0; i1 < pat->num; i1++)
- {
- for (i2 = 0; i2 < fnt->num; i2++)
- {
- if (!strcmp (pat->elts[i1].object, fnt->elts[i2].object))
- {
- break;
- }
- }
- }
- return FcTrue;
-#endif
}
FcPattern *
FcPatternGet (p, FC_LANG, i, &patternLang) == FcResultMatch &&
FcPatternGet (nodeps[f]->pattern, FC_LANG, 0, &nodeLang) == FcResultMatch)
{
- double compare = FcCompareLang (FC_LANG, &patternLang,
- &nodeLang);
+ double compare = FcCompareLang (&patternLang, &nodeLang);
if (compare >= 0 && compare < 2)
{
if (FcDebug () & FC_DBG_MATCHV)
static const FcObjectTypeList _FcBaseObjectTypesList = {
0,
_FcBaseObjectTypes,
- NUM_OBJECT_TYPES
+ NUM_OBJECT_TYPES,
+ 0
};
static const FcObjectTypeList *_FcObjectTypes = &_FcBaseObjectTypesList;
return block_ptr;
}
-int
-FcObjectPtrCompare (const FcObjectPtr a, const FcObjectPtr b)
-{
- return a - b;
-}
-
static const FcConstant _FcBaseConstants[] = {
{ (FcChar8 *) "thin", "weight", FC_WEIGHT_THIN, },
{ (FcChar8 *) "extralight", "weight", FC_WEIGHT_EXTRALIGHT, },
static FcBool
FcNameUnparseValue (FcStrBuf *buf,
- int bank,
FcValue *v0,
FcChar8 *escape)
{
{
while (FcValueListPtrU(v))
{
- if (!FcNameUnparseValue (buf, v.bank, &FcValueListPtrU(v)->value, escape))
+ if (!FcNameUnparseValue (buf, &FcValueListPtrU(v)->value, escape))
return FcFalse;
if (FcValueListPtrU(v = FcValueListPtrU(v)->next))
if (!FcNameUnparseString (buf, (FcChar8 *) ",", 0))
static FcPattern ** fcpatterns = 0;
static int fcpattern_bank_count = 0, fcpattern_ptr, fcpattern_count;
-static FcPatternElt ** fcpatternelts = 0;
+FcPatternElt ** fcpatternelts = 0;
static int fcpatternelt_ptr, fcpatternelt_count;
-static FcValueList ** fcvaluelists = 0;
+FcValueList ** fcvaluelists = 0;
static int fcvaluelist_bank_count = 0, fcvaluelist_ptr, fcvaluelist_count;
static const char *
FcObjectStaticNameFini ();
}
-FcPatternElt *
-FcPatternEltU (FcPatternEltPtr pei)
-{
- if (pei.bank == FC_BANK_DYNAMIC)
- return pei.u.dyn;
-
- return &fcpatternelts[FcCacheBankToIndex(pei.bank)][pei.u.stat];
-}
-
static FcPatternEltPtr
FcPatternEltPtrCreateDynamic (FcPatternElt * e)
{
return block_ptr;
}
-FcValueList *
-FcValueListPtrU (FcValueListPtr pi)
-{
- if (pi.bank == FC_BANK_DYNAMIC)
- return pi.u.dyn;
-
- return &fcvaluelists[FcCacheBankToIndex(pi.bank)][pi.u.stat];
-}
-
FcValueListPtr
FcValueListPtrCreateDynamic(FcValueList * p)
{