From 203ba5ec4eb59bd7a3fdf29974321929c45adbd0 Mon Sep 17 00:00:00 2001 From: barbieri Date: Sat, 6 Dec 2008 06:17:11 +0000 Subject: [PATCH] Fix couple of issues with MAGIC handling. eina_magic.h MUST include eina_config.h, otherwise it will not consider EINA_MAGIC stuff. Worse than that, some files were including that directly and were considering EINA_MAGIC attribute even if the file that alloc'ed the memory were not! Also add missing EINA_MAGIC_SET() to iterators and accessors. git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/eina@37960 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/include/eina_magic.h | 2 ++ src/lib/eina_hash.c | 8 ++++++++ src/lib/eina_inlist.c | 4 ++++ src/lib/eina_rbtree.c | 2 ++ 4 files changed, 16 insertions(+) diff --git a/src/include/eina_magic.h b/src/include/eina_magic.h index b52fdd2..5826475 100644 --- a/src/include/eina_magic.h +++ b/src/include/eina_magic.h @@ -19,6 +19,8 @@ #ifndef EINA_MAGIC_H_ #define EINA_MAGIC_H_ +#include "eina_config.h" + #ifdef EINA_MAGIC_DEBUG #include "eina_types.h" diff --git a/src/lib/eina_hash.c b/src/lib/eina_hash.c index 9ec1ad0..61759ac 100644 --- a/src/lib/eina_hash.c +++ b/src/lib/eina_hash.c @@ -286,6 +286,8 @@ _eina_hash_find_by_data(const Eina_Hash *hash, const void *data, int *key_hash, for (hash_num = 0; hash_num < EINA_HASH_BUCKET_SIZE; hash_num++) { + if (!hash->buckets[hash_num]) + continue; it = eina_rbtree_iterator_prefix(hash->buckets[hash_num]); eina_iterator_foreach(it, EINA_EACH(_eina_hash_rbtree_each), &each); eina_iterator_free(it); @@ -1009,6 +1011,8 @@ eina_hash_iterator_data_new(const Eina_Hash *hash) it->iterator.get_container = FUNC_ITERATOR_GET_CONTAINER(_eina_hash_iterator_get_container); it->iterator.free = FUNC_ITERATOR_FREE(_eina_hash_iterator_free); + EINA_MAGIC_SET(&it->iterator, EINA_MAGIC_ITERATOR); + return &it->iterator; } @@ -1030,6 +1034,8 @@ eina_hash_iterator_key_new(const Eina_Hash *hash) it->iterator.get_container = FUNC_ITERATOR_GET_CONTAINER(_eina_hash_iterator_get_container); it->iterator.free = FUNC_ITERATOR_FREE(_eina_hash_iterator_free); + EINA_MAGIC_SET(&it->iterator, EINA_MAGIC_ITERATOR); + return &it->iterator; } @@ -1051,6 +1057,8 @@ eina_hash_iterator_tuple_new(const Eina_Hash *hash) it->iterator.get_container = FUNC_ITERATOR_GET_CONTAINER(_eina_hash_iterator_get_container); it->iterator.free = FUNC_ITERATOR_FREE(_eina_hash_iterator_free); + EINA_MAGIC_SET(&it->iterator, EINA_MAGIC_ITERATOR); + return &it->iterator; } diff --git a/src/lib/eina_inlist.c b/src/lib/eina_inlist.c index d8c63cf..afe0635 100644 --- a/src/lib/eina_inlist.c +++ b/src/lib/eina_inlist.c @@ -355,6 +355,8 @@ eina_inlist_iterator_new(const Eina_Inlist *list) it->iterator.get_container = FUNC_ITERATOR_GET_CONTAINER(eina_inlist_iterator_get_container); it->iterator.free = FUNC_ITERATOR_FREE(eina_inlist_iterator_free); + EINA_MAGIC_SET(&it->iterator, EINA_MAGIC_ITERATOR); + return &it->iterator; } @@ -380,5 +382,7 @@ eina_inlist_accessor_new(const Eina_Inlist *list) it->accessor.get_container = FUNC_ACCESSOR_GET_CONTAINER(eina_inlist_accessor_get_container); it->accessor.free = FUNC_ACCESSOR_FREE(eina_inlist_accessor_free); + EINA_MAGIC_SET(&it->accessor, EINA_MAGIC_ACCESSOR); + return &it->accessor; } diff --git a/src/lib/eina_rbtree.c b/src/lib/eina_rbtree.c index 13493f0..a6b56c2 100644 --- a/src/lib/eina_rbtree.c +++ b/src/lib/eina_rbtree.c @@ -179,6 +179,8 @@ _eina_rbtree_iterator_build(const Eina_Rbtree *root, unsigned char mask) it->iterator.get_container = FUNC_ITERATOR_GET_CONTAINER(_eina_rbtree_iterator_get_content); it->iterator.free = FUNC_ITERATOR_FREE(_eina_rbtree_iterator_free); + EINA_MAGIC_SET(&it->iterator, EINA_MAGIC_ITERATOR); + return &it->iterator; on_error: -- 2.7.4