diff options
author | Tom Tromey <tom@tromey.com> | 2022-05-28 21:06:19 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2022-07-28 14:16:50 -0600 |
commit | 43cffa64cf72f11a95203cd89844f82aa906c7e7 (patch) | |
tree | 0d8a792fa7a0ea3f169345e2b9ae739c83af58b4 /gdb | |
parent | 8126c055e453a494a72a44c9cce39fa8ddf14607 (diff) | |
download | gdb-43cffa64cf72f11a95203cd89844f82aa906c7e7.zip gdb-43cffa64cf72f11a95203cd89844f82aa906c7e7.tar.gz gdb-43cffa64cf72f11a95203cd89844f82aa906c7e7.tar.bz2 |
Remove some unneeded checks in Guile code
The Guile code generally checks to see if an htab is non-null before
destroying it. However, the registry code already ensures this, so we
can change these checks to asserts and simplify the code a little.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/guile/scm-block.c | 8 | ||||
-rw-r--r-- | gdb/guile/scm-frame.c | 8 | ||||
-rw-r--r-- | gdb/guile/scm-symbol.c | 8 | ||||
-rw-r--r-- | gdb/guile/scm-symtab.c | 8 | ||||
-rw-r--r-- | gdb/guile/scm-type.c | 9 |
5 files changed, 15 insertions, 26 deletions
diff --git a/gdb/guile/scm-block.c b/gdb/guile/scm-block.c index a29c2db..07c6a2b 100644 --- a/gdb/guile/scm-block.c +++ b/gdb/guile/scm-block.c @@ -97,11 +97,9 @@ struct bkscm_deleter void operator() (htab_t htab) { - if (htab != NULL) - { - htab_traverse_noresize (htab, bkscm_mark_block_invalid, NULL); - htab_delete (htab); - } + gdb_assert (htab != nullptr); + htab_traverse_noresize (htab, bkscm_mark_block_invalid, NULL); + htab_delete (htab); } }; diff --git a/gdb/guile/scm-frame.c b/gdb/guile/scm-frame.c index 4132bb2..159603b 100644 --- a/gdb/guile/scm-frame.c +++ b/gdb/guile/scm-frame.c @@ -95,11 +95,9 @@ struct frscm_deleter void operator() (htab_t htab) { - if (htab != NULL) - { - htab_traverse_noresize (htab, frscm_mark_frame_invalid, NULL); - htab_delete (htab); - } + gdb_assert (htab != nullptr); + htab_traverse_noresize (htab, frscm_mark_frame_invalid, NULL); + htab_delete (htab); } }; diff --git a/gdb/guile/scm-symbol.c b/gdb/guile/scm-symbol.c index 0b96e5a..78917bd 100644 --- a/gdb/guile/scm-symbol.c +++ b/gdb/guile/scm-symbol.c @@ -70,11 +70,9 @@ struct syscm_deleter void operator() (htab_t htab) { - if (htab != NULL) - { - htab_traverse_noresize (htab, syscm_mark_symbol_invalid, NULL); - htab_delete (htab); - } + gdb_assert (htab != nullptr); + htab_traverse_noresize (htab, syscm_mark_symbol_invalid, NULL); + htab_delete (htab); } }; diff --git a/gdb/guile/scm-symtab.c b/gdb/guile/scm-symtab.c index 9408231..2ff66c4 100644 --- a/gdb/guile/scm-symtab.c +++ b/gdb/guile/scm-symtab.c @@ -98,11 +98,9 @@ struct stscm_deleter void operator() (htab_t htab) { - if (htab != NULL) - { - htab_traverse_noresize (htab, stscm_mark_symtab_invalid, NULL); - htab_delete (htab); - } + gdb_assert (htab != nullptr); + htab_traverse_noresize (htab, stscm_mark_symtab_invalid, NULL); + htab_delete (htab); } }; diff --git a/gdb/guile/scm-type.c b/gdb/guile/scm-type.c index 2dadbef..5cb1cab 100644 --- a/gdb/guile/scm-type.c +++ b/gdb/guile/scm-type.c @@ -93,13 +93,10 @@ struct tyscm_deleter if (!gdb_scheme_initialized) return; + gdb_assert (htab != nullptr); htab_up copied_types = create_copied_types_hash (); - - if (htab != NULL) - { - htab_traverse_noresize (htab, tyscm_copy_type_recursive, copied_types.get ()); - htab_delete (htab); - } + htab_traverse_noresize (htab, tyscm_copy_type_recursive, copied_types.get ()); + htab_delete (htab); } }; |