From 7555d51e10906e1e1d50be93e2b415cc24bbeeee Mon Sep 17 00:00:00 2001 From: mquinson Date: Tue, 15 Apr 2008 18:09:42 +0000 Subject: [PATCH] Do throw an exception only when the requested factory was not found, not all the time (plus cosmetics) git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@5348 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- src/xbt/xbt_context.c | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/src/xbt/xbt_context.c b/src/xbt/xbt_context.c index 712d7c3dd3..8774486165 100644 --- a/src/xbt/xbt_context.c +++ b/src/xbt/xbt_context.c @@ -244,15 +244,10 @@ xbt_context_select_factory(const char* name) { /* if the desired factory is different of the current factory, call xbt_context_mod_exit() */ if(strcmp(context_factory->name,name)) - { xbt_context_mod_exit(); - - } else - { /* the same context factory is requested return directly */ return 0; - } } /* get the desired factory */ @@ -280,17 +275,17 @@ xbt_context_select_factory(const char* name) void xbt_context_init_factory_by_name(xbt_context_factory_t* factory, const char* name) { - if(!strcmp(name,"java")) - xbt_ctx_java_factory_init(factory); - #ifdef CONTEXT_THREADS - else if(!strcmp(name,"thread")) - xbt_ctx_thread_factory_init(factory); - #elif !defined(WIN32) - else if(!strcmp(name,"sysv")) - xbt_ctx_sysv_factory_init(factory); - #endif - - THROW1(not_found_error, 0,"Factory '%s' does not exist",name); + if(!strcmp(name,"java")) + xbt_ctx_java_factory_init(factory); +#ifdef CONTEXT_THREADS + else if(!strcmp(name,"thread")) + xbt_ctx_thread_factory_init(factory); +#elif !defined(WIN32) + else if(!strcmp(name,"sysv")) + xbt_ctx_sysv_factory_init(factory); +#endif + else + THROW1(not_found_error, 0,"Factory '%s' does not exist",name); } /** Garbage collection -- 2.20.1