Short circuit case-insensitive compare of two equal Unicode codepoints.
authorRyan C. Gordon <icculus@icculus.org>
Thu, 14 Aug 2014 21:33:24 -0400
changeset 1351 ea662d0cbcf0
parent 1350 b0fa354873f2
child 1353 5ef6aca28421
Short circuit case-insensitive compare of two equal Unicode codepoints.
src/physfs_unicode.c
--- a/src/physfs_unicode.c	Thu Aug 14 21:17:04 2014 -0400
+++ b/src/physfs_unicode.c	Thu Aug 14 21:33:24 2014 -0400
@@ -447,6 +447,10 @@
 static int utf8codepointcmp(const PHYSFS_uint32 cp1, const PHYSFS_uint32 cp2)
 {
     PHYSFS_uint32 folded1[3], folded2[3];
+
+    if (cp1 == cp2)
+        return 0;  /* obviously matches. */
+
     locate_case_fold_mapping(cp1, folded1);
     locate_case_fold_mapping(cp2, folded2);