(and less overhead, for what that's worth).
+2005-11-25 Patrick Lam <plam@mit.edu>
+ * src/fcint.h:
+ * src/fccache.c (FcDirCacheConsume):
+ * src/fccharset.c (FcCharSetUnserialize):
+ * src/fcfs.c (FcFontSetUnserialize):
+ * src/fclang.c (FcLangSetUnserialize):
+ * src/fcname.c (FcObjectUnserialize):
+ * src/fcpat.c (FcStrUnserialize, FcValueListUnserialize,
+ FcPatternUnserialize):
+
+ Pass around FcCache *s to the Unserialize functions for extra
+ consistency (and less overhead, for what that's worth).
+
2005-11-24 Dirk Mueller <dmueller@suse.com>
reviewed by: plam
if (current_dir_block == MAP_FAILED)
return FcFalse;
- if (!FcFontSetUnserialize (metadata, set, current_dir_block))
+ if (!FcFontSetUnserialize (&metadata, set, current_dir_block))
return FcFalse;
FcCacheAddBankDir (metadata.bank, dir);
}
void *
-FcCharSetUnserialize (FcCache metadata, void *block_ptr)
+FcCharSetUnserialize (FcCache *metadata, void *block_ptr)
{
- int bi = FcCacheBankToIndex(metadata.bank);
+ int bi = FcCacheBankToIndex(metadata->bank);
if (!FcCharSetEnsureBank(bi))
return 0;
block_ptr = ALIGN (block_ptr, FcCharSet);
charsets[bi] = (FcCharSet *)block_ptr;
block_ptr = (void *)((char *)block_ptr +
- (sizeof (FcCharSet) * metadata.charset_count));
+ (sizeof (FcCharSet) * metadata->charset_count));
block_ptr = ALIGN (block_ptr, FcChar16);
numbers[bi] = (FcChar16 *)block_ptr;
block_ptr = (void *)((char *)block_ptr +
- (sizeof(FcChar16) * metadata.charset_numbers_count));
+ (sizeof(FcChar16) * metadata->charset_numbers_count));
block_ptr = ALIGN (block_ptr, FcCharLeaf);
leaves[bi] = (FcCharLeaf *)block_ptr;
block_ptr = (void *)((char *)block_ptr +
- (sizeof(FcCharLeaf) * metadata.charset_leaf_count));
+ (sizeof(FcCharLeaf) * metadata->charset_leaf_count));
block_ptr = ALIGN (block_ptr, int);
leaf_idx[bi] = (int *)block_ptr;
block_ptr = (void *)((char *)block_ptr +
- (sizeof(int) * metadata.charset_leaf_idx_count));
+ (sizeof(int) * metadata->charset_leaf_idx_count));
return block_ptr;
}
}
FcBool
-FcFontSetUnserialize(FcCache metadata, FcFontSet * s, void * block_ptr)
+FcFontSetUnserialize(FcCache * metadata, FcFontSet * s, void * block_ptr)
{
int nfont;
int i, n;
FcCharSetSerialize(int bank, FcCharSet *c);
void *
-FcCharSetUnserialize (FcCache metadata, void *block_ptr);
+FcCharSetUnserialize (FcCache * metadata, void *block_ptr);
FcCharLeaf *
FcCharSetGetLeaf(const FcCharSet *c, int i);
FcFontSetSerialize (int bank, FcFontSet * s);
FcBool
-FcFontSetUnserialize(FcCache metadata, FcFontSet * s, void * block_ptr);
+FcFontSetUnserialize(FcCache * metadata, FcFontSet * s, void * block_ptr);
/* fcgram.y */
int
FcLangSetSerialize (int bank, FcLangSet *l);
void *
-FcLangSetUnserialize (FcCache metadata, void *block_ptr);
+FcLangSetUnserialize (FcCache * metadata, void *block_ptr);
/* fclist.c */
FcObjectNeededBytesAlign (void);
void *
-FcObjectUnserialize (FcCache metadata, void *block_ptr);
+FcObjectUnserialize (FcCache * metadata, void *block_ptr);
void
FcObjectSerialize (void);
FcPatternSerialize (int bank, FcPattern * p);
void *
-FcPatternUnserialize (FcCache metadata, void *block_ptr);
+FcPatternUnserialize (FcCache * metadata, void *block_ptr);
/* fcrender.c */
}
void *
-FcLangSetUnserialize (FcCache metadata, void *block_ptr)
+FcLangSetUnserialize (FcCache * metadata, void *block_ptr)
{
- int bi = FcCacheBankToIndex(metadata.bank);
+ int bi = FcCacheBankToIndex(metadata->bank);
if (!FcLangSetEnsureBank(bi))
return 0;
- FcMemAlloc (FC_MEM_LANGSET, metadata.langset_count * sizeof(FcLangSet));
+ FcMemAlloc (FC_MEM_LANGSET, metadata->langset_count * sizeof(FcLangSet));
block_ptr = ALIGN(block_ptr, FcLangSet);
langsets[bi] = (FcLangSet *)block_ptr;
block_ptr = (void *)((char *)block_ptr +
- metadata.langset_count * sizeof(FcLangSet));
+ metadata->langset_count * sizeof(FcLangSet));
return block_ptr;
}
}
void *
-FcObjectUnserialize (FcCache metadata, void *block_ptr)
+FcObjectUnserialize (FcCache * metadata, void *block_ptr)
{
int new_biggest;
new_biggest = *(int *)block_ptr;
static const FcChar8 *
FcStrSerialize (int bank, const FcChar8 * s);
static void *
-FcStrUnserialize (FcCache metadata, void *block_ptr);
+FcStrUnserialize (FcCache * metadata, void *block_ptr);
static void
FcValueListNewBank (void);
static FcValueListPtr
FcValueListSerialize(int bank, FcValueList *pi);
static void *
-FcValueListUnserialize (FcCache metadata, void *block_ptr);
+FcValueListUnserialize (FcCache * metadata, void *block_ptr);
void
}
void *
-FcPatternUnserialize (FcCache metadata, void *block_ptr)
+FcPatternUnserialize (FcCache * metadata, void *block_ptr)
{
- int bi = FcCacheBankToIndex(metadata.bank);
+ int bi = FcCacheBankToIndex(metadata->bank);
if (!FcPatternEnsureBank(bi))
return FcFalse;
- FcMemAlloc (FC_MEM_PATTERN, sizeof (FcPattern) * metadata.pattern_count);
+ 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));
+ (sizeof (FcPattern) * metadata->pattern_count));
FcMemAlloc (FC_MEM_PATELT,
- sizeof (FcPatternElt) * metadata.patternelt_count);
+ 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));
+ (sizeof (FcPatternElt) * metadata->patternelt_count));
block_ptr = FcStrUnserialize (metadata, block_ptr);
block_ptr = FcValueListUnserialize (metadata, block_ptr);
}
static void *
-FcValueListUnserialize (FcCache metadata, void *block_ptr)
+FcValueListUnserialize (FcCache * metadata, void *block_ptr)
{
- int bi = FcCacheBankToIndex(metadata.bank);
+ int bi = FcCacheBankToIndex(metadata->bank);
if (!FcValueListEnsureBank(bi))
return 0;
FcMemAlloc (FC_MEM_VALLIST,
- sizeof (FcValueList) * metadata.valuelist_count);
+ 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));
+ (sizeof (FcValueList) * metadata->valuelist_count));
block_ptr = FcCharSetUnserialize(metadata, block_ptr);
block_ptr = FcLangSetUnserialize(metadata, block_ptr);
}
static void *
-FcStrUnserialize (FcCache metadata, void *block_ptr)
+FcStrUnserialize (FcCache * metadata, void *block_ptr)
{
- int bi = FcCacheBankToIndex(metadata.bank);
+ int bi = FcCacheBankToIndex(metadata->bank);
if (!FcStrEnsureBank(bi))
return 0;
- FcMemAlloc (FC_MEM_STRING, sizeof (char) * metadata.str_count);
+ 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));
+ (sizeof (char) * metadata->str_count));
return block_ptr;
}