public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Since "return NULL" and "return 0" were mixed in a function, unified to "return NULL".
@ 2022-09-10 14:24 TaiseiIto
  2022-09-12 20:12 ` Tom Tromey
  0 siblings, 1 reply; 2+ messages in thread
From: TaiseiIto @ 2022-09-10 14:24 UTC (permalink / raw)
  To: gdb-patches; +Cc: TaiseiIto

The function "gdbarch_find_by_info" in "binutils-gdb/gdb/arch-utils.c" returns 0 on line 1363, but returns NULL on line 1376.
I unified to "return NULL" because it is better representation than the other to indicate an invalid address.
---
 gdb/arch-utils.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c
index 9bd4f0ddae6..0a0107c76dc 100644
--- a/gdb/arch-utils.c
+++ b/gdb/arch-utils.c
@@ -1360,7 +1360,7 @@ gdbarch_find_by_info (struct gdbarch_info info)
       if (gdbarch_debug)
 	gdb_printf (gdb_stdlog, "gdbarch_find_by_info: "
 		    "No matching architecture\n");
-      return 0;
+      return NULL;
     }
 
   /* Ask the tdep code for an architecture that matches "info".  */
-- 
2.34.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Since "return NULL" and "return 0" were mixed in a function, unified to "return NULL".
  2022-09-10 14:24 [PATCH] Since "return NULL" and "return 0" were mixed in a function, unified to "return NULL" TaiseiIto
@ 2022-09-12 20:12 ` Tom Tromey
  0 siblings, 0 replies; 2+ messages in thread
From: Tom Tromey @ 2022-09-12 20:12 UTC (permalink / raw)
  To: TaiseiIto via Gdb-patches; +Cc: TaiseiIto

>>>>> TaiseiIto via Gdb-patches <gdb-patches@sourceware.org> writes:

> The function "gdbarch_find_by_info" in "binutils-gdb/gdb/arch-utils.c"
> returns 0 on line 1363, but returns NULL on line 1376.  I unified to
> "return NULL" because it is better representation than the other to
> indicate an invalid address.

I think if you're going to modify it, you might as well update all the
'NULL's in that function to 'nullptr' instead.

Tom

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-09-12 20:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-10 14:24 [PATCH] Since "return NULL" and "return 0" were mixed in a function, unified to "return NULL" TaiseiIto
2022-09-12 20:12 ` Tom Tromey

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).