From: lucas Date: Fri, 10 Sep 2010 11:25:15 +0000 (+0000) Subject: Refactor function to return as early as possible X-Git-Tag: submit/trunk/20120815.180907~902 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ddedf705fd59dd35d576d987f432eaf8df89b9a5;p=profile%2Fivi%2Fedje.git Refactor function to return as early as possible Instead of a looooooong 'if', return on the contrary. git-svn-id: http://svn.enlightenment.org/svn/e/trunk/edje@52134 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- diff --git a/src/lib/edje_load.c b/src/lib/edje_load.c index f6b11a1..3744f74 100644 --- a/src/lib/edje_load.c +++ b/src/lib/edje_load.c @@ -183,40 +183,41 @@ edje_file_group_exists(const char *file, const char *glob) Edje_File *edf; int error_ret = 0; Eina_Bool succeed = EINA_FALSE; + Edje_Patterns *patterns; + + if ((!file) || (!*file)) + return EINA_FALSE; - if ((!file) || (!*file)) return EINA_FALSE; edf = _edje_cache_file_coll_open(file, NULL, &error_ret, NULL); - if (edf) - { - Edje_Patterns *patterns; + if (!edf) + return EINA_FALSE; - if (edf->collection_patterns) - { - patterns = edf->collection_patterns; - } - else - { - Edje_Part_Collection_Directory_Entry *ce; - Eina_Iterator *i; - Eina_List *l = NULL; + if (edf->collection_patterns) + { + patterns = edf->collection_patterns; + } + else + { + Edje_Part_Collection_Directory_Entry *ce; + Eina_Iterator *i; + Eina_List *l = NULL; - i = eina_hash_iterator_data_new(edf->collection); + i = eina_hash_iterator_data_new(edf->collection); - EINA_ITERATOR_FOREACH(i, ce) - l = eina_list_append(l, ce); + EINA_ITERATOR_FOREACH(i, ce) + l = eina_list_append(l, ce); - eina_iterator_free(i); + eina_iterator_free(i); - patterns = edje_match_collection_dir_init(l); - eina_list_free(l); - } + patterns = edje_match_collection_dir_init(l); + eina_list_free(l); + } - succeed = edje_match_collection_dir_exec(patterns, glob); + succeed = edje_match_collection_dir_exec(patterns, glob); - edf->collection_patterns = patterns; + edf->collection_patterns = patterns; - _edje_cache_file_unref(edf); - } + _edje_cache_file_unref(edf); return succeed; }