if (FcPatternFindFullFname (p))
{
- FcStrFree (FcPatternFindFullFname (p));
+ FcStrFree ((FcChar8 *)FcPatternFindFullFname (p));
FcPatternAddFullFname (p, 0);
}
FcValueCanonicalize(&FcValueListPtrU(l)->value),
FcTrue))
goto bail1;
-
- if (!strcmp ((char *)FcObjectPtrU((e + i)->object), FC_FILE))
- {
- FcChar8 * s;
- FcPatternGetString (orig, FC_FILE, 0, &s);
- FcPatternAddFullFname (new, FcPatternFindFullFname(orig));
- }
}
+ 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;
{
FcChar8 * s;
FcPatternGetString (orig, FC_FILE, 0, &s);
- FcPatternAddFullFname (new, FcStrCopy (FcPatternFindFullFname(orig)));
+ FcPatternAddFullFname (new,
+ (char *)FcStrCopy
+ ((FcChar8 *)FcPatternFindFullFname(orig)));
}