From 8a874b238eccfcbd46df77ef0cc7d2fb86018876 Mon Sep 17 00:00:00 2001 From: Evan Huus Date: Wed, 20 Mar 2013 00:10:07 +0000 Subject: [PATCH] Trivial tweaks to clean up cppcheck warnings. svn path=/trunk/; revision=48435 --- epan/wmem/wmem_allocator_block.c | 4 ++-- epan/wmem/wmem_allocator_simple.c | 3 ++- epan/wmem/wmem_core.c | 4 +++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/epan/wmem/wmem_allocator_block.c b/epan/wmem/wmem_allocator_block.c index 4afd27009a..0ccbc4d45b 100644 --- a/epan/wmem/wmem_allocator_block.c +++ b/epan/wmem/wmem_allocator_block.c @@ -178,7 +178,7 @@ wmem_block_debug_chunk_chain(wmem_block_chunk_t *chunk) printf("VERIFYING CHUNK CHAIN\n"); g_assert(chunk->prev == 0); - while (chunk) { + do { total_len += chunk->len; if (WMEM_CHUNK_NEXT(chunk)) { @@ -186,7 +186,7 @@ wmem_block_debug_chunk_chain(wmem_block_chunk_t *chunk) } chunk = WMEM_CHUNK_NEXT(chunk); - } + } while (chunk); g_assert(total_len == WMEM_BLOCK_SIZE); } diff --git a/epan/wmem/wmem_allocator_simple.c b/epan/wmem/wmem_allocator_simple.c index f872db88b1..db43310b47 100644 --- a/epan/wmem/wmem_allocator_simple.c +++ b/epan/wmem/wmem_allocator_simple.c @@ -58,7 +58,7 @@ wmem_simple_alloc(void *private_data, const size_t size) static void wmem_simple_free(void *private_data, void *ptr) { - gboolean removed = FALSE; + gboolean removed; wmem_simple_allocator_t *allocator; allocator = (wmem_simple_allocator_t*) private_data; @@ -66,6 +66,7 @@ wmem_simple_free(void *private_data, void *ptr) /* remove() takes care of calling g_free() for us since we set up the * hash table with g_hash_table_new_full() */ removed = g_hash_table_remove(allocator->block_table, ptr); + g_assert(removed); } diff --git a/epan/wmem/wmem_core.c b/epan/wmem/wmem_core.c index 87a218bdbc..415826005a 100644 --- a/epan/wmem/wmem_core.c +++ b/epan/wmem/wmem_core.c @@ -59,7 +59,9 @@ wmem_alloc0(wmem_allocator_t *allocator, const size_t size) buf = wmem_alloc(allocator, size); - return memset(buf, 0, size); + memset(buf, 0, size); + + return buf; } void