Enlightenment CVS committal

Author  : dj2
Project : e17
Module  : libs/ewl

Dir     : e17/libs/ewl/src/bin


Modified Files:
        main.c 


Log Message:
- inline the creating of the test struct. no reason to pull out to a
  separate list. fixes a valgrind warning.

===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/bin/main.c,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -3 -r1.55 -r1.56
--- main.c      15 Feb 2007 02:44:26 -0000      1.55
+++ main.c      6 Mar 2007 23:35:30 -0000       1.56
@@ -344,7 +344,7 @@
 ewl_test_setup_tests(void)
 {
        char buf[PATH_MAX], buf2[PATH_MAX];
-       Ecore_List *list = NULL, *list2;
+       Ecore_List *list = NULL;
        char *file = NULL;
 
        tests = ecore_list_new();
@@ -352,9 +352,6 @@
 
        ecore_list_set_free_cb(tests, ECORE_FREE_CB(free));
 
-       list2 = ecore_list_new();
-       if (!list2) return 0;
-
        snprintf(buf, sizeof(buf), "%s", PACKAGE_LIB_DIR "/ewl/tests");
        list = ecore_file_ls(buf);
        if (list && ecore_list_nodes(list) > 0)
@@ -368,9 +365,26 @@
                        len = strlen(file);
                        if (!strncmp(file + (len - 3), ".so", 3))
                        {
-                               snprintf(buf2, sizeof(buf2), "%s/%s", 
-                                                               buf, file);
-                               ecore_list_append(list2, strdup(buf2));
+                               void *handle;
+
+                               snprintf(buf2, sizeof(buf2), "%s/%s", buf, 
file);
+                               handle = dlopen(buf2, RTLD_LAZY | RTLD_GLOBAL);
+                               if (handle)
+                               {
+                                       void (*func_info)(Ewl_Test *test);
+
+                                       /* the UI test info */
+                                       func_info = dlsym(handle, "test_info");
+                                       if (func_info)
+                                       {
+                                               Ewl_Test *t;
+                               
+                                               t = calloc(1, sizeof(Ewl_Test));
+                                               func_info(t);
+                                               t->handle = handle;
+                                               ecore_list_append(tests, t);
+                                       }
+                               }
                        }
                        free(file);
                }
@@ -378,33 +392,7 @@
        }
 
        /* no tests found ... */
-       if (ecore_list_nodes(list2) == 0) return 0;
-
-       /* open each test file and get the Test struct from it */
-       while ((file = ecore_list_remove_first(list2)))
-       {
-               void *handle;
-               
-               handle = dlopen(file, RTLD_LAZY | RTLD_GLOBAL);
-               if (handle)
-               {
-                       void (*func_info)(Ewl_Test *test);
-
-                       /* the UI test info */
-                       func_info = dlsym(handle, "test_info");
-                       if (func_info)
-                       {
-                               Ewl_Test *t;
-                               
-                               t = calloc(1, sizeof(Ewl_Test));
-                               func_info(t);
-                               t->handle = handle;
-                               ecore_list_append(tests, t);
-                       }
-               }
-               free(file);
-       }
-       ecore_list_destroy(list2);
+       if (ecore_list_nodes(tests) == 0) return 0;
 
        return 1;
 }



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to