Use std::sort instead of qsort in minsyms.c
authorChristian Biesinger <cbiesinger@google.com>
Sun, 29 Sep 2019 00:45:20 +0000 (19:45 -0500)
committerChristian Biesinger <cbiesinger@google.com>
Mon, 30 Sep 2019 18:32:32 +0000 (13:32 -0500)
commit6fb08628e0f894f01e3e4834d5262629ca8f1920
tree46ad9142a7a707cdc0af2365255e07a9aa8e955a
parent4a56a5200793f7476991952afa61be11a6d2ed41
Use std::sort instead of qsort in minsyms.c

This has better typesafety and is also marginally faster (either
due to inlining or because it avoids indirection through a
function pointer).

Note that in this change:
-       return 1;               /* fn1 has no name, so it is "less".  */
+       return true;            /* fn1 has no name, so it is "less".  */
       else if (name1)          /* fn2 has no name, so it is "less".  */
-       return -1;
+       return false;
I am fairly sure the old code was wrong (ie. code didn't match the
comment and the comment seemed correct), so I fixed it.

gdb/ChangeLog:

2019-09-28  Christian Biesinger  <cbiesinger@google.com>

* minsyms.c (compare_minimal_symbols): Rename to...
(minimal_symbol_is_less_than): ...this, and adjust to STL
conventions (return bool, take arguments as references)
(minimal_symbol_reader::install): Call std::sort instead
of qsort.
gdb/ChangeLog
gdb/minsyms.c
This page took 0.026115 seconds and 4 git commands to generate.