On Thu, Feb 9, 2017 at 11:07 AM, Carsten Haitzler <[email protected]> wrote: > raster pushed a commit to branch master. > > http://git.enlightenment.org/core/efl.git/commit/?id=2037474dc0fd2b360452f2a15abcbe533b57ca37 > > commit 2037474dc0fd2b360452f2a15abcbe533b57ca37 > Author: Carsten Haitzler (Rasterman) <[email protected]> > Date: Thu Feb 9 22:06:16 2017 +0900 > > vpath usage - simplify to bare minimum to make gustavo happy
I'm much happier now, at least it's more readable, less lines :-) But as I said in IRC, I'd add something to handle tmpfiles for us, simplifying things like this: > /* create tmp file name */ > - file_obj = efl_vpath_manager_fetch(EFL_VPATH_MANAGER_CLASS, "(:run:)/"); > - efl_vpath_file_do(file_obj); > - efl_vpath_file_wait(file_obj); > - path = efl_vpath_file_result_get(file_obj); > - if ((name = malloc(strlen(path) + sizeof(tmp)))) strcpy(name, path); > - if (!name) return NULL; > - strcat(name, tmp); > - > - fd = eina_file_mkstemp(name, &fullname); > + file_obj = efl_vpath_manager_fetch(EFL_VPATH_MANAGER_CLASS, > + "(:run:)/evas-wayland_shm-XXXXXX"); > + fd = eina_file_mkstemp(efl_vpath_file_result_get(file_obj), &fullname); > + efl_del(file_obj); something like file_obj being Efl.Io.File subclass and for cases where we want a tmpfile (maybe a different API or simply infer from "(:tmpfile:)/evas-wayland-shm-XXXXX"), it would handle the eina_file_mkstemp() internally, disposing the fd from efl_del(file_obj). > + > if (fd < 0) > /* try to create tmp file */ > /* if ((fd = mkstemp(name)) < 0) */ also removing the "fallback" case where they try to fix... if it failed, there is no point to keep trying, just propagate the error. -- Gustavo Sverzut Barbieri -------------------------------------- Mobile: +55 (16) 99354-9890 ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot _______________________________________________ enlightenment-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
