Hello,

As the --disable-magic-debug thingy was fixed by someone else, I just
rebased the patch and it goes attached again, fixing the same things listed
on the original mail.

On Sun, Jun 7, 2009 at 7:01 AM, Cedric BAIL <cedric.b...@free.fr> wrote:

> On Sat, Jun 6, 2009 at 11:33 PM, Vincent Torri<vto...@univ-evry.fr> wrote:
> > On Sat, 6 Jun 2009, Cedric BAIL wrote:
> >> On Sat, Jun 6, 2009 at 7:42 PM, Peter Wehrfritz<peter.wehrfr...@web.de>
> >> wrote:
> >>>
> >>> Cedric BAIL schrieb:
> >>>>
> >>>> On Sat, Jun 6, 2009 at 5:48 PM, Albin Tonnerre<
> albin.tonne...@gmail.com>
> >>>> wrote:
> >>>>>
> >>>>> On Sat, Jun 06, 2009 at 12:12:49PM -0300, Andre Dieb wrote :
> >>>>>
> >>>>>>
> >>>>>> This patch contains my other two previous patches:
> >>>>>>
> >>>>>>   - [PATCH] Fix eina mempool leak, init error handling, remove
> >>>>>> consumed
> >>>>>>   TODO msg
> >>>>>>   - [PATCH] Add checks to eina_module_new
> >>>>>>
> >>>>>> Also fixes the build error with --disable-magic-debug.
> >>>>>>
> >>>>>
> >>>>> I still think that when ecore_magic is disabled, it would be better
> to
> >>>>> use
> >>>>> functions rather than preprocessor macros for things like
> >>>>> eina_magic_string_init(). Indeed, that would avoid exporting
> different
> >>>>> symbols
> >>>>> depending on whether eina has magic-debug enabled or not. If you use
> >>>>> macros, an
> >>>>> application using magic debug compiled against eina without
> magic-debug
> >>>>> will
> >>>>> have to be recompiled to benefit from it if it gets enabled in eina
> at
> >>>>> a
> >>>>> later
> >>>>> point. If you use functions, this is no longer an issue.
> >>>>>
> >>>>> Thoughts ?
> >>>>>
> >>>>
> >>>> I strongly disagree, when you disable magic debug in eina, you want to
> >>>> avoid it's cost at all. This include the call of the function call.
> >>>> And from my test, it does have a big impact to just enter an empty
> >>>> function. When we are speaking about performance, I think we can
> >>>> accept the little tradeoff of needing to recompile application using
> >>>> eina for maximum performance.
> >>>>
> >>>
> >>> Are you kidding? How often do you call this function? Maybe 20 times,
> >>> even
> >>> if you call it 100 or 1000 times, I strongly doubt that you can measure
> a
> >>> performance difference.
> >>
> >> No, I am not. That's why we have a way to disable magic debug in evas
> >> (evas doesn't currently use eina magic debug, but will in the futur).
> >> Without this option some of my application are loosing around 10% of
> >> their time inside this magic debug stuff.
> >
> > I think that Peter is saying that you do not call the
> > eina_magic_string_init() function o lot of time. The question is about
> that
> > specific function, not the whole magic debug stuff
>
> Oh, sorry, I didn't understood that. In that case, sounds ok to me.
>
> --
> Cedric BAIL
>
>
> ------------------------------------------------------------------------------
> 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
>



-- 
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_mempool.c
===================================================================
--- src/lib/eina_mempool.c	(revision 40980)
+++ src/lib/eina_mempool.c	(working copy)
@@ -123,8 +123,16 @@
 	{
 		char *path;
 
-		eina_hash_init();
-		eina_module_init();
+		if (!eina_hash_init())
+		  {
+		     fprintf(stderr, "Could not initialize eina hash module.\n");
+		     return 0;
+		  }
+		if (!eina_module_init())
+		  {
+		     fprintf(stderr, "Could not initialize eina module module.\n");
+		     goto module_init_error;
+		  }
 
 		EINA_ERROR_NOT_MEMPOOL_MODULE = eina_error_msg_register("Not a memory pool module.");
 		_backends = eina_hash_string_superfast_new(NULL);
@@ -147,7 +155,8 @@
 		if (!_modules)
 		{
 			EINA_ERROR_PERR("ERROR: no mempool modules able to be loaded.\n");
-			abort();
+			eina_hash_free(_backends);
+			goto mempool_init_error;
 		}
 		eina_module_list_load(_modules);
 		/* builtin backends */
@@ -165,6 +174,14 @@
 #endif
 	}
 	return ++_init_count;
+
+	mempool_init_error:
+	   eina_module_shutdown();
+	module_init_error:
+	   eina_hash_shutdown();
+
+	return 0;
+
 }
 
 /**
@@ -190,9 +207,15 @@
 	ememoa_fixed_shutdown();
 #endif
 	/* dynamic backends */
-	eina_module_list_unload(_modules);
+	eina_module_list_delete(_modules);
+	if (_modules)
+	   eina_array_free(_modules);
+
 	eina_module_shutdown();
-	/* TODO delete the _modules list */
+
+	if (_backends)
+	   eina_hash_free(_backends);
+
 	eina_hash_shutdown();
 	return 0;
 }
Index: src/lib/eina_module.c
===================================================================
--- src/lib/eina_module.c	(revision 40980)
+++ src/lib/eina_module.c	(working copy)
@@ -28,6 +28,7 @@
 #include <sys/types.h>
 #include <dirent.h>
 #include <string.h>
+#include <sys/stat.h>
 
 #ifdef HAVE_ALLOCA_H
 # include <alloca.h>
@@ -261,11 +262,25 @@
 EAPI Eina_Module * eina_module_new(const char *file)
 {
 	Eina_Module *m;
+	struct stat stat_info;
 
 	EINA_SAFETY_ON_NULL_RETURN_VAL(file, NULL);
-	/* TODO check that the file exists */
 
+	if (stat(file, &stat_info) != 0)
+	  {
+	     // Could not retrieve information about the file
+	     eina_error_set(EINA_ERROR_WRONG_MODULE);
+	     return NULL;
+	  }
+
 	m = malloc(sizeof(Eina_Module));
+
+	if (!m)
+	  {
+	     eina_error_set(EINA_ERROR_OUT_OF_MEMORY);
+	     return NULL;
+	  }
+	
 	/* TODO add the magic */
 	m->file = strdup(file);
 	m->ref = 0;
Index: src/lib/eina_error.c
===================================================================
--- src/lib/eina_error.c	(revision 40980)
+++ src/lib/eina_error.c	(working copy)
@@ -530,7 +530,6 @@
 	{
 		char *level;
 		/* TODO register the eina's basic errors */
-		/* TODO load the environment variable for getting the log level */
 		if ((level = getenv("EINA_ERROR_LEVEL")))
 		{
 			_error_level = atoi(level);
------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to