[3/3] gdb: initialize interp::next

Message ID 20230302203224.118345-4-simon.marchi@efficios.com
State New
Headers
Series Some minor interps tweaks |

Commit Message

Simon Marchi March 2, 2023, 8:32 p.m. UTC
  From: Simon Marchi <simon.marchi@polymtl.ca>

This field is never initialized, it seems to me like it would be a good
idea to initialize it to nullptr to avoid bad surprises.

Change-Id: I8c04319d564f5d385d8bf0acee758f6ce28b4447
---
 gdb/interps.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Tom Tromey March 7, 2023, 7:29 p.m. UTC | #1
Simon> This field is never initialized, it seems to me like it would be a good
Simon> idea to initialize it to nullptr to avoid bad surprises.

Seems totally fine.
Reviewed-By: Tom Tromey <tom@tromey.com>

Tom
  

Patch

diff --git a/gdb/interps.h b/gdb/interps.h
index 62f37951ddea..29248093c671 100644
--- a/gdb/interps.h
+++ b/gdb/interps.h
@@ -87,7 +87,7 @@  class interp
 public:
   /* Interpreters are stored in a linked list, this is the next
      one...  */
-  struct interp *next;
+  interp *next = nullptr;
 
   /* Has the init method been run?  */
   bool inited = false;