[8/8] Change 'handle_id' to be a local variable

Message ID 20230709-trace-cleanups-v1-8-c410e1072fab@tromey.com
State New
Headers
Series Minor C++-ification and cleanup in trace targets |

Commit Message

Tom Tromey July 9, 2023, 5:01 p.m. UTC
  The global variable 'handle_id' in tracectf.c is only used in a single
function, so change it to be a local variable.
---
 gdb/tracectf.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
  

Patch

diff --git a/gdb/tracectf.c b/gdb/tracectf.c
index c2b55426b41..0ed2092c32b 100644
--- a/gdb/tracectf.c
+++ b/gdb/tracectf.c
@@ -855,7 +855,6 @@  class ctf_target final : public tracefile_target
 };
 
 /* The struct pointer for current CTF directory.  */
-static int handle_id = -1;
 static struct bt_context *ctx = NULL;
 static struct bt_ctf_iter *ctf_iter = NULL;
 /* The position of the first packet containing trace frame.  */
@@ -895,7 +894,7 @@  ctf_open_dir (const char *dirname)
   ctx = bt_context_create ();
   if (ctx == NULL)
     error (_("Unable to create bt_context"));
-  handle_id = bt_context_add_trace (ctx, dirname, "ctf", NULL, NULL, NULL);
+  int handle_id = bt_context_add_trace (ctx, dirname, "ctf", NULL, NULL, NULL);
   if (handle_id < 0)
     {
       ctf_destroy ();