[Mesa-dev] [PATCH 1/5] mesa: replace _mesa_problem() with assert() in hash table

Samuel Pitoiset samuel.pitoiset at gmail.com
Mon May 15 10:10:44 UTC 2017



On 05/09/2017 05:04 AM, Timothy Arceri wrote:
> There should be no way the OpenGL test suites don't hit the assert()
> should we do something to cause this code path to be taken.
> ---
>   src/mesa/main/hash.c | 5 ++---
>   1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/src/mesa/main/hash.c b/src/mesa/main/hash.c
> index a3772bd..7129616 100644
> --- a/src/mesa/main/hash.c
> +++ b/src/mesa/main/hash.c
> @@ -334,23 +334,22 @@ _mesa_HashInsert(struct _mesa_HashTable *table, GLuint key, void *data)
>   static inline void
>   _mesa_HashRemove_unlocked(struct _mesa_HashTable *table, GLuint key)
>   {
>      struct hash_entry *entry;
>   
>      assert(table);
>      assert(key);
>   
>      /* have to check this outside of mutex lock */
>      if (table->InDeleteAll) {
> -      _mesa_problem(NULL, "_mesa_HashRemove illegally called from "
> -                    "_mesa_HashDeleteAll callback function");
> -      return;
> +      assert(!"_mesa_HashRemove illegally called from "
> +             "_mesa_HashDeleteAll callback function");
>      }

If you want to remove the 'return', I would suggest to directly use 
'assert(!table->InDeleteAll);' here.


>   
>      if (key == DELETED_KEY_VALUE) {
>         table->deleted_key_data = NULL;
>      } else {
>         entry = _mesa_hash_table_search_pre_hashed(table->ht,
>                                                    uint_hash(key),
>                                                    uint_key(key));
>         _mesa_hash_table_remove(table->ht, entry);
>      }
> 


More information about the mesa-dev mailing list