summaryrefslogtreecommitdiff
path: root/src/fcmatch.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/fcmatch.c')
-rw-r--r--src/fcmatch.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/fcmatch.c b/src/fcmatch.c
index 80d5687..cf0876c 100644
--- a/src/fcmatch.c
+++ b/src/fcmatch.c
@@ -86,7 +86,7 @@ FcComparePostScript (const FcValue *v1, const FcValue *v2, FcValue *bestValue)
const FcChar8 *v1_string = FcValueString (v1);
const FcChar8 *v2_string = FcValueString (v2);
int n;
- size_t len;
+ size_t len1, len2, mlen;
*bestValue = FcValueCanonicalize (v2);
@@ -95,9 +95,11 @@ FcComparePostScript (const FcValue *v1, const FcValue *v2, FcValue *bestValue)
return 1.0;
n = FcStrMatchIgnoreCaseAndDelims (v1_string, v2_string, (const FcChar8 *)" -");
- len = strlen ((const char *)v1_string);
+ len1 = strlen ((const char *)v1_string);
+ len2 = strlen ((const char *)v2_string);
+ mlen = FC_MAX (len1, len2);
- return (double)(len - n) / (double)len;
+ return (double)(mlen - n) / (double)mlen;
}
static double