summaryrefslogtreecommitdiff
path: root/epan/wmem/wmem_tree.c
diff options
context:
space:
mode:
authorEvan Huus <eapache@gmail.com>2013-06-22 21:00:36 +0000
committerEvan Huus <eapache@gmail.com>2013-06-22 21:00:36 +0000
commitbfa8d9af75c63df5f8aa78148442901d8b10540e (patch)
treebe1679f0f37eebed3829a4c7c2fd45aaa4b5a26f /epan/wmem/wmem_tree.c
parentf25a68221c5c4c15bfffd7e10b36791abf56f6ab (diff)
downloadwireshark-bfa8d9af75c63df5f8aa78148442901d8b10540e.tar.gz
Make assertions in tree lookup more useful and fix formatting.
Should help debugging https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8833 svn path=/trunk/; revision=50115
Diffstat (limited to 'epan/wmem/wmem_tree.c')
-rw-r--r--epan/wmem/wmem_tree.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/epan/wmem/wmem_tree.c b/epan/wmem/wmem_tree.c
index 1d5b5246a4..2d380419e6 100644
--- a/epan/wmem/wmem_tree.c
+++ b/epan/wmem/wmem_tree.c
@@ -584,16 +584,17 @@ wmem_tree_lookup32_array_helper(wmem_tree_t *tree, wmem_tree_key_t *key,
wmem_tree_key_t *cur_key;
guint32 i, lookup_key32 = 0;
+ g_assert(tree);
+
for (cur_key = key; cur_key->length > 0; cur_key++) {
- if (cur_key->length > 100) {
- g_assert_not_reached();
- }
+ g_assert(cur_key->length < 100);
for (i = 0; i < cur_key->length; i++) {
/* Lookup using the previous key32 */
if (!lookup_tree) {
lookup_tree = tree;
- } else {
+ }
+ else {
lookup_tree =
(wmem_tree_t *)(*helper)(lookup_tree, lookup_key32);
if (!lookup_tree) {
@@ -604,10 +605,8 @@ wmem_tree_lookup32_array_helper(wmem_tree_t *tree, wmem_tree_key_t *key,
}
}
- if (!lookup_tree) {
- /* We didn't get a valid key. Should we return NULL instead? */
- g_assert_not_reached();
- }
+ /* Assert if we didn't get any valid keys */
+ g_assert(lookup_tree);
return (*helper)(lookup_tree, lookup_key32);
}