-FcBool
-FcObjectRead (int fd, FcCache metadata)
-{
- /* do we have to merge strings?
- * it's possible to merge dynamic strings, as long as we only store
- * static strings to disk and as long as all static strings have lower
- * ids than any dynamic strings. */
-
- objectcontent_dynamic_count = 1;
- objectcontent_dynamic_alloc = 0;
- objectcontent_dynamic = 0;
- objectcontent_dynamic_refcount = 0;
-
- /* well, we do need to allocate dynamic strings all the time,
- * so this would just have to be converted. It takes 1.4k on
- * my system. - PL */
-/* objectptr_indices = mmap(NULL, */
-/* metadata.object_length * sizeof (int), */
-/* PROT_READ, */
-/* MAP_SHARED, fd, metadata.object_offset); */
-/* if (objectptr_indices == MAP_FAILED) */
-/* goto bail; */
-
- objectptr_count = metadata.object_length;
- objectptr_alloc = metadata.object_length;
- objectptr_indices = malloc (metadata.object_length * sizeof (int));
- if (!objectptr_indices)
- goto bail;
- FcMemAlloc (FC_MEM_STATICSTR, metadata.object_length * sizeof (int));
- lseek (fd, metadata.object_offset, SEEK_SET);
- read (fd, objectptr_indices, metadata.object_length * sizeof (int));
-
- objectcontent_static_buf =
- mmap(NULL,
- metadata.objectcontent_length * sizeof (char),
- PROT_READ,
- MAP_SHARED, fd, metadata.objectcontent_offset);
- if (objectptr_indices == MAP_FAILED)
- goto bail1;
- objectcontent_static_bytes = metadata.objectcontent_length;
-
- FcObjectRebuildStaticNameHashtable ();
-
- return FcTrue;
-
- bail1:
- /*munmap(objectptr_indices, metadata.object_length * sizeof(int));*/
- free (objectptr_indices);
- bail:
- return FcFalse;
+ for (p = &FcStrBuckets[hash % OBJECT_HASH_SIZE]; (b = *p); p = &(b->next))
+ if (b->hash == hash && !strcmp (s, (char *) (b + 1)))
+ {
+ char * t = *(char **)(((char *)(b + 1)) + strlen (s) + 1);
+ if (!t)
+ {
+ strcpy(static_strs[bi] + fcstr_ptr, s);
+ *(char **)((char *) (b + 1) + strlen(s) + 1) = (static_strs[bi] + fcstr_ptr);
+ fcstr_ptr += strlen(s) + 1;
+ t = *(char **)(((char *)(b + 1)) + strlen (s) + 1);
+ }
+ return t;
+ }
+ return 0;