Enlightenment CVS committal Author : cedric Project : e17 Module : proto/eina
Dir : e17/proto/eina/src/lib Modified Files: eina_hash.c eina_array.c Log Message: Use the common out of memory error. =================================================================== RCS file: /cvs/e/e17/proto/eina/src/lib/eina_hash.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -3 -r1.4 -r1.5 --- eina_hash.c 6 Aug 2008 18:15:19 -0000 1.4 +++ eina_hash.c 7 Aug 2008 13:11:13 -0000 1.5 @@ -27,6 +27,7 @@ #include "eina_inlist.h" #include "eina_error.h" #include "eina_private.h" + /*============================================================================* * Local * *============================================================================*/ @@ -51,7 +52,6 @@ }; static int _eina_hash_init_count = 0; -static int EINA_HASH_ERROR_OUT_OF_MEMORY = 0; static inline Eina_Hash_El * _eina_hash_find_by_hash(const Eina_Hash *hash, const char *key, int key_length, int key_hash) @@ -126,10 +126,7 @@ _eina_hash_init_count++; if (_eina_hash_init_count == 1) - { - eina_error_init(); - EINA_HASH_ERROR_OUT_OF_MEMORY = eina_error_register("Eina_Hash out of memory"); - } + eina_error_init(); return _eina_hash_init_count; } @@ -168,7 +165,7 @@ return new; on_error: - eina_error_set(EINA_HASH_ERROR_OUT_OF_MEMORY); + eina_error_set(EINA_ERROR_OUT_OF_MEMORY); return NULL; } @@ -242,7 +239,7 @@ return EINA_TRUE; on_error: - eina_error_set(EINA_HASH_ERROR_OUT_OF_MEMORY); + eina_error_set(EINA_ERROR_OUT_OF_MEMORY); return EINA_FALSE; } @@ -300,7 +297,7 @@ return EINA_TRUE; on_error: - eina_error_set(EINA_HASH_ERROR_OUT_OF_MEMORY); + eina_error_set(EINA_ERROR_OUT_OF_MEMORY); return EINA_FALSE; } =================================================================== RCS file: /cvs/e/e17/proto/eina/src/lib/eina_array.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -3 -r1.3 -r1.4 --- eina_array.c 6 Aug 2008 18:15:19 -0000 1.3 +++ eina_array.c 7 Aug 2008 13:11:13 -0000 1.4 @@ -27,9 +27,22 @@ #include <stdlib.h> #include <string.h> +#include "eina_error.h" #include "eina_array.h" #include "eina_inline_array.x" +EAPI int +eina_array_init(void) +{ + return eina_error_init(); +} + +EAPI int +eina_array_shutdown(void) +{ + return eina_error_shutdown(); +} + EAPI void eina_array_append(Eina_Array *array, void *data) { @@ -69,8 +82,12 @@ { Eina_Array *array; + eina_error_set(0); array = malloc(sizeof (Eina_Array)); - if (!array) return NULL; + if (!array) { + eina_error_set(EINA_ERROR_OUT_OF_MEMORY); + return NULL; + } array->data = NULL; array->total = 0; @@ -132,8 +149,12 @@ return ; } + eina_error_set(0); tmp = malloc(sizeof (void*) * array->total); - if (!tmp) return ; + if (!tmp) { + eina_error_set(EINA_ERROR_OUT_OF_MEMORY); + return ; + } memcpy(tmp, array->data, limit * sizeof(void*)); total = limit; ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs