From: Patrick Lam Date: Fri, 25 Nov 2005 15:50:34 +0000 (+0000) Subject: Pass around FcCache *s to the Unserialize functions for extra consistency X-Git-Tag: fc-2_3_93~26 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=61571f3f2e77ffb221da9af2705af1d383dd6ea0;p=fontconfig.git Pass around FcCache *s to the Unserialize functions for extra consistency (and less overhead, for what that's worth). --- diff --git a/ChangeLog b/ChangeLog index afa95c0..751e9f9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2005-11-25 Patrick Lam + * 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 reviewed by: plam diff --git a/src/fccache.c b/src/fccache.c index fb3f0bb..353bf65 100644 --- a/src/fccache.c +++ b/src/fccache.c @@ -780,7 +780,7 @@ FcDirCacheConsume (int fd, const char * dir, FcFontSet *set) 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); diff --git a/src/fccharset.c b/src/fccharset.c index e152a5a..11e8763 100644 --- a/src/fccharset.c +++ b/src/fccharset.c @@ -1432,28 +1432,28 @@ FcCharSetSerialize(int bank, FcCharSet *c) } 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; } diff --git a/src/fcfs.c b/src/fcfs.c index 83b3e96..a9e300d 100644 --- a/src/fcfs.c +++ b/src/fcfs.c @@ -150,7 +150,7 @@ FcFontSetSerialize (int bank, FcFontSet * s) } FcBool -FcFontSetUnserialize(FcCache metadata, FcFontSet * s, void * block_ptr) +FcFontSetUnserialize(FcCache * metadata, FcFontSet * s, void * block_ptr) { int nfont; int i, n; diff --git a/src/fcint.h b/src/fcint.h index 3019abb..4b01d91 100644 --- a/src/fcint.h +++ b/src/fcint.h @@ -567,7 +567,7 @@ FcCharSet * 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); @@ -670,7 +670,7 @@ FcBool 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 @@ -769,7 +769,7 @@ FcLangSet * FcLangSetSerialize (int bank, FcLangSet *l); void * -FcLangSetUnserialize (FcCache metadata, void *block_ptr); +FcLangSetUnserialize (FcCache * metadata, void *block_ptr); /* fclist.c */ @@ -798,7 +798,7 @@ int FcObjectNeededBytesAlign (void); void * -FcObjectUnserialize (FcCache metadata, void *block_ptr); +FcObjectUnserialize (FcCache * metadata, void *block_ptr); void FcObjectSerialize (void); @@ -902,7 +902,7 @@ FcPattern * FcPatternSerialize (int bank, FcPattern * p); void * -FcPatternUnserialize (FcCache metadata, void *block_ptr); +FcPatternUnserialize (FcCache * metadata, void *block_ptr); /* fcrender.c */ diff --git a/src/fclang.c b/src/fclang.c index 5518821..d7df89d 100644 --- a/src/fclang.c +++ b/src/fclang.c @@ -778,16 +778,16 @@ FcLangSetSerialize(int bank, FcLangSet *l) } 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; } diff --git a/src/fcname.c b/src/fcname.c index 2fc411f..fc3dbd4 100644 --- a/src/fcname.c +++ b/src/fcname.c @@ -364,7 +364,7 @@ FcObjectSerialize () } void * -FcObjectUnserialize (FcCache metadata, void *block_ptr) +FcObjectUnserialize (FcCache * metadata, void *block_ptr) { int new_biggest; new_biggest = *(int *)block_ptr; diff --git a/src/fcpat.c b/src/fcpat.c index b1bb595..ee5910f 100644 --- a/src/fcpat.c +++ b/src/fcpat.c @@ -1447,7 +1447,7 @@ FcStrDistributeBytes (FcCache * metadata, void * 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); @@ -1460,7 +1460,7 @@ FcValueListDistributeBytes (FcCache * metadata, void *block_ptr); static FcValueListPtr FcValueListSerialize(int bank, FcValueList *pi); static void * -FcValueListUnserialize (FcCache metadata, void *block_ptr); +FcValueListUnserialize (FcCache * metadata, void *block_ptr); void @@ -1619,24 +1619,24 @@ FcPatternSerialize (int bank, FcPattern *old) } 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); @@ -1798,19 +1798,19 @@ FcValueListSerialize(int bank, FcValueList *pi) } 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); @@ -1957,17 +1957,17 @@ FcStrSerialize (int bank, const FcChar8 * s) } 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; }