diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-08-31 10:28:48 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-08-31 10:32:30 +0300 |
commit | 9821dd72bac89053ce0213e68116855910c681e9 (patch) | |
tree | f538d2a29b1282ab2fe679a3b7aab72fddac140f /source/blender/blenlib | |
parent | e72053a201d5ec6cd4fee85bc407e98cdc373483 (diff) |
Cleanup: rename natural string comparison
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/BLI_string.h | 2 | ||||
-rw-r--r-- | source/blender/blenlib/intern/BLI_filelist.c | 2 | ||||
-rw-r--r-- | source/blender/blenlib/intern/string.c | 7 |
3 files changed, 7 insertions, 4 deletions
diff --git a/source/blender/blenlib/BLI_string.h b/source/blender/blenlib/BLI_string.h index 70ffb46e952..cab2e68ca2b 100644 --- a/source/blender/blenlib/BLI_string.h +++ b/source/blender/blenlib/BLI_string.h @@ -100,7 +100,7 @@ char *BLI_strncasestr(const char *s, const char *find, size_t len) ATTR_WARN_UNU int BLI_strcasecmp(const char *s1, const char *s2) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); int BLI_strncasecmp(const char *s1, const char *s2, size_t len) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); -int BLI_natstrcmp(const char *s1, const char *s2) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); +int BLI_strcasecmp_natural(const char *s1, const char *s2) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); int BLI_strcmp_ignore_pad(const char *str1, const char *str2, const char pad) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); diff --git a/source/blender/blenlib/intern/BLI_filelist.c b/source/blender/blenlib/intern/BLI_filelist.c index 91f16ca9b7b..a93632cca08 100644 --- a/source/blender/blenlib/intern/BLI_filelist.c +++ b/source/blender/blenlib/intern/BLI_filelist.c @@ -107,7 +107,7 @@ static int bli_compare(struct direntry *entry1, struct direntry *entry2) return 1; } - return (BLI_natstrcmp(entry1->relname, entry2->relname)); + return (BLI_strcasecmp_natural(entry1->relname, entry2->relname)); } struct BuildDirCtx { diff --git a/source/blender/blenlib/intern/string.c b/source/blender/blenlib/intern/string.c index c3947cb8158..4059e0401c0 100644 --- a/source/blender/blenlib/intern/string.c +++ b/source/blender/blenlib/intern/string.c @@ -663,8 +663,11 @@ static int left_number_strcmp(const char *s1, const char *s2, int *tiebreaker) return 0; } -/* natural string compare, keeping numbers in order */ -int BLI_natstrcmp(const char *s1, const char *s2) +/** + * Case insensitive, *natural* string comparison, + * keeping numbers in order. + */ +int BLI_strcasecmp_natural(const char *s1, const char *s2) { register int d1 = 0, d2 = 0; register char c1, c2; |