Fixes the same thing for the remaining modules.

On Thu, Jun 4, 2009 at 1:46 PM, Andre Dieb <andre.mart...@ee.ufcg.edu.br>wrote:

> Fixes init error handling on eina_array, eina_main and eina_stringshare.
>
> --
> André Dieb Martins
>
> Embedded Systems and Pervasive Computing Lab (Embedded)
> Electrical Engineering Department (DEE)
> Center of Electrical Engineering and Informatics (CEEI)
> Federal University of Campina Grande (UFCG)
>
> Blog: http://genuinepulse.blogspot.com/
>



-- 
André Dieb Martins

Embedded Systems and Pervasive Computing Lab (Embedded)
Electrical Engineering Department (DEE)
Center of Electrical Engineering and Informatics (CEEI)
Federal University of Campina Grande (UFCG)

Blog: http://genuinepulse.blogspot.com/
Index: src/lib/eina_benchmark.c
===================================================================
--- src/lib/eina_benchmark.c	(revision 40896)
+++ src/lib/eina_benchmark.c	(working copy)
@@ -145,11 +145,29 @@
 
    if (_eina_benchmark_count > 1) return _eina_benchmark_count;
 
-   eina_error_init();
-   eina_array_init();
-   eina_counter_init();
+   if (!eina_error_init())
+     {
+	fprintf(stderr, "Could not initialize eina error module.\n");
+	return 0;
+     }
+   if (!eina_array_init())
+     {
+	EINA_ERROR_PERR("Could not initialize eina array module.\n");
+	goto array_init_error;
+     }
+   if (!eina_counter_init())
+     {
+	EINA_ERROR_PERR("Could not initialize eina counter module.\n");
+	goto counter_init_error;
+     }
 
    return _eina_benchmark_count;
+
+   counter_init_error:
+      eina_array_shutdown();
+   array_init_error:
+      eina_error_shutdown();
+   return 0;
 }
 
 /**
Index: src/lib/eina_counter.c
===================================================================
--- src/lib/eina_counter.c	(revision 40896)
+++ src/lib/eina_counter.c	(working copy)
@@ -252,7 +252,11 @@
 
    if (_eina_counter_init_count == 1)
      {
-	eina_error_init();
+	if (!eina_error_init())
+	  {
+	     fprintf(stderr, "Could not initialize eina error module.\n");
+	     return 0;
+	  }
 #ifdef _WIN32
         if (!QueryPerformanceFrequency(&_eina_counter_frequency))
           {
Index: src/lib/eina_rectangle.c
===================================================================
--- src/lib/eina_rectangle.c	(revision 40896)
+++ src/lib/eina_rectangle.c	(working copy)
@@ -20,6 +20,7 @@
 # include "config.h"
 #endif
 
+#include <stdio.h>
 #include <stdlib.h>
 
 #include "eina_rectangle.h"
@@ -353,8 +354,16 @@
 
    if (_eina_rectangle_init_count > 1) return _eina_rectangle_init_count;
 
-   eina_error_init();
-   eina_mempool_init();
+   if (!eina_error_init())
+     {
+	fprintf(stderr, "Could not initialize eina error module.\n");
+	return 0;
+     }
+   if (!eina_mempool_init())
+     {
+	EINA_ERROR_PERR("Could not initialize eina mempool module.\n");
+	goto mempool_init_error;
+     }
 
 #ifdef EINA_DEFAULT_MEMPOOL
    choice = "pass_through";
@@ -368,10 +377,17 @@
    if (!_eina_rectangle_mp)
      {
 	EINA_ERROR_PERR("ERROR: Mempool for rectangle cannot be allocated in list init.\n");
-	abort();
+	goto init_error;
      }
 
    return _eina_rectangle_init_count;
+
+   init_error:
+      eina_mempool_shutdown();
+   mempool_init_error:
+      eina_error_shutdown();
+
+   return 0;
 }
 
 EAPI int
------------------------------------------------------------------------------
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to