From 494b7ec97ed90fe6aa44e6d4cfe94554b9b5f10f Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Fri, 19 Jan 2001 08:01:47 +0000 Subject: [PATCH] Replace STRCMP with strcmp() --- gdb/ChangeLog | 14 ++++++++++++++ gdb/cli/cli-decode.c | 8 ++++---- gdb/defs.h | 1 - gdb/objfiles.c | 2 +- gdb/remote-es.c | 2 +- gdb/standalone.c | 2 +- gdb/symfile.c | 14 +------------- gdb/symtab.c | 4 ++-- 8 files changed, 24 insertions(+), 23 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 17d7a0f167..0b2246627e 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,17 @@ +Thu Jan 18 12:48:04 2001 Andrew Cagney + + * defs.h (STRCMP): Delete macro. + + * objfiles.c (objfile_relocate): Replace STRCMP with call to + strcmp. + * symtab.c (lookup_partial_symbol, lookup_block_symbol): Ditto. + * symfile.c (compare_symbols): Ditto. + * standalone.c (open): Ditto. + * remote-es.c (verify_break): Ditto. + * cli/cli-decode.c (add_cmd, add_show_from_set): Ditto. + + * symfile.c (compare_psymbols): Delete comment refering to STRCMP. + Thu Jan 18 12:25:06 2001 Andrew Cagney * varobj.c (FREEIF): Delete macro. diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c index 42c126783a..76e8447720 100644 --- a/gdb/cli/cli-decode.c +++ b/gdb/cli/cli-decode.c @@ -67,7 +67,7 @@ add_cmd (char *name, enum command_class class, void (*fun) (char *, int), delete_cmd (name, list); - if (*list == NULL || STRCMP ((*list)->name, name) >= 0) + if (*list == NULL || strcmp ((*list)->name, name) >= 0) { c->next = *list; *list = c; @@ -75,7 +75,7 @@ add_cmd (char *name, enum command_class class, void (*fun) (char *, int), else { p = *list; - while (p->next && STRCMP (p->next->name, name) <= 0) + while (p->next && strcmp (p->next->name, name) <= 0) { p = p->next; } @@ -312,7 +312,7 @@ add_show_from_set (struct cmd_list_element *setcmd, else fprintf_unfiltered (gdb_stderr, "GDB internal error: Bad docstring for set command\n"); - if (*list == NULL || STRCMP ((*list)->name, showcmd->name) >= 0) + if (*list == NULL || strcmp ((*list)->name, showcmd->name) >= 0) { showcmd->next = *list; *list = showcmd; @@ -320,7 +320,7 @@ add_show_from_set (struct cmd_list_element *setcmd, else { p = *list; - while (p->next && STRCMP (p->next->name, showcmd->name) <= 0) + while (p->next && strcmp (p->next->name, showcmd->name) <= 0) { p = p->next; } diff --git a/gdb/defs.h b/gdb/defs.h index 87e570f4b5..b5fe805d64 100644 --- a/gdb/defs.h +++ b/gdb/defs.h @@ -148,7 +148,6 @@ typedef bfd_vma CORE_ADDR; issue is found that we spend the effort on algorithmic optimizations than micro-optimizing.'' J.T. */ -#define STRCMP(a,b) (*(a) == *(b) ? strcmp ((a), (b)) : (int)*(a) - (int)*(b)) #define STREQ(a,b) (*(a) == *(b) ? !strcmp ((a), (b)) : 0) #define STREQN(a,b,c) (*(a) == *(b) ? !strncmp ((a), (b), (c)) : 0) diff --git a/gdb/objfiles.c b/gdb/objfiles.c index 3ad6d29771..d84770c0d5 100644 --- a/gdb/objfiles.c +++ b/gdb/objfiles.c @@ -584,7 +584,7 @@ objfile_relocate (struct objfile *objfile, struct section_offsets *new_offsets) else if (SYMBOL_CLASS (sym) == LOC_CONST && SYMBOL_NAMESPACE (sym) == LABEL_NAMESPACE - && STRCMP (SYMBOL_NAME (sym), MIPS_EFI_SYMBOL_NAME) == 0) + && strcmp (SYMBOL_NAME (sym), MIPS_EFI_SYMBOL_NAME) == 0) ecoff_relocate_efi (sym, ANOFFSET (delta, s->block_line_section)); #endif diff --git a/gdb/remote-es.c b/gdb/remote-es.c index b2cabce5c4..92541a789f 100644 --- a/gdb/remote-es.c +++ b/gdb/remote-es.c @@ -1151,7 +1151,7 @@ verify_break (int vec) { memory_error (status, memaddress); } - return (STRCMP (instr, buf)); + return (strcmp (instr, buf)); } return (-1); } diff --git a/gdb/standalone.c b/gdb/standalone.c index 1aa76d54f1..07e062d7d7 100644 --- a/gdb/standalone.c +++ b/gdb/standalone.c @@ -145,7 +145,7 @@ open (char *filename, int modes) for (next = files_start; *(int *) next; next += *(int *) next) { - if (!STRCMP (next + 4, filename)) + if (!strcmp (next + 4, filename)) { sourcebeg = next + 4 + strlen (next + 4) + 1; sourcebeg = (char *) (((int) sourcebeg + 3) & (-4)); diff --git a/gdb/symfile.c b/gdb/symfile.c index 983db22781..b0ae6e2a6a 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -213,7 +213,7 @@ compare_symbols (const PTR s1p, const PTR s2p) s1 = (struct symbol **) s1p; s2 = (struct symbol **) s2p; - return (STRCMP (SYMBOL_SOURCE_NAME (*s1), SYMBOL_SOURCE_NAME (*s2))); + return (strcmp (SYMBOL_SOURCE_NAME (*s1), SYMBOL_SOURCE_NAME (*s2))); } /* @@ -260,18 +260,6 @@ compare_psymbols (const PTR s1p, const PTR s2p) } else { - /* Note: I replaced the STRCMP line (commented out below) - * with a simpler "strcmp()" which compares the 2 strings - * from the beginning. (STRCMP is a macro which first compares - * the initial characters, then falls back on strcmp). - * The reason is that the STRCMP line was tickling a C compiler - * bug on HP-UX 10.30, which is avoided with the simpler - * code. The performance gain from the more complicated code - * is negligible, given that we have already checked the - * initial 2 characters above. I reported the compiler bug, - * and once it is fixed the original line can be put back. RT - */ - /* return ( STRCMP (st1 + 2, st2 + 2)); */ return (strcmp (st1, st2)); } } diff --git a/gdb/symtab.c b/gdb/symtab.c index 3b5e1a07dd..832fb019a9 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -1004,7 +1004,7 @@ lookup_partial_symbol (struct partial_symtab *pst, const char *name, int global, { do_linear_search = 1; } - if (STRCMP (SYMBOL_SOURCE_NAME (*center), name) >= 0) + if (strcmp (SYMBOL_SOURCE_NAME (*center), name) >= 0) { top = center; } @@ -1237,7 +1237,7 @@ lookup_block_symbol (register const struct block *block, const char *name, { top = inc; } - else if (STRCMP (SYMBOL_SOURCE_NAME (sym), name) < 0) + else if (strcmp (SYMBOL_SOURCE_NAME (sym), name) < 0) { bot = inc; } -- 2.34.1