Mesa (master): util: add assert that key cannot be NULL on insertion

Tapani Pälli tpalli at kemper.freedesktop.org
Mon Aug 22 06:04:45 UTC 2016


Module: Mesa
Branch: master
Commit: 0abebec01246cb55dba76330a759e14424dae169
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=0abebec01246cb55dba76330a759e14424dae169

Author: Tapani Pälli <tapani.palli at intel.com>
Date:   Fri Aug 19 14:33:13 2016 +0300

util: add assert that key cannot be NULL on insertion

Signed-off-by: Tapani Pälli <tapani.palli at intel.com>
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
Reviewed-by: Eric Anholt <eric at anholt.net>

---

 src/util/hash_table.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/util/hash_table.c b/src/util/hash_table.c
index 4cfe3d9..9e643af 100644
--- a/src/util/hash_table.c
+++ b/src/util/hash_table.c
@@ -295,6 +295,8 @@ hash_table_insert(struct hash_table *ht, uint32_t hash,
    uint32_t start_hash_address, hash_address;
    struct hash_entry *available_entry = NULL;
 
+   assert(key != NULL);
+
    if (ht->entries >= ht->max_entries) {
       _mesa_hash_table_rehash(ht, ht->size_index + 1);
    } else if (ht->deleted_entries + ht->entries >= ht->max_entries) {




More information about the mesa-commit mailing list