From ae7d0f35938693d250f09165fb6486b9e0f4b9bd Mon Sep 17 00:00:00 2001 From: Ross Burton Date: Thu, 31 Mar 2005 19:16:49 +0000 Subject: [PATCH] Put all FcPattern objects though FcObjectStaticName and do pointer trather than string compares --- ChangeLog | 8 ++++++++ src/fclist.c | 5 +++-- src/fcmatch.c | 2 +- src/fcpat.c | 3 ++- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index c18acbc..63c44cd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2005-03-31 Ross Burton + + * src/fclist.c: + * src/fcmatch.c: + * src/fcpat.c: + Run all FcPattern objects through FcObjectStaticName, so that + compares can be done on pointers instead of strings (#2659) + 2005-03-17 Tor Lillqvist * src/fontconfig.def.in: Add the .dll to the dll name. diff --git a/src/fclist.c b/src/fclist.c index aaa9061..ec47ddc 100644 --- a/src/fclist.c +++ b/src/fclist.c @@ -67,10 +67,11 @@ FcObjectSetAdd (FcObjectSet *os, const char *object) low = 0; mid = 0; c = 1; + object = FcObjectStaticName (object); while (low <= high) { mid = (low + high) >> 1; - c = strcmp (os->objects[mid], object); + c = os->objects[mid] - object; if (c == 0) return FcTrue; if (c < 0) @@ -82,7 +83,7 @@ FcObjectSetAdd (FcObjectSet *os, const char *object) mid++; memmove (os->objects + mid + 1, os->objects + mid, (os->nobject - mid) * sizeof (const char *)); - os->objects[mid] = FcObjectStaticName (object); + os->objects[mid] = object; os->nobject++; return FcTrue; } diff --git a/src/fcmatch.c b/src/fcmatch.c index 9afe495..9a6b35f 100644 --- a/src/fcmatch.c +++ b/src/fcmatch.c @@ -406,7 +406,7 @@ FcCompare (FcPattern *pat, i2 = 0; while (i1 < pat->num && i2 < fnt->num) { - i = strcmp (pat->elts[i1].object, fnt->elts[i2].object); + i = pat->elts[i1].object - fnt->elts[i2].object; if (i > 0) i2++; else if (i < 0) diff --git a/src/fcpat.c b/src/fcpat.c index 2fea173..32054e1 100644 --- a/src/fcpat.c +++ b/src/fcpat.c @@ -588,6 +588,7 @@ FcPatternPosition (const FcPattern *p, const char *object) { int low, high, mid, c; + object = FcObjectStaticName(object); low = 0; high = p->num - 1; c = 1; @@ -595,7 +596,7 @@ FcPatternPosition (const FcPattern *p, const char *object) while (low <= high) { mid = (low + high) >> 1; - c = strcmp (p->elts[mid].object, object); + c = p->elts[mid].object - object; if (c == 0) return mid; if (c < 0) -- 2.39.5