remove unnecessary momory allocation of exception_list 97/191797/3
authorYeongjong Lee <yj34.lee@samsung.com>
Wed, 24 Oct 2018 02:23:55 +0000 (11:23 +0900)
committerHermet Park <chuneon.park@samsung.com>
Fri, 26 Oct 2018 08:20:32 +0000 (08:20 +0000)
static memory allocation of exception_list is not necessary anymore.

Change-Id: I03e3e1ceec95966614cededa87608332c92a0b66

TC/ecore/utc_ecore.c
TC/edje/utc_edje.c
TC/eet/utc_eet.c
TC/eina/utc_eina.c
TC/eio/utc_eio.c
TC/evas/utc_evas.c

index 2768a0ad0f0daf06bfb94aef183519f0abab444a..0726bc704f257a2ff847a354185e9cc06b1493c8 100644 (file)
@@ -5,19 +5,6 @@
 #include "../utc_negative_unitest.h"
 
 pid_t ecore_main_pid;
-static char exception_list[2000][1000];
-
-static int
-test_case_validate(const char *tname)
-{
-   int i = 0;
-   for (i = 0; exception_list[i][0]; i++)
-     {
-        if (!strcmp(exception_list[i], tname)) return -1;
-     }
-
-   return 1;
-}
 
 static void
 tcase_get(Suite *s, const char **argv)
@@ -40,23 +27,28 @@ tcase_get(Suite *s, const char **argv)
      }
 
    fp = fopen("ecore_exception_list", "r");
-   if (fp)
+   if (!fp)
      {
-        for (i = 0; ; i++)
+        printf("Can't open exception_list\n");
+        exit(1);
+     }
+   for (i = 0; utc[i].test_case; i++)
+     {
+        char removed[1000];
+        int tc_removed = 0;
+        fseek(fp, 0L, SEEK_SET);
+        while (fscanf(fp, "%s", removed) != EOF)
           {
-             if (fscanf(fp, "%s", exception_list[i]) < 0)
+             if (!strcmp(removed, utc[i].test_case))
                {
-                  exception_list[i][0] = 0;
+                  tc_removed = 1;
                   break;
                }
           }
-        fclose(fp);
-     }
-   for (i = 0; utc[i].test_case; i++)
-     {
-        if (test_case_validate(utc[i].test_case) < 0) continue;
-        suite_add_tcase(s, utc[i].tc_get());
+        if (!tc_removed)
+          suite_add_tcase(s, utc[i].tc_get());
      }
+   fclose(fp);
    return;
 }
 
index 0d8e515e0026f5c20d5c4fe3a9c2f3f84bf18649..5adeeeb407e18ec1979af3a6beb0eee1cbb290f2 100644 (file)
@@ -3,20 +3,6 @@
 #include "utc_edje.h"
 #include "../utc_negative_unitest.h"
 
-static char exception_list[2000][1000];
-
-static int
-test_case_validate(const char *tname)
-{
-   int i = 0;
-   for (i = 0; exception_list[i][0]; i++)
-     {
-        if (!strcmp(exception_list[i], tname)) return -1;
-     }
-
-   return 1;
-}
-
 static void
 tcase_get(Suite *s, const char **argv)
 {
@@ -38,23 +24,28 @@ tcase_get(Suite *s, const char **argv)
      }
 
    fp = fopen("edje_exception_list", "r");
-   if (fp)
+   if (!fp)
      {
-        for (i = 0; ; i++)
+        printf("Can't open exception_list\n");
+        exit(1);
+     }
+   for (i = 0; utc[i].test_case; i++)
+     {
+        char removed[1000];
+        int tc_removed = 0;
+        fseek(fp, 0L, SEEK_SET);
+        while (fscanf(fp, "%s", removed) != EOF)
           {
-             if (fscanf(fp, "%s", exception_list[i]) < 0)
+             if (!strcmp(removed, utc[i].test_case))
                {
-                  exception_list[i][0] = 0;
+                  tc_removed = 1;
                   break;
                }
           }
-        fclose(fp);
-     }
-   for (i = 0; utc[i].test_case; i++)
-     {
-        if (test_case_validate(utc[i].test_case) < 0) continue;
-        suite_add_tcase(s, utc[i].tc_get());
+        if (!tc_removed)
+          suite_add_tcase(s, utc[i].tc_get());
      }
+   fclose(fp);
    return;
 }
 
index e91551f279eba64136abd46da051c21831938c59..58e8059e8cd4ae84078be79c98d11b4fcf7664d0 100644 (file)
@@ -3,20 +3,6 @@
 #include "utc_eet.h"
 #include "../utc_negative_unitest.h"
 
-static char exception_list[2000][1000];
-
-static int
-test_case_validate(const char *tname)
-{
-   int i = 0;
-   for (i = 0; exception_list[i][0]; i++)
-     {
-        if (!strcmp(exception_list[i], tname)) return -1;
-     }
-
-   return 1;
-}
-
 static void
 tcase_get(Suite *s, const char **argv)
 {
@@ -38,23 +24,29 @@ tcase_get(Suite *s, const char **argv)
      }
 
    fp = fopen("eet_exception_list", "r");
-   if (fp)
+   if (!fp)
      {
-        for (i = 0; ; i++)
+        printf("Can't open exception_list\n");
+        exit(1);
+     }
+   for (i = 0; utc[i].test_case; i++)
+     {
+        char removed[1000];
+        int tc_removed = 0;
+        fseek(fp, 0L, SEEK_SET);
+        while (fscanf(fp, "%s", removed) != EOF)
           {
-             if (fscanf(fp, "%s", exception_list[i]) < 0)
+             if (!strcmp(removed, utc[i].test_case))
                {
-                  exception_list[i][0] = 0;
+                  tc_removed = 1;
                   break;
                }
           }
-        fclose(fp);
-     }
-   for (i = 0; utc[i].test_case; i++)
-     {
-        if (test_case_validate(utc[i].test_case) < 0) continue;
-        suite_add_tcase(s, utc[i].tc_get());
+        if (!tc_removed)
+          suite_add_tcase(s, utc[i].tc_get());
      }
+   fclose(fp);
+
    return;
 }
 
index a60cc2f50f5307c4c16497bab7c233df5bd92365..f6d65e91d3896da5d6d2487b4b723b31bcfaafe1 100644 (file)
@@ -4,19 +4,6 @@
 #include "../utc_negative_unitest.h"
 
 pid_t eina_main_pid;
-static char exception_list[2000][1000];
-
-static int
-test_case_validate(const char *tname)
-{
-   int i = 0;
-   for (i = 0; exception_list[i][0]; i++)
-     {
-        if (!strcmp(exception_list[i], tname)) return -1;
-     }
-
-   return 1;
-}
 
 static void
 tcase_get(Suite *s, const char **argv)
@@ -39,23 +26,29 @@ tcase_get(Suite *s, const char **argv)
      }
 
    fp = fopen("eina_exception_list", "r");
-   if (fp)
+   if (!fp)
+     {
+        printf("Can't open exception_list\n");
+        exit(1);
+     }
+   for (i = 0; utc[i].test_case; i++)
      {
-        for (i = 0; ; i++)
+        char removed[1000];
+        int tc_removed = 0;
+        fseek(fp, 0L, SEEK_SET);
+        while (fscanf(fp, "%s", removed) != EOF)
           {
-             if (fscanf(fp, "%s", exception_list[i]) < 0)
+             if (!strcmp(removed, utc[i].test_case))
                {
-                  exception_list[i][0] = 0;
+                  tc_removed = 1;
                   break;
                }
           }
-        fclose(fp);
-     }
-   for (i = 0; utc[i].test_case; i++)
-     {
-        if (test_case_validate(utc[i].test_case) < 0) continue;
-        suite_add_tcase(s, utc[i].tc_get());
+        if (!tc_removed)
+          suite_add_tcase(s, utc[i].tc_get());
      }
+   fclose(fp);
+
    return;
 }
 
index 2aa843323f52fe3edcd94f43d457ae9b2812aa25..fdd14df857dd361bff711ad489aa8547472ff50d 100644 (file)
@@ -3,20 +3,6 @@
 #include "utc_eio.h"
 #include "../utc_negative_unitest.h"
 
-static char exception_list[2000][1000];
-
-static int
-test_case_validate(const char *tname)
-{
-   int i = 0;
-   for (i = 0; exception_list[i][0]; i++)
-     {
-        if (!strcmp(exception_list[i], tname)) return -1;
-     }
-
-   return 1;
-}
-
 static void
 tcase_get(Suite *s, const char **argv)
 {
@@ -38,23 +24,29 @@ tcase_get(Suite *s, const char **argv)
      }
 
    fp = fopen("eio_exception_list", "r");
-   if (fp)
+   if (!fp)
      {
-        for (i = 0; ; i++)
+        printf("Can't open exception_list\n");
+        exit(1);
+     }
+   for (i = 0; utc[i].test_case; i++)
+     {
+        char removed[1000];
+        int tc_removed = 0;
+        fseek(fp, 0L, SEEK_SET);
+        while (fscanf(fp, "%s", removed) != EOF)
           {
-             if (fscanf(fp, "%s", exception_list[i]) < 0)
+             if (!strcmp(removed, utc[i].test_case))
                {
-                  exception_list[i][0] = 0;
+                  tc_removed = 1;
                   break;
                }
           }
-        fclose(fp);
-     }
-   for (i = 0; utc[i].test_case; i++)
-     {
-        if (test_case_validate(utc[i].test_case) < 0) continue;
-        suite_add_tcase(s, utc[i].tc_get());
+        if (!tc_removed)
+          suite_add_tcase(s, utc[i].tc_get());
      }
+   fclose(fp);
+
    return;
 }
 
index b79f2e4356a48b97b96bec962b2f535accd78872..d0bfb62f8834d564a52f8c81c1365e34cb159a62 100644 (file)
@@ -3,20 +3,6 @@
 #include "utc_evas.h"
 #include "../utc_negative_unitest.h"
 
-static char exception_list[2000][1000];
-
-static int
-test_case_validate(const char *tname)
-{
-   int i = 0;
-   for (i = 0; exception_list[i][0]; i++)
-     {
-        if (!strcmp(exception_list[i], tname)) return -1;
-     }
-
-   return 1;
-}
-
 static void
 tcase_get(Suite *s, const char **argv)
 {
@@ -38,23 +24,29 @@ tcase_get(Suite *s, const char **argv)
      }
 
    fp = fopen("evas_exception_list", "r");
-   if (fp)
+   if (!fp)
      {
-        for (i = 0; ; i++)
+        printf("Can't open exception_list\n");
+        exit(1);
+     }
+   for (i = 0; utc[i].test_case; i++)
+     {
+        char removed[1000];
+        int tc_removed = 0;
+        fseek(fp, 0L, SEEK_SET);
+        while (fscanf(fp, "%s", removed) != EOF)
           {
-             if (fscanf(fp, "%s", exception_list[i]) < 0)
+             if (!strcmp(removed, utc[i].test_case))
                {
-                  exception_list[i][0] = 0;
+                  tc_removed = 1;
                   break;
                }
           }
-        fclose(fp);
-     }
-   for (i = 0; utc[i].test_case; i++)
-     {
-        if (test_case_validate(utc[i].test_case) < 0) continue;
-        suite_add_tcase(s, utc[i].tc_get());
+        if (!tc_removed)
+          suite_add_tcase(s, utc[i].tc_get());
      }
+   fclose(fp);
+
    return;
 }