if (value.type == FcTypeVoid)
goto bail1;
+ /* quick and dirty hack to enable FcCompareFamily speedup:
+ * only allow strings to be added under the FC_FAMILY key.
+ * a better hack would use FcBaseObjectTypes to check all objects. */
+ if (FcObjectToPtr(object) == FcObjectToPtr(FC_FAMILY) &&
+ value.type != FcTypeString)
+ goto bail1;
+
FcValueListPtrU(new)->value = value;
FcValueListPtrU(new)->binding = binding;
FcValueListPtrU(new)->next = FcValueListPtrCreateDynamic(0);
FcTrue))
goto bail1;
}
- FcPatternTransferFullFname (orig, new);
+ FcPatternTransferFullFname (new, orig);
return new;
FcStrNewBank (void);
static int
FcStrNeededBytes (const FcChar8 * s);
+static int
+FcStrNeededBytesAlign (void);
static void *
FcStrDistributeBytes (FcCache * metadata, void * block_ptr);
static const FcChar8 *
FcValueListNewBank (void);
static int
FcValueListNeededBytes (FcValueList * vl);
+static int
+FcValueListNeededBytesAlign (void);
static void *
FcValueListDistributeBytes (FcCache * metadata, void *block_ptr);
static FcValueListPtr
return cum + sizeof (FcPattern) + sizeof(FcPatternElt)*p->num;
}
+int
+FcPatternNeededBytesAlign (void)
+{
+ return __alignof__ (FcPattern) + __alignof__ (FcPatternElt) +
+ FcValueListNeededBytesAlign ();
+}
+
static FcBool
FcPatternEnsureBank (int bi)
{
return 0;
fcpattern_ptr = 0;
+ block_ptr = ALIGN(block_ptr, FcPattern);
fcpatterns[bi] = (FcPattern *)block_ptr;
block_ptr = (void *)((char *)block_ptr +
(sizeof (FcPattern) * fcpattern_count));
FcMemAlloc (FC_MEM_PATELT, sizeof (FcPatternElt) * fcpatternelt_count);
fcpatternelt_ptr = 0;
+ block_ptr = ALIGN(block_ptr, FcPatternElt);
fcpatternelts[bi] = (FcPatternElt *)block_ptr;
block_ptr = (void *)((char *)block_ptr +
(sizeof (FcPatternElt) * fcpatternelt_count));
return FcFalse;
FcMemAlloc (FC_MEM_PATTERN, sizeof (FcPattern) * metadata.pattern_count);
+ block_ptr = ALIGN(block_ptr, FcPattern);
fcpatterns[bi] = (FcPattern *)block_ptr;
block_ptr = (void *)((char *)block_ptr +
(sizeof (FcPattern) * metadata.pattern_count));
FcMemAlloc (FC_MEM_PATELT,
sizeof (FcPatternElt) * metadata.patternelt_count);
+ block_ptr = ALIGN(block_ptr, FcPatternElt);
fcpatternelts[bi] = (FcPatternElt *)block_ptr;
block_ptr = (void *)((char *)block_ptr +
(sizeof (FcPatternElt) * metadata.patternelt_count));
return cum;
}
+static int
+FcValueListNeededBytesAlign (void)
+{
+ return FcCharSetNeededBytesAlign() + FcLangSetNeededBytesAlign() +
+ FcStrNeededBytesAlign() + __alignof__ (FcValueList);
+}
+
static FcBool
FcValueListEnsureBank (int bi)
{
FcMemAlloc (FC_MEM_VALLIST, sizeof (FcValueList) * fcvaluelist_count);
fcvaluelist_ptr = 0;
+ block_ptr = ALIGN(block_ptr, FcValueList);
fcvaluelists[bi] = (FcValueList *)block_ptr;
block_ptr = (void *)((char *)block_ptr +
(sizeof (FcValueList) * fcvaluelist_count));
FcMemAlloc (FC_MEM_VALLIST,
sizeof (FcValueList) * metadata.valuelist_count);
+ block_ptr = ALIGN(block_ptr, FcValueList);
fcvaluelists[bi] = (FcValueList *)block_ptr;
block_ptr = (void *)((char *)block_ptr +
(sizeof (FcValueList) * metadata.valuelist_count));
b->next = 0;
b->hash = hash;
strcpy ((char *) (b + 1), (char *)s);
+
+ /* Yes, the following line is convoluted. However, it is
+ * incorrect to replace the with a memset, because the C
+ * specification doesn't guarantee that the null pointer is
+ * the same as the zero bit pattern. */
*(char **)((char *) (b + 1) + strlen((char *)s) + 1) = 0;
*p = b;
return strlen((char *)s) + 1;
}
+static int
+FcStrNeededBytesAlign (void)
+{
+ return __alignof__ (char);
+}
+
static FcBool
FcStrEnsureBank (int bi)
{
return 0;
FcMemAlloc (FC_MEM_STRING, sizeof (char) * fcstr_count);
+ block_ptr = ALIGN (block_ptr, FcChar8);
static_strs[bi] = (FcChar8 *)block_ptr;
block_ptr = (void *)((char *)block_ptr + (sizeof (char) * fcstr_count));
metadata->str_count = fcstr_count;
return 0;
FcMemAlloc (FC_MEM_STRING, sizeof (char) * metadata.str_count);
+ block_ptr = ALIGN (block_ptr, FcChar8);
static_strs[bi] = (FcChar8 *)block_ptr;
block_ptr = (void *)((char *)block_ptr +
(sizeof (char) * metadata.str_count));