diff options
author | Cedric BAIL <cedric@osg.samsung.com> | 2017-06-05 13:53:28 -0700 |
---|---|---|
committer | Cedric BAIL <cedric@osg.samsung.com> | 2017-06-05 13:53:28 -0700 |
commit | a784e4ac420244c1c7507acb4f5843c13806009e (patch) | |
tree | 4f77d58a9564438e47eac320ac5210b2cb856ece /src/lib/ecore_evas/ecore_evas_module.c | |
parent | cab25162576965a2a6267871045c7c512b86f1c2 (diff) |
ecore_evas: use strbuf instead of PATH_MAX.
Diffstat (limited to '')
-rw-r--r-- | src/lib/ecore_evas/ecore_evas_module.c | 116 |
1 files changed, 58 insertions, 58 deletions
diff --git a/src/lib/ecore_evas/ecore_evas_module.c b/src/lib/ecore_evas/ecore_evas_module.c index 71ca38a0f5..b8dcdee821 100644 --- a/src/lib/ecore_evas/ecore_evas_module.c +++ b/src/lib/ecore_evas/ecore_evas_module.c | |||
@@ -234,116 +234,116 @@ _ecore_evas_available_engines_get(void) | |||
234 | Eina_File_Direct_Info *info; | 234 | Eina_File_Direct_Info *info; |
235 | Eina_Iterator *it; | 235 | Eina_Iterator *it; |
236 | Eina_List *l = NULL, *result = NULL; | 236 | Eina_List *l = NULL, *result = NULL; |
237 | Eina_Strbuf *buf; | ||
237 | const char *path; | 238 | const char *path; |
238 | 239 | ||
239 | if (_engines_available) return _engines_available; | 240 | if (_engines_available) return _engines_available; |
240 | 241 | ||
242 | buf = eina_strbuf_new(); | ||
241 | EINA_LIST_FOREACH(_engines_paths, l, path) | 243 | EINA_LIST_FOREACH(_engines_paths, l, path) |
242 | { | 244 | { |
243 | it = eina_file_direct_ls(path); | 245 | it = eina_file_direct_ls(path); |
244 | 246 | ||
245 | if (it) | 247 | EINA_ITERATOR_FOREACH(it, info) |
246 | { | 248 | { |
247 | EINA_ITERATOR_FOREACH(it, info) | 249 | eina_strbuf_append_printf(buf, "%s/%s/" ECORE_EVAS_ENGINE_NAME, |
248 | { | 250 | info->path, MODULE_ARCH); |
249 | char tmp[PATH_MAX]; | ||
250 | snprintf(tmp, sizeof (tmp), "%s/%s/" ECORE_EVAS_ENGINE_NAME, | ||
251 | info->path, MODULE_ARCH); | ||
252 | 251 | ||
253 | if (_file_exists(tmp)) | 252 | if (_file_exists(eina_strbuf_string_get(buf))) |
254 | { | 253 | { |
255 | const char *name; | 254 | const char *name; |
256 | 255 | ||
257 | #ifdef _WIN32 | 256 | #ifdef _WIN32 |
258 | EVIL_PATH_SEP_WIN32_TO_UNIX(info->path); | 257 | EVIL_PATH_SEP_WIN32_TO_UNIX(info->path); |
259 | #endif | 258 | #endif |
260 | name = strrchr(info->path, '/'); | 259 | name = strrchr(info->path, '/'); |
261 | if (name) name++; | 260 | if (name) name++; |
262 | else name = info->path; | 261 | else name = info->path; |
263 | #define ADDENG(x) result = eina_list_append(result, eina_stringshare_add(x)) | 262 | #define ADDENG(x) result = eina_list_append(result, eina_stringshare_add(x)) |
264 | if (!strcmp(name, "fb")) | 263 | if (!strcmp(name, "fb")) |
265 | { | 264 | { |
266 | #ifdef BUILD_ECORE_EVAS_FB | 265 | #ifdef BUILD_ECORE_EVAS_FB |
267 | ADDENG("fb"); | 266 | ADDENG("fb"); |
268 | #endif | 267 | #endif |
269 | } | 268 | } |
270 | else if (!strcmp(name, "x")) | 269 | else if (!strcmp(name, "x")) |
271 | { | 270 | { |
272 | #ifdef BUILD_ECORE_EVAS_OPENGL_X11 | 271 | #ifdef BUILD_ECORE_EVAS_OPENGL_X11 |
273 | ADDENG("opengl_x11"); | 272 | ADDENG("opengl_x11"); |
274 | #endif | 273 | #endif |
275 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_XLIB | 274 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_XLIB |
276 | ADDENG("software_x11"); | 275 | ADDENG("software_x11"); |
277 | #endif | 276 | #endif |
278 | } | 277 | } |
279 | else if (!strcmp(name, "buffer")) | 278 | else if (!strcmp(name, "buffer")) |
280 | { | 279 | { |
281 | #ifdef BUILD_ECORE_EVAS_BUFFER | 280 | #ifdef BUILD_ECORE_EVAS_BUFFER |
282 | ADDENG("buffer"); | 281 | ADDENG("buffer"); |
283 | #endif | 282 | #endif |
284 | #ifdef BUILD_ECORE_EVAS_EWS | 283 | #ifdef BUILD_ECORE_EVAS_EWS |
285 | ADDENG("ews"); | 284 | ADDENG("ews"); |
286 | #endif | 285 | #endif |
287 | } | 286 | } |
288 | else if (!strcmp(name, "cocoa")) | 287 | else if (!strcmp(name, "cocoa")) |
289 | { | 288 | { |
290 | #ifdef BUILD_ECORE_EVAS_OPENGL_COCOA | 289 | #ifdef BUILD_ECORE_EVAS_OPENGL_COCOA |
291 | ADDENG("opengl_cocoa"); | 290 | ADDENG("opengl_cocoa"); |
292 | #endif | 291 | #endif |
293 | } | 292 | } |
294 | else if (!strcmp(name, "psl1ght")) | 293 | else if (!strcmp(name, "psl1ght")) |
295 | { | 294 | { |
296 | #ifdef BUILD_ECORE_EVAS_PSL1GHT | 295 | #ifdef BUILD_ECORE_EVAS_PSL1GHT |
297 | ADDENG("psl1ght"); | 296 | ADDENG("psl1ght"); |
298 | #endif | 297 | #endif |
299 | } | 298 | } |
300 | else if (!strcmp(name, "sdl")) | 299 | else if (!strcmp(name, "sdl")) |
301 | { | 300 | { |
302 | #ifdef BUILD_ECORE_EVAS_OPENGL_SDL | 301 | #ifdef BUILD_ECORE_EVAS_OPENGL_SDL |
303 | ADDENG("opengl_sdl"); | 302 | ADDENG("opengl_sdl"); |
304 | #endif | 303 | #endif |
305 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_SDL | 304 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_SDL |
306 | ADDENG("sdl"); | 305 | ADDENG("sdl"); |
307 | #endif | 306 | #endif |
308 | } | 307 | } |
309 | else if (!strcmp(name, "wayland")) | 308 | else if (!strcmp(name, "wayland")) |
310 | { | 309 | { |
311 | #ifdef BUILD_ECORE_EVAS_WAYLAND_SHM | 310 | #ifdef BUILD_ECORE_EVAS_WAYLAND_SHM |
312 | ADDENG("wayland_shm"); | 311 | ADDENG("wayland_shm"); |
313 | #endif | 312 | #endif |
314 | #ifdef BUILD_ECORE_EVAS_WAYLAND_EGL | 313 | #ifdef BUILD_ECORE_EVAS_WAYLAND_EGL |
315 | ADDENG("wayland_egl"); | 314 | ADDENG("wayland_egl"); |
316 | #endif | 315 | #endif |
317 | } | 316 | } |
318 | else if (!strcmp(name, "win32")) | 317 | else if (!strcmp(name, "win32")) |
319 | { | 318 | { |
320 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_GDI | 319 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_GDI |
321 | ADDENG("software_gdi"); | 320 | ADDENG("software_gdi"); |
322 | #endif | 321 | #endif |
323 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_DDRAW | 322 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_DDRAW |
324 | ADDENG("software_ddraw"); | 323 | ADDENG("software_ddraw"); |
325 | #endif | 324 | #endif |
326 | #ifdef BUILD_ECORE_EVAS_DIRECT3D | 325 | #ifdef BUILD_ECORE_EVAS_DIRECT3D |
327 | ADDENG("direct3d"); | 326 | ADDENG("direct3d"); |
328 | #endif | 327 | #endif |
329 | #ifdef BUILD_ECORE_EVAS_OPENGL_GLEW | 328 | #ifdef BUILD_ECORE_EVAS_OPENGL_GLEW |
330 | ADDENG("opengl_glew"); | 329 | ADDENG("opengl_glew"); |
331 | #endif | 330 | #endif |
332 | } | 331 | } |
333 | else if (!strcmp(name, "drm")) | 332 | else if (!strcmp(name, "drm")) |
334 | { | 333 | { |
335 | #ifdef BUILD_ECORE_EVAS_DRM | 334 | #ifdef BUILD_ECORE_EVAS_DRM |
336 | ADDENG("drm"); | 335 | ADDENG("drm"); |
337 | #endif | 336 | #endif |
338 | #ifdef BUILD_ECORE_EVAS_GL_DRM | 337 | #ifdef BUILD_ECORE_EVAS_GL_DRM |
339 | ADDENG("gl_drm"); | 338 | ADDENG("gl_drm"); |
340 | #endif | 339 | #endif |
341 | } | ||
342 | } | 340 | } |
343 | } | 341 | } |
344 | eina_iterator_free(it); | 342 | eina_strbuf_reset(buf); |
345 | } | 343 | } |
344 | eina_iterator_free(it); | ||
346 | } | 345 | } |
346 | eina_strbuf_free(buf); | ||
347 | 347 | ||
348 | _engines_available = result; | 348 | _engines_available = result; |
349 | return result; | 349 | return result; |