Refactor jumps
authorlucas <lucas@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Fri, 10 Sep 2010 11:24:49 +0000 (11:24 +0000)
committerlucas <lucas@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Fri, 10 Sep 2010 11:24:49 +0000 (11:24 +0000)
Instead of relying on the value of edf (and having to set it on all
places to NULL) jump to 'open' label on the only possible case of the
control flow.

git-svn-id: http://svn.enlightenment.org/svn/e/trunk/edje@52132 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/edje_cache.c

index bcb0115..833667a 100644 (file)
@@ -203,7 +203,7 @@ _edje_file_dangling(Edje_File *edf)
 Edje_File *
 _edje_cache_file_coll_open(const char *file, const char *coll, int *error_ret, Edje_Part_Collection **edc_ret)
 {
-   Edje_File *edf = NULL;
+   Edje_File *edf;
    Eina_List *l, *hist;
    Edje_Part_Collection *edc;
    Edje_Part *ep;
@@ -226,7 +226,6 @@ _edje_cache_file_coll_open(const char *file, const char *coll, int *error_ret, E
        if (edf->mtime != st.st_mtime)
          {
             _edje_file_dangling(edf);
-            edf = NULL;
             goto open_new;
          }
 
@@ -242,28 +241,23 @@ _edje_cache_file_coll_open(const char *file, const char *coll, int *error_ret, E
               {
                  _edje_file_cache = eina_list_remove_list(_edje_file_cache, l);
                  _edje_file_free(edf);
-                 edf = NULL;
                  goto open_new;
               }
 
             edf->references = 1;
             _edje_file_cache = eina_list_remove_list(_edje_file_cache, l);
             eina_hash_add(_edje_file_hash, file, edf);
-            break;
+            goto open;
          }
-       edf = NULL;
      }
 
  open_new:
-   if (!edf)
-     {
-       if (!_edje_file_hash)
-         _edje_file_hash = eina_hash_string_small_new(NULL);
-       edf = _edje_file_open(file, coll, error_ret, edc_ret);
-       if (!edf) return NULL;
-       eina_hash_add(_edje_file_hash, file, edf);
-       return edf;
-     }
+   if (!_edje_file_hash)
+      _edje_file_hash = eina_hash_string_small_new(NULL);
+   edf = _edje_file_open(file, coll, error_ret, edc_ret);
+   if (!edf) return NULL;
+   eina_hash_add(_edje_file_hash, file, edf);
+   return edf;
 
  open: