From 07d9937a201b2ff66b4ca98eac70581fd17c1aa0 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Fri, 11 Dec 2020 09:33:36 -0700 Subject: [PATCH] install_variable cannot fail I noticed that install_variable will never return false, so this patch changes the return type to void. I couldn't find a spot in history where it did return false, maybe it's always been like this. gdb/ChangeLog 2020-12-11 Tom Tromey * varobj.c (varobj_create): Update. (install_variable): Return void. --- gdb/ChangeLog | 5 +++++ gdb/varobj.c | 12 +++--------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 90bfac77470..a3d977dc604 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2020-12-11 Tom Tromey + + * varobj.c (varobj_create): Update. + (install_variable): Return void. + 2020-12-11 Tom Tromey * varobj.c (instantiate_pretty_printer): Use gdbpy_ref. diff --git a/gdb/varobj.c b/gdb/varobj.c index ba0e1357d3f..19a90c71196 100644 --- a/gdb/varobj.c +++ b/gdb/varobj.c @@ -142,7 +142,7 @@ static int delete_variable (struct varobj *, bool); static void delete_variable_1 (int *, struct varobj *, bool, bool); -static bool install_variable (struct varobj *); +static void install_variable (struct varobj *); static void uninstall_variable (struct varobj *); @@ -390,11 +390,7 @@ varobj_create (const char *objname, if ((var != NULL) && (objname != NULL)) { var->obj_name = objname; - - /* If a varobj name is duplicated, the install will fail so - we must cleanup. */ - if (!install_variable (var.get ())) - return NULL; + install_variable (var.get ()); } return var.release (); @@ -1733,7 +1729,7 @@ delete_variable_1 (int *delcountp, struct varobj *var, bool only_children_p, } /* Install the given variable VAR with the object name VAR->OBJ_NAME. */ -static bool +static void install_variable (struct varobj *var) { hashval_t hash = htab_hash_string (var->obj_name.c_str ()); @@ -1749,8 +1745,6 @@ install_variable (struct varobj *var) /* If root, add varobj to root list. */ if (is_root_p (var)) rootlist.push_front (var->root); - - return true; /* OK */ } /* Uninstall the object VAR. */ -- 2.30.2