Commit 61571f3f authored by Patrick Lam's avatar Patrick Lam

Pass around FcCache *s to the Unserialize functions for extra consistency

    (and less overhead, for what that's worth).
parent 9ab79bdf
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
......
......@@ -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);
......
......@@ -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;
}
......
......@@ -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;
......
......@@ -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 */
......
......@@ -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;
}
......@@ -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;
......
......@@ -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;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment