diff options
author | Henrik Gramner <henrik@gramner.com> | 2015-09-26 20:15:35 +0200 |
---|---|---|
committer | Henrik Gramner <henrik@gramner.com> | 2015-09-28 16:38:23 +0200 |
commit | 19b28d047daa2bc9eaac0cca391bb5932fcb7059 (patch) | |
tree | 5a3a39b8cb3d73dfd9784e63ce3e22967fe7dbdb /tests/checkasm/checkasm.c | |
parent | 3e5b02bdb8e5b35564893e6618c217e4c949c743 (diff) | |
download | ffmpeg-19b28d047daa2bc9eaac0cca391bb5932fcb7059.tar.gz |
checkasm: Fix the function name sorting algorithm
The previous implementation was behaving incorrectly in some corner cases.
Diffstat (limited to 'tests/checkasm/checkasm.c')
-rw-r--r-- | tests/checkasm/checkasm.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c index 2f967e3937..d4680f08de 100644 --- a/tests/checkasm/checkasm.c +++ b/tests/checkasm/checkasm.c @@ -289,12 +289,16 @@ static void print_benchs(CheckasmFunc *f) /* ASCIIbetical sort except preserving natural order for numbers */ static int cmp_func_names(const char *a, const char *b) { + const char *start = a; int ascii_diff, digit_diff; - for (; !(ascii_diff = *a - *b) && *a; a++, b++); + for (; !(ascii_diff = *(const unsigned char*)a - *(const unsigned char*)b) && *a; a++, b++); for (; av_isdigit(*a) && av_isdigit(*b); a++, b++); - return (digit_diff = av_isdigit(*a) - av_isdigit(*b)) ? digit_diff : ascii_diff; + if (a > start && av_isdigit(a[-1]) && (digit_diff = av_isdigit(*a) - av_isdigit(*b))) + return digit_diff; + + return ascii_diff; } /* Perform a tree rotation in the specified direction and return the new root */ |