summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2017-02-09 22:06:16 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2017-02-09 22:06:16 +0900
commit2037474dc0fd2b360452f2a15abcbe533b57ca37 (patch)
tree7e5da455c6dadabd9c2c023bd3b2d12abe321f67 /src
parent810b17e7a4338d9fe8b6a3bebf92761880600eff (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.
Diffstat (limited to '')
-rw-r--r--src/lib/efreet/efreet_base.c5
-rw-r--r--src/lib/elementary/elm_config.c28
-rw-r--r--src/lib/elput/elput_evdev.c11
-rw-r--r--src/modules/ecore_buffer/shm/ecore_buffer_shm.c15
-rw-r--r--src/modules/evas/engines/wayland_shm/evas_shm.c16
5 files changed, 21 insertions, 54 deletions
diff --git a/src/lib/efreet/efreet_base.c b/src/lib/efreet/efreet_base.c
index 506d2e89a4..d510cde10e 100644
--- a/src/lib/efreet/efreet_base.c
+++ b/src/lib/efreet/efreet_base.c
@@ -311,9 +311,8 @@ efreet_dirs_init(void)
311#endif 311#endif
312 312
313 /* xdg_runtime_dir */ 313 /* xdg_runtime_dir */
314 file_obj = efl_vpath_manager_fetch(EFL_VPATH_MANAGER_CLASS, "(:run:)/"); 314 file_obj = efl_vpath_manager_fetch(EFL_VPATH_MANAGER_CLASS,
315 efl_vpath_file_do(file_obj); 315 "(:run:)/");
316 efl_vpath_file_wait(file_obj);
317 xdg_runtime_dir = eina_stringshare_add(efl_vpath_file_result_get(file_obj)); 316 xdg_runtime_dir = eina_stringshare_add(efl_vpath_file_result_get(file_obj));
318 efl_del(file_obj); 317 efl_del(file_obj);
319 318
diff --git a/src/lib/elementary/elm_config.c b/src/lib/elementary/elm_config.c
index 58dd95e9e8..48330cdfcf 100644
--- a/src/lib/elementary/elm_config.c
+++ b/src/lib/elementary/elm_config.c
@@ -615,9 +615,6 @@ _elm_config_user_dir_snprintf(char *dst,
615 va_list ap; 615 va_list ap;
616 Efl_Vpath_File *file_obj; 616 Efl_Vpath_File *file_obj;
617 static int use_xdg_config = -1; 617 static int use_xdg_config = -1;
618 const char elmdir[] = "elementary";
619 const char elmdotdir[] = ".elementary";
620 const char *path = NULL;
621 618
622 if (use_xdg_config == -1) 619 if (use_xdg_config == -1)
623 { 620 {
@@ -625,26 +622,15 @@ _elm_config_user_dir_snprintf(char *dst,
625 else use_xdg_config = 0; 622 else use_xdg_config = 0;
626 } 623 }
627 if (use_xdg_config) 624 if (use_xdg_config)
628 { 625 file_obj = efl_vpath_manager_fetch(EFL_VPATH_MANAGER_CLASS,
629 file_obj = efl_vpath_manager_fetch(EFL_VPATH_MANAGER_CLASS, "(:config:)/"); 626 "(:config:)/elementary");
630 efl_vpath_file_do(file_obj);
631 efl_vpath_file_wait(file_obj);
632 path = efl_vpath_file_result_get(file_obj);
633 user_dir_len = eina_str_join_len
634 (dst, size, '/', path, strlen(path) - 1, elmdir, sizeof(elmdir) - 1);
635 efl_del(file_obj);
636 }
637 else 627 else
638 { 628 file_obj = efl_vpath_manager_fetch(EFL_VPATH_MANAGER_CLASS,
639 file_obj = efl_vpath_manager_fetch(EFL_VPATH_MANAGER_CLASS, "(:home:)/"); 629 "(:home:)/.elementary");
640 efl_vpath_file_do(file_obj); 630 eina_strlcpy(dst, efl_vpath_file_result_get(file_obj), size);
641 efl_vpath_file_wait(file_obj); 631 efl_del(file_obj);
642 path = efl_vpath_file_result_get(file_obj);
643 user_dir_len = eina_str_join_len
644 (dst, size, '/', path, strlen(path) - 1, elmdotdir, sizeof(elmdotdir) - 1);
645 efl_del(file_obj);
646 }
647 632
633 user_dir_len = strlen(dst);
648 off = user_dir_len + 1; 634 off = user_dir_len + 1;
649 if (off >= size) return off; 635 if (off >= size) return off;
650 dst[user_dir_len] = '/'; 636 dst[user_dir_len] = '/';
diff --git a/src/lib/elput/elput_evdev.c b/src/lib/elput/elput_evdev.c
index 8067f24783..e29600ce50 100644
--- a/src/lib/elput/elput_evdev.c
+++ b/src/lib/elput/elput_evdev.c
@@ -60,21 +60,16 @@ _keyboard_modifiers_update(Elput_Keyboard *kbd, Elput_Seat *seat)
60static int 60static int
61_keyboard_fd_get(off_t size) 61_keyboard_fd_get(off_t size)
62{ 62{
63 const char *path;
64 Eina_Tmpstr *fullname; 63 Eina_Tmpstr *fullname;
65 long flags; 64 long flags;
66 int fd = 0; 65 int fd = 0;
67 char tmp[PATH_MAX];
68 Efl_Vpath_File *file_obj; 66 Efl_Vpath_File *file_obj;
69 67
70 file_obj = efl_vpath_manager_fetch(EFL_VPATH_MANAGER_CLASS, "(:run:)/"); 68 file_obj = efl_vpath_manager_fetch(EFL_VPATH_MANAGER_CLASS,
71 efl_vpath_file_do(file_obj); 69 "(:run:)/elput-keymap-XXXXXX");
72 efl_vpath_file_wait(file_obj); 70 fd = eina_file_mkstemp(efl_vpath_file_result_get(file_obj), &fullname);
73 path = efl_vpath_file_result_get(file_obj);
74 snprintf(tmp, sizeof(tmp), "%s/elput-keymap-XXXXXX", path);
75 efl_del(file_obj); 71 efl_del(file_obj);
76 72
77 fd = eina_file_mkstemp(tmp, &fullname);
78 if (fd < 0) return -1; 73 if (fd < 0) return -1;
79 74
80 flags = fcntl(fd, F_GETFD); 75 flags = fcntl(fd, F_GETFD);
diff --git a/src/modules/ecore_buffer/shm/ecore_buffer_shm.c b/src/modules/ecore_buffer/shm/ecore_buffer_shm.c
index be270a9cbf..4a36c72f2d 100644
--- a/src/modules/ecore_buffer/shm/ecore_buffer_shm.c
+++ b/src/modules/ecore_buffer/shm/ecore_buffer_shm.c
@@ -54,8 +54,6 @@ _ecore_buffer_shm_buffer_alloc(Ecore_Buffer_Module_Data bmdata, int width, int h
54{ 54{
55 Ecore_Buffer_Shm_Data* b; 55 Ecore_Buffer_Shm_Data* b;
56 char *name; 56 char *name;
57 static const char tmp[] = "ecore-buffer-shared-XXXXXX";
58 const char *path;
59 int fd, size, page_size; 57 int fd, size, page_size;
60 Efl_Vpath_File *file_obj; 58 Efl_Vpath_File *file_obj;
61 59
@@ -70,16 +68,11 @@ _ecore_buffer_shm_buffer_alloc(Ecore_Buffer_Module_Data bmdata, int width, int h
70 b->size = page_size * (((b->stride * b->h) + (page_size - 1)) / page_size); 68 b->size = page_size * (((b->stride * b->h) + (page_size - 1)) / page_size);
71 b->am_owner = EINA_TRUE; 69 b->am_owner = EINA_TRUE;
72 70
73 file_obj = efl_vpath_manager_fetch(EFL_VPATH_MANAGER_CLASS, "(:run:)/"); 71 file_obj = efl_vpath_manager_fetch(EFL_VPATH_MANAGER_CLASS,
74 efl_vpath_file_do(file_obj); 72 "(:run:)/ecore-buffer-shared-XXXXXX");
75 efl_vpath_file_wait(file_obj); 73 name = strdup(efl_vpath_file_result_get(file_obj));
76 path = efl_vpath_file_result_get(file_obj);
77 size = strlen(path) + sizeof(tmp);
78 name = malloc(size);
79 if (!name) goto err;
80 strcpy(name, path);
81 strcat(name, tmp);
82 efl_del(file_obj); 74 efl_del(file_obj);
75 if (!name) goto err;
83 76
84 fd = mkostemp(name, O_CLOEXEC); 77 fd = mkostemp(name, O_CLOEXEC);
85 if (fd < 0) goto err_fd; 78 if (fd < 0) goto err_fd;
diff --git a/src/modules/evas/engines/wayland_shm/evas_shm.c b/src/modules/evas/engines/wayland_shm/evas_shm.c
index 05c7ec3945..3b9e7a525c 100644
--- a/src/modules/evas/engines/wayland_shm/evas_shm.c
+++ b/src/modules/evas/engines/wayland_shm/evas_shm.c
@@ -82,8 +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; 85 char *name;
88 int fd = 0; 86 int fd = 0;
89 Eina_Tmpstr *fullname; 87 Eina_Tmpstr *fullname;
@@ -95,15 +93,11 @@ _shm_pool_make(struct wl_shm *shm, int size, void **data)
95 if (!shm) return NULL; 93 if (!shm) return NULL;
96 94
97 /* create tmp file name */ 95 /* create tmp file name */
98 file_obj = efl_vpath_manager_fetch(EFL_VPATH_MANAGER_CLASS, "(:run:)/"); 96 file_obj = efl_vpath_manager_fetch(EFL_VPATH_MANAGER_CLASS,
99 efl_vpath_file_do(file_obj); 97 "(:run:)/evas-wayland_shm-XXXXXX");
100 efl_vpath_file_wait(file_obj); 98 fd = eina_file_mkstemp(efl_vpath_file_result_get(file_obj), &fullname);
101 path = efl_vpath_file_result_get(file_obj); 99 efl_del(file_obj);
102 if ((name = malloc(strlen(path) + sizeof(tmp)))) strcpy(name, path); 100
103 if (!name) return NULL;
104 strcat(name, tmp);
105
106 fd = eina_file_mkstemp(name, &fullname);
107 if (fd < 0) 101 if (fd < 0)
108 /* try to create tmp file */ 102 /* try to create tmp file */
109 /* if ((fd = mkstemp(name)) < 0) */ 103 /* if ((fd = mkstemp(name)) < 0) */