* [PUSHED] gdb: fix up a few places where a char was treated as a bool
@ 2023-08-23 13:55 Andrew Burgess
0 siblings, 0 replies; only message in thread
From: Andrew Burgess @ 2023-08-23 13:55 UTC (permalink / raw)
To: gdb-patches
From: Alan Modra via Gdb-patches <gdb-patches@sourceware.org>
Spotted a few places where a char is being treated as a bool. The GDB
style is to use explicit comparisons, so fix things up.
There should be no user visible changes after this commit.
---
gdb/coffread.c | 2 +-
gdb/dbxread.c | 4 ++--
gdb/machoread.c | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/gdb/coffread.c b/gdb/coffread.c
index 7998327fdaf..f8e14d8ad93 100644
--- a/gdb/coffread.c
+++ b/gdb/coffread.c
@@ -64,7 +64,7 @@ static const registry<objfile>::key<coff_symfile_info> coff_objfile_data_key;
/* Translate an external name string into a user-visible name. */
#define EXTERNAL_NAME(string, abfd) \
- (*string && *string == bfd_get_symbol_leading_char (abfd) \
+ (*string != '\0' && *string == bfd_get_symbol_leading_char (abfd) \
? string + 1 : string)
/* To be an sdb debug type, type must have at least a basic or primary
diff --git a/gdb/dbxread.c b/gdb/dbxread.c
index 4c585efd192..958b6db6615 100644
--- a/gdb/dbxread.c
+++ b/gdb/dbxread.c
@@ -486,7 +486,7 @@ record_minimal_symbol (minimal_symbol_reader &reader,
{
const char *tempstring = name;
- if (*tempstring
+ if (*tempstring != '\0'
&& *tempstring == bfd_get_symbol_leading_char (objfile->obfd.get ()))
++tempstring;
if (is_vtable_name (tempstring))
@@ -2255,7 +2255,7 @@ read_ofile_symtab (struct objfile *objfile, legacy_psymtab *pst)
processing_gcc_compilation = 1;
else if (strcmp (namestring, GCC2_COMPILED_FLAG_SYMBOL) == 0)
processing_gcc_compilation = 2;
- if (*tempstring
+ if (*tempstring != '\0'
&& *tempstring == bfd_get_symbol_leading_char (symfile_bfd))
++tempstring;
if (startswith (tempstring, "__gnu_compiled"))
diff --git a/gdb/machoread.c b/gdb/machoread.c
index 615e08c6afa..38c252c2861 100644
--- a/gdb/machoread.c
+++ b/gdb/machoread.c
@@ -394,7 +394,7 @@ macho_resolve_oso_sym_with_minsym (struct objfile *main_objfile, asymbol *sym)
struct bound_minimal_symbol msym;
const char *name = sym->name;
- if (*name
+ if (*name != '\0'
&& *name == bfd_get_symbol_leading_char (main_objfile->obfd.get ()))
++name;
msym = lookup_minimal_symbol (name, NULL, main_objfile);
base-commit: d367563d55c0ff2bd406397c773bca767e8fccce
--
2.25.4
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-08-23 13:55 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-23 13:55 [PUSHED] gdb: fix up a few places where a char was treated as a bool Andrew Burgess
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).