goto shutdown_all;
}
- _edje_calc_params_map_cow = eina_cow_add("Edje Calc Params Map", sizeof (Edje_Calc_Params), 8, &default_calc_map);
- _edje_calc_params_physics_cow= eina_cow_add("Edje Calc Params Physics", sizeof (Edje_Calc_Params_Physics), 8, &default_calc_physics);
+ _edje_calc_params_map_cow = eina_cow_add("Edje Calc Params Map", sizeof (Edje_Calc_Params), 8, &default_calc_map, EINA_TRUE);
+ _edje_calc_params_physics_cow= eina_cow_add("Edje Calc Params Physics", sizeof (Edje_Calc_Params_Physics), 8, &default_calc_physics, EINA_TRUE);
eina_log_timing(_edje_default_log_dom,
EINA_LOG_STATE_STOP,
}
EAPI Eina_Cow *
-eina_cow_add(const char *name, unsigned int struct_size, unsigned int step, const void *default_value)
+eina_cow_add(const char *name, unsigned int struct_size, unsigned int step, const void *default_value, Eina_Bool gc)
{
const char *choice, *tmp;
Eina_Cow *cow;
NULL,
6);
#endif
- cow->togc = eina_hash_pointer_new(_eina_cow_gc_free);
+ if (gc)
+ cow->togc = eina_hash_pointer_new(_eina_cow_gc_free);
+ else
+ cow->togc = NULL;
cow->default_value = default_value;
cow->struct_size = struct_size;
cow->total_size = total_size;
eina_mempool_del(cow->pool);
eina_hash_free(cow->match);
- eina_hash_free(cow->togc);
-
+ if (cow->togc) eina_hash_free(cow->togc);
free(cow);
}
VALGRIND_MAKE_MEM_NOACCESS(ref, sizeof (*ref));
#endif
- if (!needed_gc) return ;
+ if (!cow->togc || !needed_gc) return ;
#ifndef NVALGRIND
VALGRIND_MAKE_MEM_DEFINED(ref, sizeof (*ref));
EINA_COW_PTR_MAGIC_CHECK(ref);
ref->refcount++;
- _eina_cow_togc_del(cow, ref);
+ if (cow->togc)
+ _eina_cow_togc_del(cow, ref);
#ifndef NVALGRIND
VALGRIND_MAKE_MEM_NOACCESS(ref, sizeof (*ref));
EINA_COW_MAGIC_CHECK(cow);
- if (!eina_hash_population(cow->togc)) return EINA_FALSE;
+ if (!cow->togc || !eina_hash_population(cow->togc))
+ return EINA_FALSE;
it = eina_hash_iterator_data_new(cow->togc);
r = eina_iterator_next(it, (void**) &gc);
* @param struct_size The size of the object from this pool.
* @param step How many object to allocate when the pool get empty.
* @param default_value The default value returned by this pool.
+ * @param gc Is it possible to run the garbage collection on this pool.
* @return a valid new Eina_Cow or @c NULL on error.
*/
-EAPI Eina_Cow *eina_cow_add(const char *name, unsigned int struct_size, unsigned int step, const void *default_value) EINA_WARN_UNUSED_RESULT;
+EAPI Eina_Cow *eina_cow_add(const char *name, unsigned int struct_size, unsigned int step, const void *default_value, Eina_Bool gc) EINA_WARN_UNUSED_RESULT;
/**
* @brief Destroy an Eina_Cow pool and all the allocated memory
evas_object_image_load_opts_cow = eina_cow_add("Evas_Object_Image load opts",
sizeof (Evas_Object_Image_Load_Opts),
8,
- &default_load_opts);
+ &default_load_opts,
+ EINA_TRUE);
evas_object_image_pixels_cow = eina_cow_add("Evas_Object_Image pixels",
sizeof (Evas_Object_Image_Pixels),
8,
- &default_pixels);
+ &default_pixels,
+ EINA_TRUE);
evas_object_image_state_cow = eina_cow_add("Evas_Object_Image states",
sizeof (Evas_Object_Image_State),
8,
- &default_state);
+ &default_state,
+ EINA_TRUE);
}
if (!evas_object_image_load_opts_cow ||
!evas_object_image_pixels_cow ||
{
if (evas_object_map_cow && evas_object_proxy_cow && evas_object_state_cow) return EINA_TRUE;
- evas_object_proxy_cow = eina_cow_add("Evas Object Proxy", sizeof (Evas_Object_Proxy_Data), 8, &default_proxy);
- evas_object_map_cow = eina_cow_add("Evas Object Map", sizeof (Evas_Object_Map_Data), 8, &default_map);
- evas_object_state_cow = eina_cow_add("Evas Object State", sizeof (Evas_Object_Protected_State), 64, &default_state);
+ evas_object_proxy_cow = eina_cow_add("Evas Object Proxy", sizeof (Evas_Object_Proxy_Data), 8, &default_proxy, EINA_TRUE);
+ evas_object_map_cow = eina_cow_add("Evas Object Map", sizeof (Evas_Object_Map_Data), 8, &default_map, EINA_TRUE);
+ evas_object_state_cow = eina_cow_add("Evas Object State", sizeof (Evas_Object_Protected_State), 64, &default_state, EINA_FALSE);
if (!(evas_object_map_cow && evas_object_proxy_cow && evas_object_state_cow))
{