diff options
author | Cedric BAIL <cedric@osg.samsung.com> | 2017-06-05 13:40:40 -0700 |
---|---|---|
committer | Cedric BAIL <cedric@osg.samsung.com> | 2017-06-05 13:40:40 -0700 |
commit | deca2c4b0fad86ee1902cfc8474abe27d43ff7dd (patch) | |
tree | 06ceb564486566eb382b0f3df086f2f103e7294e | |
parent | f3370549d24ec015c68b0545a284a724fe17c1e3 (diff) | |
download | efl-deca2c4b0fad86ee1902cfc8474abe27d43ff7dd.tar.gz |
edje: use strbuf instead of hard coded PATH_MAX.
-rw-r--r-- | src/lib/edje/edje_module.c | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/src/lib/edje/edje_module.c b/src/lib/edje/edje_module.c index 68d3caa5ee..80ae9c78e4 100644 --- a/src/lib/edje/edje_module.c +++ b/src/lib/edje/edje_module.c @@ -148,6 +148,7 @@ edje_available_modules_get(void) Eina_Iterator *it; Eina_List *l; const char *path; + Eina_Strbuf *buf; Eina_List *result = NULL; /* FIXME: Stat each possible dir and check if they did change, before starting a huge round of readdir/stat */ @@ -157,32 +158,29 @@ edje_available_modules_get(void) eina_stringshare_del(path); } + buf = eina_strbuf_new(); EINA_LIST_FOREACH(_modules_paths, l, path) { it = eina_file_direct_ls(path); - if (it) + EINA_ITERATOR_FOREACH(it, info) { - EINA_ITERATOR_FOREACH(it, info) - { - char tmp[PATH_MAX]; - - snprintf(tmp, sizeof (tmp), "%s/%s/" EDJE_MODULE_NAME, info->path, MODULE_ARCH + eina_strbuf_append_printf(buf, "%s/%s/" EDJE_MODULE_NAME, info->path, MODULE_ARCH #ifdef EDJE_EXTRA_MODULE_NAME - , info->path + info->name_start + , info->path + info->name_start #endif - ); - - if (ecore_file_exists(tmp)) - result = eina_list_append(result, eina_stringshare_add(info->path + info->name_start)); - } + ); - eina_iterator_free(it); + if (ecore_file_exists(eina_strbuf_string_get(buf))) + result = eina_list_append(result, eina_stringshare_add(info->path + info->name_start)); + eina_strbuf_reset(buf); } + + eina_iterator_free(it); } + eina_strbuf_free(buf); _modules_found = result; return result; } - |