Fix initializations in tests
authorEduardo Lima (Etrunko) <eduardo.lima@intel.com>
Tue, 17 Sep 2013 18:33:38 +0000 (15:33 -0300)
committerEduardo Lima (Etrunko) <eduardo.lima@intel.com>
Thu, 19 Sep 2013 22:45:26 +0000 (19:45 -0300)
Signed-off-by: Eduardo Lima (Etrunko) <eduardo.lima@intel.com>
src/wkb-ibus-config-eet-test.c
src/wkb-ibus-test.c

index a4f0ced5cc8d07a13dd05485a8e47207431dfeeb..5c014f1facef908ad1be9998826812638069ddfe 100644 (file)
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
-#include "wkb-ibus-config-eet.h"
+#include <stdio.h>
 
 #include <Eina.h>
 #include <Eet.h>
 
+#include "wkb-ibus-config-eet.h"
+
 int
 main (int argc, char *argv[])
 {
@@ -33,13 +34,16 @@ main (int argc, char *argv[])
    if (!eet_init())
      {
         printf("Error initializing eet");
-        return 1;
+        goto eet_err;
      }
 
    cfg = wkb_ibus_config_eet_new("ibus-cfg.eet");
    wkb_ibus_config_eet_free(cfg);
 
+end:
    eet_shutdown();
+
+eet_err:
    eina_shutdown();
 
    return 0;
index ced4700c7ba45e0b2bca75bfc9de51200eaf876b..e9bcf03b394f3948ab320dc573f11bff8c22dcd4 100644 (file)
@@ -19,6 +19,8 @@
 #define _GNU_SOURCE
 #include <signal.h>
 
+#include <Eina.h>
+#include <Eet.h>
 #include <Ecore.h>
 #include <Eldbus.h>
 
@@ -38,22 +40,32 @@ _connect_timer(void *data)
 int
 main (int argc, char *argv[])
 {
+   int ret = 0;
+   if (!eet_init())
+     {
+        printf("Error initializing eet");
+        return 1;
+     }
+
    if (!ecore_init())
      {
         printf("Error initializing ecore");
-        return 1;
+        ret = 1;
+        goto ecore_err;
      }
 
    if (!eldbus_init())
      {
         printf("Error initializing eldbus");
-        return 1;
+        ret = 1;
+        goto eldbus_err;
      }
 
    if (!wkb_ibus_init())
      {
         printf("Error initializing ibus");
-        return 1;
+        ret = 1;
+        goto end;
      }
 
    ecore_timer_add(1, _connect_timer, NULL);
@@ -63,7 +75,14 @@ main (int argc, char *argv[])
 
    ecore_main_loop_begin();
 
+end:
    eldbus_shutdown();
+
+eldbus_err:
    ecore_shutdown();
-   return 0;
+
+ecore_err:
+   eet_shutdown();
+
+   return ret;
 }