summaryrefslogtreecommitdiff
path: root/src/modules/evas/engines/wayland_shm/evas_shm.c
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2017-02-10 08:58:29 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2017-02-10 19:27:15 +0900
commit0356b1eb5ebcfed8d4f080eab11ac40e3a53f068 (patch)
treeef81493a8a673f14d1a27bf50b95b874b0b0324c /src/modules/evas/engines/wayland_shm/evas_shm.c
parent7cc8f085b86e7172155912b53c423ba8990a6d60 (diff)
vpath usage - simplify to bare minimum to make gustavo happy
since these are only local path resolves, the do and wait are technically not needed. also remove any other tmp strings and use the vpath string resolving feature to avoid printfs/strjoins/cats etc. etc. as well. also remember to remove old name string from evas shm code - it worked for me. i guess i was lucky and it happened to be NULL thus free was fine.
Diffstat (limited to '')
-rw-r--r--src/modules/evas/engines/wayland_shm/evas_shm.c19
1 files changed, 5 insertions, 14 deletions
diff --git a/src/modules/evas/engines/wayland_shm/evas_shm.c b/src/modules/evas/engines/wayland_shm/evas_shm.c
index 05c7ec3945..529b6098f5 100644
--- a/src/modules/evas/engines/wayland_shm/evas_shm.c
+++ b/src/modules/evas/engines/wayland_shm/evas_shm.c
@@ -82,9 +82,6 @@ static struct wl_shm_pool *
82_shm_pool_make(struct wl_shm *shm, int size, void **data) 82_shm_pool_make(struct wl_shm *shm, int size, void **data)
83{ 83{
84 struct wl_shm_pool *pool; 84 struct wl_shm_pool *pool;
85 static const char tmp[] = "evas-wayland_shm-XXXXXX";
86 const char *path;
87 char *name;
88 int fd = 0; 85 int fd = 0;
89 Eina_Tmpstr *fullname; 86 Eina_Tmpstr *fullname;
90 Efl_Vpath_File *file_obj; 87 Efl_Vpath_File *file_obj;
@@ -95,26 +92,20 @@ _shm_pool_make(struct wl_shm *shm, int size, void **data)
95 if (!shm) return NULL; 92 if (!shm) return NULL;
96 93
97 /* create tmp file name */ 94 /* create tmp file name */
98 file_obj = efl_vpath_manager_fetch(EFL_VPATH_MANAGER_CLASS, "(:run:)/"); 95 file_obj = efl_vpath_manager_fetch(EFL_VPATH_MANAGER_CLASS,
99 efl_vpath_file_do(file_obj); 96 "(:run:)/evas-wayland_shm-XXXXXX");
100 efl_vpath_file_wait(file_obj); 97 fd = eina_file_mkstemp(efl_vpath_file_result_get(file_obj), &fullname);
101 path = efl_vpath_file_result_get(file_obj); 98 efl_del(file_obj);
102 if ((name = malloc(strlen(path) + sizeof(tmp)))) strcpy(name, path); 99
103 if (!name) return NULL;
104 strcat(name, tmp);
105
106 fd = eina_file_mkstemp(name, &fullname);
107 if (fd < 0) 100 if (fd < 0)
108 /* try to create tmp file */ 101 /* try to create tmp file */
109 /* if ((fd = mkstemp(name)) < 0) */ 102 /* if ((fd = mkstemp(name)) < 0) */
110 { 103 {
111 ERR("Could not create temporary file: %m"); 104 ERR("Could not create temporary file: %m");
112 free(name);
113 return NULL; 105 return NULL;
114 } 106 }
115 107
116 unlink(fullname); 108 unlink(fullname);
117 free(name);
118 eina_tmpstr_del(fullname); 109 eina_tmpstr_del(fullname);
119 110
120 /* try to truncate file to size */ 111 /* try to truncate file to size */