aboutsummaryrefslogtreecommitdiff
path: root/gdb/buildsym.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/buildsym.c')
-rw-r--r--gdb/buildsym.c26
1 files changed, 11 insertions, 15 deletions
diff --git a/gdb/buildsym.c b/gdb/buildsym.c
index 8e05706..954a610 100644
--- a/gdb/buildsym.c
+++ b/gdb/buildsym.c
@@ -49,8 +49,6 @@ struct pending_block
struct block *block;
};
-static int compare_line_numbers (const void *ln1p, const void *ln2p);
-
/* Initial sizes of data structures. These are realloc'd larger if
needed, and realloc'd down to the size actually used, when
completed. */
@@ -729,23 +727,20 @@ buildsym_compunit::record_line (struct subfile *subfile, int line,
/* Needed in order to sort line tables from IBM xcoff files. Sigh! */
-static int
-compare_line_numbers (const void *ln1p, const void *ln2p)
+static bool
+lte_is_less_than (const linetable_entry &ln1, const linetable_entry &ln2)
{
- struct linetable_entry *ln1 = (struct linetable_entry *) ln1p;
- struct linetable_entry *ln2 = (struct linetable_entry *) ln2p;
-
/* Note: this code does not assume that CORE_ADDRs can fit in ints.
Please keep it that way. */
- if (ln1->pc < ln2->pc)
- return -1;
+ if (ln1.pc < ln2.pc)
+ return true;
- if (ln1->pc > ln2->pc)
- return 1;
+ if (ln1.pc > ln2.pc)
+ return false;
/* If pc equal, sort by line. I'm not sure whether this is optimum
behavior (see comment at struct linetable in symtab.h). */
- return ln1->line - ln2->line;
+ return ln1.line < ln2.line;
}
/* Subroutine of end_symtab to simplify it. Look for a subfile that
@@ -968,9 +963,10 @@ buildsym_compunit::end_symtab_with_blockvector (struct block *static_block,
scrambled in reordered executables. Sort it if
OBJF_REORDERED is true. */
if (m_objfile->flags & OBJF_REORDERED)
- qsort (subfile->line_vector->item,
- subfile->line_vector->nitems,
- sizeof (struct linetable_entry), compare_line_numbers);
+ std::sort (subfile->line_vector->item,
+ subfile->line_vector->item
+ + subfile->line_vector->nitems,
+ lte_is_less_than);
}
/* Allocate a symbol table if necessary. */