aboutsummaryrefslogtreecommitdiff
path: root/gdb/varobj.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2020-12-11 09:33:36 -0700
committerTom Tromey <tom@tromey.com>2020-12-11 09:33:42 -0700
commit07d9937a201b2ff66b4ca98eac70581fd17c1aa0 (patch)
treec60008a2ceff63010174a85481a2318d80dc6b85 /gdb/varobj.c
parent1345dee2805220742355b331934c2cdedf7669c6 (diff)
downloadfsf-binutils-gdb-07d9937a201b2ff66b4ca98eac70581fd17c1aa0.zip
fsf-binutils-gdb-07d9937a201b2ff66b4ca98eac70581fd17c1aa0.tar.gz
fsf-binutils-gdb-07d9937a201b2ff66b4ca98eac70581fd17c1aa0.tar.bz2
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 <tom@tromey.com> * varobj.c (varobj_create): Update. (install_variable): Return void.
Diffstat (limited to 'gdb/varobj.c')
-rw-r--r--gdb/varobj.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/gdb/varobj.c b/gdb/varobj.c
index ba0e135..19a90c7 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. */