diff options
author | David Carlton <carlton@bactrian.org> | 2003-02-24 23:37:02 +0000 |
---|---|---|
committer | David Carlton <carlton@bactrian.org> | 2003-02-24 23:37:02 +0000 |
commit | 0fe19209f9dde2fd4450b13a9e772203cf313eff (patch) | |
tree | 5c56927bc27c7bdb16a65cbc6664f872ddbbe207 /gdb/symfile.c | |
parent | c8d6825d9aa09b432701bb990fe9610442fcbaa1 (diff) | |
download | gdb-0fe19209f9dde2fd4450b13a9e772203cf313eff.zip gdb-0fe19209f9dde2fd4450b13a9e772203cf313eff.tar.gz gdb-0fe19209f9dde2fd4450b13a9e772203cf313eff.tar.bz2 |
2003-02-24 David Carlton <carlton@math.stanford.edu>
* symtab.c (lookup_partial_symbol): Use strcmp_iw_ordered to
do the comparison, not strcmp.
* symfile.c (compare_psymbols): Ditto.
* defs.h: Declare strcmp_iw_ordered.
* utils.c (strcmp_iw_ordered): New function.
Diffstat (limited to 'gdb/symfile.c')
-rw-r--r-- | gdb/symfile.c | 47 |
1 files changed, 6 insertions, 41 deletions
diff --git a/gdb/symfile.c b/gdb/symfile.c index 86508d1..9615987 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -213,52 +213,17 @@ compare_symbols (const void *s1p, const void *s2p) return (strcmp (SYMBOL_PRINT_NAME (*s1), SYMBOL_PRINT_NAME (*s2))); } -/* - - LOCAL FUNCTION - - compare_psymbols -- compare two partial symbols by name - - DESCRIPTION - - Given pointers to pointers to two partial symbol table entries, - compare them by name and return -N, 0, or +N (ala strcmp). - Typically used by sorting routines like qsort(). - - NOTES - - Does direct compare of first two characters before punting - and passing to strcmp for longer compares. Note that the - original version had a bug whereby two null strings or two - identically named one character strings would return the - comparison of memory following the null byte. - - */ +/* This compares two partial symbols by names, using strcmp_iw_ordered + for the comparison. */ static int compare_psymbols (const void *s1p, const void *s2p) { - register struct partial_symbol **s1, **s2; - register char *st1, *st2; - - s1 = (struct partial_symbol **) s1p; - s2 = (struct partial_symbol **) s2p; - st1 = SYMBOL_PRINT_NAME (*s1); - st2 = SYMBOL_PRINT_NAME (*s2); + struct partial_symbol *const *s1 = s1p; + struct partial_symbol *const *s2 = s2p; - - if ((st1[0] - st2[0]) || !st1[0]) - { - return (st1[0] - st2[0]); - } - else if ((st1[1] - st2[1]) || !st1[1]) - { - return (st1[1] - st2[1]); - } - else - { - return (strcmp (st1, st2)); - } + return strcmp_iw_ordered (SYMBOL_PRINT_NAME (*s1), + SYMBOL_PRINT_NAME (*s2)); } void |