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.
This commit is contained in:
Tom Tromey 2022-05-28 21:06:19 -06:00
parent 8126c055e4
commit 43cffa64cf
5 changed files with 15 additions and 26 deletions

View file

@ -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);
}
};

View file

@ -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);
}
};

View file

@ -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);
}
};

View file

@ -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);
}
};

View file

@ -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);
}
};