[FFmpeg-devel] [PATCH] checkasm: Fix the function name sorting algorithm
Henrik Gramner
henrik at gramner.com
Sat Sep 26 20:30:04 CEST 2015
The previous implementation was behaving incorrectly in some corner cases.
---
tests/checkasm/checkasm.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c
index 8c75cc9..715b08c 100644
--- a/tests/checkasm/checkasm.c
+++ b/tests/checkasm/checkasm.c
@@ -289,12 +289,12 @@ 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)
{
- int ascii_diff, digit_diff;
+ int ascii_diff, digit_diff = 0;
for (; !(ascii_diff = *a - *b) && *a; a++, b++);
- for (; av_isdigit(*a) && av_isdigit(*b); a++, b++);
+ for (; av_isdigit(*a) && av_isdigit(*b); a++, b++, digit_diff = -1);
- return (digit_diff = av_isdigit(*a) - av_isdigit(*b)) ? digit_diff : ascii_diff;
+ return (digit_diff &= av_isdigit(*a) - av_isdigit(*b)) ? digit_diff : ascii_diff;
}
/* Perform a tree rotation in the specified direction and return the new root */
--
1.8.3.2
More information about the ffmpeg-devel
mailing list