rizin/libr/include
Maxim Ivanov 59c9767adc
Fix half-assed comparators (#16953)
The expression (x > y) returns 1 or 0.
strcmp(..) returns 1, 0 or -1... and is valid RItemComparator.

I.e. one can't give a boolean answer where {1,0,-1} is expected.

This bug impacts the order of enumeration of locals and args in
functions. Starts occuring from mid-sized and bigger funcs
(~50 locals, then the sorting algo switches to mergesort); leads
to unstable and incorrectly-sorted vars dumps in the project file.

A motivating unit test is added as well.

A little algebra trick keeps it simple and efficient:
using no branching, with two antisymmetric bool→int conversions
we achieve the required {-1,0,1} codomain.

TL;DR: if you write a comparator function (to sort with),
make sure it returns 3 distinct values, not just 1 & 0.
2020-05-28 11:18:06 +08:00
..
r_crypto Add one more word in AES key search and merge Sbox (#16811) 2020-05-12 11:58:26 +08:00
r_util Migrating RAnnotatedCode to radare2 (#16939) 2020-05-27 11:54:31 +08:00
sdb Update SDB for sdb_copy() (#15356) 2019-10-25 15:30:43 +02:00
sflib Fix typo in ios-syscalls.txt (#15436) ##anal 2019-11-10 02:16:22 +01:00
r2naked.h
r_agraph.h Use g->x and g->y to rebase x/y got with r_str_str_xy 2020-05-03 17:33:36 +02:00
r_anal.h Improve BP vars/args detection ##anal (#16935) 2020-05-25 12:55:31 +08:00
r_asm.h Add Python bytecode plugins (#16771) 2020-05-13 10:37:09 +08:00
r_bin.h Add Python bytecode plugins (#16771) 2020-05-13 10:37:09 +08:00
r_bin_dwarf.h
r_bind.h Refactor RAnal Basic Blocks and Functions (#15169) ##anal 2020-01-15 15:23:34 +01:00
r_binheap.h
r_bp.h Refactor breakpoint validation (#15754) ##debug 2020-01-04 01:54:24 +01:00
r_cmd.h Remove INNER nodes and merge inner node with the command with same name (#16784) 2020-05-11 10:55:49 +02:00
r_config.h A bit of refactoring in r_config.h 2020-01-17 12:22:44 +01:00
r_cons.h r2r.c: Replace \x## emoji seqs with #defines (#16818) 2020-05-16 12:05:53 +08:00
r_core.h Migrating RAnnotatedCode to radare2 (#16939) 2020-05-27 11:54:31 +08:00
r_crypto.h Remove hardcoded supported encoders names (#16664) ##util 2020-04-24 11:49:22 +02:00
r_debug.h Use HtPP for accessing dbg trace entries (#16921) 2020-05-20 21:02:42 +08:00
r_diff.h
r_drx.h
r_egg.h
r_endian.h Speedup parsing PE exports (#16762) ##bin 2020-05-05 12:58:06 +02:00
r_flag.h Expose flag_get_list to RFlagBind 2020-05-03 17:55:20 +02:00
r_flist.h
r_fs.h Fix #14424 - Handle ~ operator in the ms shell ##cons (#15846) 2020-01-19 07:40:21 +01:00
r_getopt.h Always use r_getopt, do not depend on libc (not just on windows) ##core (#16325) 2020-03-27 17:06:40 +01:00
r_hash.h
r_heap_glibc.h Fix dmht for glibc caused by wrong tcache offset and definition (#16247) 2020-03-26 00:27:36 -05:00
r_heap_jemalloc.h
r_io.h Boolify r_io_shift 2020-04-13 20:05:03 +02:00
r_lang.h
r_lib.h Add pkgname in RLibStruct for r2pm on outdated plugins ##core (#15813) 2020-01-15 09:49:41 +01:00
r_list.h Fix half-assed comparators (#16953) 2020-05-28 11:18:06 +08:00
r_magic.h Make it possible to use sysmagic again (#15658) 2019-12-16 23:24:29 +01:00
r_main.h Move rasign2 into RMain (#16819) ##tools 2020-05-16 12:36:41 +02:00
r_parse.h Improve BP vars/args detection ##anal (#16935) 2020-05-25 12:55:31 +08:00
r_pdb.h
r_qrcode.h
r_reg.h Added register specific comment parsing to register profiles ##debug 2020-01-14 11:35:13 +01:00
r_regex.h
r_search.h Add elliptic curve private key search in /cr command (#15761) ##search 2020-01-07 22:01:16 +01:00
r_sign.h Apply types on matching zignature data ##signatures (#15746) 2020-01-16 10:26:03 +01:00
r_skiplist.h
r_socket.h Initial refactoring of the rap:// protocol (-75 LOC) ##socket (#16534) 2020-04-12 16:40:55 +02:00
r_syscall.h Fix #12700 (#16332) 2020-03-28 06:35:53 -05:00
r_th.h Fix some Race Conditions with the thready task scheduler (#15667) ##core 2019-12-18 16:54:37 +01:00
r_types.h Fix regression loading large files (>2GB) on 32bit systems ##io (#16648) 2020-04-28 22:09:30 +02:00
r_types_base.h Chop Basic Blocks instead of re-analyzing in noreturn propagation (#16612) 2020-04-17 19:51:47 +02:00
r_userconf.h.acr Compile new shell parser by default (#16660) 2020-04-21 13:44:30 +02:00
r_util.h Refactor r_big for gmp and ssl ##util (#16804) 2020-05-14 02:45:10 +02:00
r_vector.h Reduce memory usage in DEX files by caching the getstr calls ##bin (#16706) 2020-04-28 16:13:20 +02:00
r_version.h.in Upgrade to acr-1.8.1 to get semver support ##core (#15816) 2020-01-17 12:18:05 +01:00
sdb.h