Enlightenment CVS committal Author : devilhorns Project : e17 Module : libs/ecore
Dir : e17/libs/ecore/src/lib/ecore Modified Files: ecore_path.c Log Message: Format to 'E' formatting. Note: No functional changes, only formatting. =================================================================== RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore/ecore_path.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -3 -r1.8 -r1.9 --- ecore_path.c 6 Jan 2006 17:58:12 -0000 1.8 +++ ecore_path.c 23 Jun 2006 06:40:52 -0000 1.9 @@ -23,30 +23,30 @@ EAPI int ecore_path_group_new(char *group_name) { - Ecore_Path_Group *last; - Ecore_Path_Group *group; + Ecore_Path_Group *last; + Ecore_Path_Group *group; - CHECK_PARAM_POINTER_RETURN("group_name", group_name, -1); + CHECK_PARAM_POINTER_RETURN("group_name", group_name, -1); - if (!group_list) { - group_list = ecore_list_new(); - } - else { - group = __ecore_path_group_find(group_name); - if (group) - return -1; - } - - group = (Ecore_Path_Group *)malloc(sizeof(Ecore_Path_Group)); - memset(group, 0, sizeof(Ecore_Path_Group)); + if (!group_list) + group_list = ecore_list_new(); + else + { + group = __ecore_path_group_find(group_name); + if (group) + return -1; + } + + group = (Ecore_Path_Group *)malloc(sizeof(Ecore_Path_Group)); + memset(group, 0, sizeof(Ecore_Path_Group)); - group->name = strdup(group_name); - ecore_list_append(group_list, group); + group->name = strdup(group_name); + ecore_list_append(group_list, group); - last = ecore_list_goto_last(group_list); - group->id = last->id + 1; + last = ecore_list_goto_last(group_list); + group->id = last->id + 1; - return group->id; + return group->id; } /** @@ -57,21 +57,21 @@ EAPI void ecore_path_group_del(int group_id) { - Ecore_Path_Group *group; + Ecore_Path_Group *group; - group = __ecore_path_group_find_id(group_id); + group = __ecore_path_group_find_id(group_id); - if (!group) - return; + if (!group) + return; - if (group->paths) { - ecore_list_for_each(group->paths, - ECORE_FOR_EACH(free), NULL); - ecore_list_destroy(group->paths); - } + if (group->paths) + { + ecore_list_for_each(group->paths, ECORE_FOR_EACH(free), NULL); + ecore_list_destroy(group->paths); + } - free(group->name); - free(group); + free(group->name); + free(group); } /** @@ -83,19 +83,19 @@ EAPI void ecore_path_group_add(int group_id, char *path) { - Ecore_Path_Group *group; + Ecore_Path_Group *group; - CHECK_PARAM_POINTER("path", path); + CHECK_PARAM_POINTER("path", path); - group = __ecore_path_group_find_id(group_id); + group = __ecore_path_group_find_id(group_id); - if (!group) - return; + if (!group) + return; - if (!group->paths) - group->paths = ecore_list_new(); + if (!group->paths) + group->paths = ecore_list_new(); - ecore_list_append(group->paths, strdup(path)); + ecore_list_append(group->paths, strdup(path)); } /** @@ -107,32 +107,32 @@ EAPI void ecore_path_group_remove(int group_id, char *path) { - char *found; - Ecore_Path_Group *group; + char *found; + Ecore_Path_Group *group; - CHECK_PARAM_POINTER("path", path); + CHECK_PARAM_POINTER("path", path); - group = __ecore_path_group_find_id(group_id); + group = __ecore_path_group_find_id(group_id); - if (!group || !group->paths) - return; - - /* - * Find the path in the list of available paths - */ - ecore_list_goto_first(group->paths); - - while ((found = ecore_list_current(group->paths)) - && strcmp(found, path)) - ecore_list_next(group->paths); - - /* - * If the path is found, remove and free it - */ - if (found) { - ecore_list_remove(group->paths); - free(found); - } + if (!group || !group->paths) + return; + + /* + * Find the path in the list of available paths + */ + ecore_list_goto_first(group->paths); + + while ((found = ecore_list_current(group->paths)) && strcmp(found, path)) + ecore_list_next(group->paths); + + /* + * If the path is found, remove and free it + */ + if (found) + { + ecore_list_remove(group->paths); + free(found); + } } /** @@ -146,31 +146,33 @@ EAPI char * ecore_path_group_find(int group_id, char *name) { - int r; - char *p; - struct stat st; - char path[PATH_MAX]; - Ecore_Path_Group *group; - - CHECK_PARAM_POINTER_RETURN("name", name, NULL); - - group = __ecore_path_group_find_id(group_id); - - /* - * Search the paths of the path group for the specified file name - */ - ecore_list_goto_first(group->paths); - p = ecore_list_next(group->paths); - do { - snprintf(path, PATH_MAX, "%s/%s", p, name); - r = stat(path, &st); - } while (((r < 0) || !S_ISREG(st.st_mode)) && - (p = ecore_list_next(group->paths))); + int r; + char *p; + struct stat st; + char path[PATH_MAX]; + Ecore_Path_Group *group; + + CHECK_PARAM_POINTER_RETURN("name", name, NULL); + + group = __ecore_path_group_find_id(group_id); + + /* + * Search the paths of the path group for the specified file name + */ + ecore_list_goto_first(group->paths); + p = ecore_list_next(group->paths); + do + { + snprintf(path, PATH_MAX, "%s/%s", p, name); + r = stat(path, &st); + } + while (((r < 0) || !S_ISREG(st.st_mode)) && + (p = ecore_list_next(group->paths))); - if (p) - p = strdup(path); + if (p) + p = strdup(path); - return p; + return p; } /** @@ -183,67 +185,67 @@ EAPI Ecore_List * ecore_path_group_available(int group_id) { - Ecore_List *avail = NULL; - Ecore_Path_Group *group; - char *path; + Ecore_List *avail = NULL; + Ecore_Path_Group *group; + char *path; - group = __ecore_path_group_find_id(group_id); + group = __ecore_path_group_find_id(group_id); - if (!group || !group->paths || ecore_list_is_empty(group->paths)) - return NULL; + if (!group || !group->paths || ecore_list_is_empty(group->paths)) + return NULL; - ecore_list_goto_first(group->paths); + ecore_list_goto_first(group->paths); - while ((path = ecore_list_next(group->paths)) != NULL) - { - DIR *dir; - struct stat st; - struct dirent *d; + while ((path = ecore_list_next(group->paths)) != NULL) + { + DIR *dir; + struct stat st; + struct dirent *d; - stat(path, &st); + stat(path, &st); - if (!S_ISDIR(st.st_mode)) - continue; + if (!S_ISDIR(st.st_mode)) + continue; - dir = opendir(path); + dir = opendir(path); - if (!dir) - continue; + if (!dir) + continue; - while ((d = readdir(dir)) != NULL) - { - char ppath[PATH_MAX]; - char *ext; - char n[PATH_MAX]; - int l; + while ((d = readdir(dir)) != NULL) + { + char ppath[PATH_MAX]; + char *ext; + char n[PATH_MAX]; + int l; - if (!strncmp(d->d_name, ".", 1)) - continue; + if (!strncmp(d->d_name, ".", 1)) + continue; - ext = strrchr(d->d_name, '.'); + ext = strrchr(d->d_name, '.'); - if (!ext || strncmp(ext, ".so", 3)) - continue; + if (!ext || strncmp(ext, ".so", 3)) + continue; - snprintf(ppath, PATH_MAX, "%s/%s", path, d->d_name); + snprintf(ppath, PATH_MAX, "%s/%s", path, d->d_name); - stat(ppath, &st); + stat(ppath, &st); - if (!S_ISREG(st.st_mode)) - continue; + if (!S_ISREG(st.st_mode)) + continue; - l = strlen(d->d_name); + l = strlen(d->d_name); - strncpy(n, d->d_name, l - 2); + strncpy(n, d->d_name, l - 2); - if (!avail) - avail = ecore_list_new(); + if (!avail) + avail = ecore_list_new(); - ecore_list_append(avail, strdup(n)); - } + ecore_list_append(avail, strdup(n)); } + } - return avail; + return avail; } /* @@ -252,17 +254,17 @@ Ecore_Path_Group * __ecore_path_group_find(char *name) { - Ecore_Path_Group *group; + Ecore_Path_Group *group; - CHECK_PARAM_POINTER_RETURN("name", name, NULL); + CHECK_PARAM_POINTER_RETURN("name", name, NULL); - ecore_list_goto_first(group_list); + ecore_list_goto_first(group_list); - while ((group = ecore_list_next(group_list)) != NULL) - if (!strcmp(group->name, name)) - return group; + while ((group = ecore_list_next(group_list)) != NULL) + if (!strcmp(group->name, name)) + return group; - return NULL; + return NULL; } /* @@ -271,13 +273,13 @@ Ecore_Path_Group * __ecore_path_group_find_id(int id) { - Ecore_Path_Group *group; + Ecore_Path_Group *group; - ecore_list_goto_first(group_list); + ecore_list_goto_first(group_list); - while ((group = ecore_list_next(group_list)) != NULL) - if (group->id == id) - return group; + while ((group = ecore_list_next(group_list)) != NULL) + if (group->id == id) + return group; - return NULL; + return NULL; } Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs