Skip to content

Commit

Permalink
Short circuit case-insensitive compare of two equal Unicode codepoints.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Aug 15, 2014
1 parent 628b88f commit 4b906c1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/physfs_unicode.c
Expand Up @@ -447,6 +447,10 @@ static void locate_case_fold_mapping(const PHYSFS_uint32 from,
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);

Expand Down

0 comments on commit 4b906c1

Please sign in to comment.