Add padding to make valgrind and glibc not hate each other when calling

strlen().
This commit is contained in:
Patrick Lam 2005-10-06 20:45:25 +00:00
parent edffd3b964
commit 23787a8f1b
3 changed files with 14 additions and 4 deletions

View File

@ -1,3 +1,11 @@
2005-10-06 Patrick Lam <plam@mit.edu>
* src/fcname.c (FcObjectToPtr):
* src/fcpat.c (FcStrStaticName):
Add padding to make valgrind and glibc not hate each other
when calling strlen().
2005-10-05 Simos Xenitellis <simos74@gmx.net> 2005-10-05 Simos Xenitellis <simos74@gmx.net>
reviewed by: plam & keithp reviewed by: plam & keithp

View File

@ -263,8 +263,9 @@ FcObjectToPtr (const char * name)
if (b->hash == hash && !strcmp (name, (char *) (b + 1))) if (b->hash == hash && !strcmp (name, (char *) (b + 1)))
return b->id; return b->id;
size = sizeof (struct objectBucket) + strlen (name) + 1; size = sizeof (struct objectBucket) + strlen (name) + 1;
b = malloc (size); /* workaround glibc bug which reads strlen in groups of 4 */
FcMemAlloc (FC_MEM_STATICSTR, size); b = malloc (size + sizeof (int));
FcMemAlloc (FC_MEM_STATICSTR, size + sizeof(int));
if (!b) if (!b)
return 0; return 0;
b->next = 0; b->next = 0;

View File

@ -1298,8 +1298,9 @@ FcStrStaticName (const FcChar8 *name)
if (b->hash == hash && !strcmp ((char *)name, (char *) (b + 1))) if (b->hash == hash && !strcmp ((char *)name, (char *) (b + 1)))
return (FcChar8 *) (b + 1); return (FcChar8 *) (b + 1);
size = sizeof (struct objectBucket) + strlen ((char *)name) + 1; size = sizeof (struct objectBucket) + strlen ((char *)name) + 1;
b = malloc (size); b = malloc (size + sizeof (int));
FcMemAlloc (FC_MEM_STATICSTR, size); /* workaround glibc bug which reads strlen in groups of 4 */
FcMemAlloc (FC_MEM_STATICSTR, size + sizeof (int));
if (!b) if (!b)
return NULL; return NULL;
b->next = 0; b->next = 0;