ecore_evas: use strbuf instead of PATH_MAX.

This commit is contained in:
Cedric BAIL 2017-06-05 13:53:28 -07:00
parent cab2516257
commit a784e4ac42
1 changed files with 58 additions and 58 deletions

View File

@ -234,23 +234,22 @@ _ecore_evas_available_engines_get(void)
Eina_File_Direct_Info *info; Eina_File_Direct_Info *info;
Eina_Iterator *it; Eina_Iterator *it;
Eina_List *l = NULL, *result = NULL; Eina_List *l = NULL, *result = NULL;
Eina_Strbuf *buf;
const char *path; const char *path;
if (_engines_available) return _engines_available; if (_engines_available) return _engines_available;
buf = eina_strbuf_new();
EINA_LIST_FOREACH(_engines_paths, l, path) EINA_LIST_FOREACH(_engines_paths, l, path)
{ {
it = eina_file_direct_ls(path); it = eina_file_direct_ls(path);
if (it)
{
EINA_ITERATOR_FOREACH(it, info) EINA_ITERATOR_FOREACH(it, info)
{ {
char tmp[PATH_MAX]; eina_strbuf_append_printf(buf, "%s/%s/" ECORE_EVAS_ENGINE_NAME,
snprintf(tmp, sizeof (tmp), "%s/%s/" ECORE_EVAS_ENGINE_NAME,
info->path, MODULE_ARCH); info->path, MODULE_ARCH);
if (_file_exists(tmp)) if (_file_exists(eina_strbuf_string_get(buf)))
{ {
const char *name; const char *name;
@ -340,10 +339,11 @@ _ecore_evas_available_engines_get(void)
#endif #endif
} }
} }
eina_strbuf_reset(buf);
} }
eina_iterator_free(it); eina_iterator_free(it);
} }
} eina_strbuf_free(buf);
_engines_available = result; _engines_available = result;
return result; return result;