This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH 2/3] gdb/cli: Remove casts of NULL during assignment.
- From: Andrew Burgess <andrew dot burgess at embecosm dot com>
- To: gdb-patches at sourceware dot org
- Cc: Andrew Burgess <andrew dot burgess at embecosm dot com>
- Date: Mon, 31 Aug 2015 21:49:23 +0100
- Subject: [PATCH 2/3] gdb/cli: Remove casts of NULL during assignment.
- Authentication-results: sourceware.org; auth=none
- References: <cover dot 1441054039 dot git dot andrew dot burgess at embecosm dot com>
- References: <cover dot 1441054039 dot git dot andrew dot burgess at embecosm dot com>
In the following code:
struct symbol *wsym = (struct symbol *) NULL;
the cast of NULL is redundant, it adds noise, and is just one more thing
to change if the type of wsym ever changes. There are a relatively
small number of places in gdb where the above code pattern is used.
Usually the cast is removed like this:
struct symbol *wsym = NULL;
This commit updates all the places within the gdb/cli directory where we
cast NULL during assignment, removing the cast.
gdb/ChangeLog:
* cli/cli-decode.c (find_cmd): Remove cast of NULL pointer.
---
gdb/ChangeLog | 4 ++++
gdb/cli/cli-decode.c | 2 +-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index f4dafb6..0c23ca6 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,9 @@
2015-08-31 Andrew Burgess <andrew.burgess@embecosm.com>
+ * cli/cli-decode.c (find_cmd): Remove cast of NULL pointer.
+
+2015-08-31 Andrew Burgess <andrew.burgess@embecosm.com>
+
* c-valprint.c (print_unpacked_pointer): Remove cast of NULL
pointer.
* dbxread.c (dbx_end_psymtab): Likewise.
diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c
index f5b6fc4..cab2336 100644
--- a/gdb/cli/cli-decode.c
+++ b/gdb/cli/cli-decode.c
@@ -1219,7 +1219,7 @@ find_cmd (const char *command, int len, struct cmd_list_element *clist,
{
struct cmd_list_element *found, *c;
- found = (struct cmd_list_element *) NULL;
+ found = NULL;
*nfound = 0;
for (c = clist; c; c = c->next)
if (!strncmp (command, c->name, len)
--
2.5.1