Format to 'E' formatting.

Note: No functional changes, only formatting.


SVN revision: 23552
This commit is contained in:
Christopher Michael 2006-06-23 06:40:52 +00:00
parent 2572e14d3e
commit 20f3183f49
1 changed files with 136 additions and 134 deletions

View File

@ -23,30 +23,30 @@ Ecore_Path_Group *__ecore_path_group_find_id(int id);
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;
}
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 = (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 @@ ecore_path_group_new(char *group_name)
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 @@ ecore_path_group_del(int group_id)
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 @@ ecore_path_group_add(int group_id, char *path)
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;
if (!group || !group->paths)
return;
/*
* Find the path in the list of available paths
*/
ecore_list_goto_first(group->paths);
/*
* 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);
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 the path is found, remove and free it
*/
if (found)
{
ecore_list_remove(group->paths);
free(found);
}
}
/**
@ -146,31 +146,33 @@ ecore_path_group_remove(int group_id, char *path)
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;
int r;
char *p;
struct stat st;
char path[PATH_MAX];
Ecore_Path_Group *group;
CHECK_PARAM_POINTER_RETURN("name", name, NULL);
CHECK_PARAM_POINTER_RETURN("name", name, NULL);
group = __ecore_path_group_find_id(group_id);
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)));
/*
* 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 @@ ecore_path_group_find(int group_id, char *name)
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)
while ((path = ecore_list_next(group->paths)) != NULL)
{
DIR *dir;
struct stat st;
struct dirent *d;
stat(path, &st);
if (!S_ISDIR(st.st_mode))
continue;
dir = opendir(path);
if (!dir)
continue;
while ((d = readdir(dir)) != NULL)
{
DIR *dir;
struct stat st;
struct dirent *d;
char ppath[PATH_MAX];
char *ext;
char n[PATH_MAX];
int l;
stat(path, &st);
if (!strncmp(d->d_name, ".", 1))
continue;
if (!S_ISDIR(st.st_mode))
continue;
ext = strrchr(d->d_name, '.');
dir = opendir(path);
if (!ext || strncmp(ext, ".so", 3))
continue;
if (!dir)
continue;
snprintf(ppath, PATH_MAX, "%s/%s", path, d->d_name);
while ((d = readdir(dir)) != NULL)
{
char ppath[PATH_MAX];
char *ext;
char n[PATH_MAX];
int l;
stat(ppath, &st);
if (!strncmp(d->d_name, ".", 1))
continue;
if (!S_ISREG(st.st_mode))
continue;
ext = strrchr(d->d_name, '.');
l = strlen(d->d_name);
if (!ext || strncmp(ext, ".so", 3))
continue;
strncpy(n, d->d_name, l - 2);
snprintf(ppath, PATH_MAX, "%s/%s", path, d->d_name);
if (!avail)
avail = ecore_list_new();
stat(ppath, &st);
if (!S_ISREG(st.st_mode))
continue;
l = strlen(d->d_name);
strncpy(n, d->d_name, l - 2);
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_available(int group_id)
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_find(char *name)
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;
}