+2006-04-14 Patrick Lam <plam@mit.edu>
+ * src/fcname.c (FcObjectToPtrLookup):
+
+ Fix Gecko-exposed segfault from my last hack to
+ FcObjectToPtrLookup. Simplify code and get things straight.
+
2006-04-14 Patrick Lam <plam@mit.edu>
* fonts.conf.in:
{
FcObjectPtr i = 0, n;
const FcObjectTypeList *l;
- FcObjectType *t = _FcUserObjectNames, *origNames;
+ FcObjectType *t = _FcUserObjectNames;
FcBool replace;
for (l = _FcObjectTypes; l; l = l->next)
t = (FcObjectType *)&l->types[i];
if (!strcmp (object, t->object))
{
- if (l == (FcObjectTypeList*)_FcUserObjectNames)
+ if (l->types == _FcUserObjectNames)
return -i;
else
return l->basic_offset + i;
/* We didn't match. Look for the application's FcObjectTypeList
* and replace it in-place. */
- origNames = _FcUserObjectNames;
for (l = _FcObjectTypes; l; l = l->next)
{
if (l->types == _FcUserObjectNames)
FcNameRegisterObjectTypes (_FcUserObjectNames, n+1);
- for (l = _FcObjectTypes; l; l = l->next)
- {
- if (l->types == origNames)
- {
- t = (FcObjectType *)l->types;
- break;
- }
- }
-
- if (!t)
+ if (!_FcUserObjectNames)
return 0;
- t[n].object = object;
- t[n].type = FcTypeVoid;
+ _FcUserObjectNames[n].object = object;
+ _FcUserObjectNames[n].type = FcTypeVoid;
return -n;
}