From: Davide A. <da...@gu...> - 2016-09-29 15:14:21
|
2016-09-28 0:50 GMT+02:00 Carsten Haitzler <ra...@ra...>: > On Tue, 27 Sep 2016 22:06:29 +0200 Davide Andreoli <da...@gu... > > > said: > > > 2016-09-27 17:19 GMT+02:00 Mike Blumenkrantz < > mic...@gm... > > >: > > > > > discomfitor pushed a commit to branch master. > > > > > > http://git.enlightenment.org/core/enlightenment.git/commit/?id= > > > 90fcc55f1e852af99c2f8c1075d5b88e32ddfac0 > > > > > > commit 90fcc55f1e852af99c2f8c1075d5b88e32ddfac0 > > > Author: Mike Blumenkrantz <zm...@os...> > > > Date: Tue Sep 27 11:18:38 2016 -0400 > > > > > > add e_util_open(), unify all callers of enlightenment_open > > > > > > ref adbba1042b6cf4a17e34d2fa22157ab7e838fcfa > > > --- > > > src/bin/e_utils.c | 17 +++++++++++++++++ > > > src/bin/e_utils.h | 2 ++ > > > src/modules/teamwork/e_mod_tw.c | 11 ++--------- > > > src/modules/tiling/e_mod_config.c | 10 +--------- > > > src/modules/wireless/wireless.c | 16 ++++------------ > > > 5 files changed, 26 insertions(+), 30 deletions(-) > > > > > > diff --git a/src/bin/e_utils.c b/src/bin/e_utils.c > > > index 63c337e..5b4dc56 100644 > > > --- a/src/bin/e_utils.c > > > +++ b/src/bin/e_utils.c > > > @@ -1441,3 +1441,20 @@ e_util_memclear(void *s, size_t n) > > > { > > > memset_ptr(s, 0, n); > > > } > > > + > > > + > > > +E_API Ecore_Exe * > > > +e_util_open(const char *exe, void *data) > > > +{ > > > + char *sb; > > > + size_t size = 65536, len; > > > + Ecore_Exe *ret; > > > + > > > + sb = malloc(size); > > > > > > > alloc 65k for a command line? wtf is this ? > > c'mon zmike, I know you can do better than this :) > > i did that and it's a temporary buffer and it's not that crazy. i was > debugging > some stuff and found an efreet string handling error and while debugging > found > the code using E_BINDIR in e_exec.c which i fixed and i upped the default > buffer to 64k. ... because i was already testing a use case that had a > buffer > of 8k for the commandline. this was not totally crazy (i went "*.mp3" > <enter> > in efm in a music dir of mine). 64k seems likely more appropriate > especially as > its on the heap, temporary and freed when done. chances of neeidng to > expand > that buffer are very slim then thus being more efficient. > Well, I would have use an eina_strbuf, or something similar, but if you say it's more efficient... I trust you :) > > > > + snprintf(sb, size, "%s/enlightenment_open ", e_prefix_bin_get()); > > > + len = strlen(sb); > > > + sb = e_util_string_append_quoted(sb, &size, &len, exe); > > > + ret = ecore_exe_run(sb, data); > > > + free(sb); > > > + return ret; > > > +} > > > diff --git a/src/bin/e_utils.h b/src/bin/e_utils.h > > > index 574894c..44dcd6e 100644 > > > --- a/src/bin/e_utils.h > > > +++ b/src/bin/e_utils.h > > > @@ -65,6 +65,8 @@ E_API void e_util_string_list_free(Eina_List *l); > > > > > > E_API void e_util_memclear(void *s, size_t n); > > > > > > +E_API Ecore_Exe *e_util_open(const char *exe, void *data); > > > + > > > static inline void > > > e_util_pointer_center(const E_Client *ec) > > > { > > > diff --git a/src/modules/teamwork/e_mod_tw.c > b/src/modules/teamwork/e_mod_ > > > tw.c > > > index c478844..dae03d5 100644 > > > --- a/src/modules/teamwork/e_mod_tw.c > > > +++ b/src/modules/teamwork/e_mod_tw.c > > > @@ -519,15 +519,8 @@ tw_link_hide(E_Client *ec, const char *uri) > > > EINTERN void > > > tw_link_open(E_Client *ec, const char *uri) > > > { > > > - char *sb; > > > - size_t size = 4096, len = sizeof(E_BINDIR "/enlightenment_open ") > - 1; > > > - > > > - if (!ec->focused) return; > > > - sb = malloc(size); > > > - memcpy(sb, E_BINDIR "/enlightenment_open ", len); > > > - sb = e_util_string_append_quoted(sb, &size, &len, uri); > > > - ecore_exe_run(sb, NULL); > > > - free(sb); > > > + if (ec->focused) > > > + e_util_open(uri, NULL); > > > } > > > > > > static Eet_Data_Descriptor * > > > diff --git a/src/modules/tiling/e_mod_config.c > b/src/modules/tiling/e_mod_ > > > config.c > > > index 6f5ef43..e3ae764 100644 > > > --- a/src/modules/tiling/e_mod_config.c > > > +++ b/src/modules/tiling/e_mod_config.c > > > @@ -14,15 +14,7 @@ struct _E_Widget_Smart_Data > > > static void > > > _open_browser_help_cb(void *data EINA_UNUSED, void *obj EINA_UNUSED) > > > { > > > - const char *url = "https://phab.enlightenment. > org/w/emodules/tiling2/ > > > "; > > > - char *sb; > > > - size_t size = 4096, len = sizeof(E_BINDIR "/enlightenment_open ") > - 1; > > > - > > > - sb = malloc(size); > > > - memcpy(sb, E_BINDIR "/enlightenment_open ", len); > > > - sb = e_util_string_append_quoted(sb, &size, &len, url); > > > - ecore_exe_run(sb, NULL); > > > - free(sb); > > > + e_util_open("https://phab.enlightenment.org/w/emodules/tiling2/", > > > NULL); > > > } > > > > > > /* Some defines to make coding with the e_widget_* easier for > > > configuration > > > diff --git a/src/modules/wireless/wireless.c b/src/modules/wireless/ > > > wireless.c > > > index 31911ba..ffb99a4 100644 > > > --- a/src/modules/wireless/wireless.c > > > +++ b/src/modules/wireless/wireless.c > > > @@ -1442,18 +1442,10 @@ _wireless_auth_external_deny(void *data, > > > Evas_Object *obj EINA_UNUSED, void *eve > > > static void > > > _wireless_auth_external_allow(void *data, Evas_Object *obj > EINA_UNUSED, > > > void *event_info EINA_UNUSED) > > > { > > > - char *sb, *uri = data; > > > - const char *bindir; > > > - size_t size = PATH_MAX, len; > > > - > > > - bindir = e_prefix_bin_get(); > > > - len = strlen(bindir); > > > - sb = malloc(size); > > > - snprintf(sb, size, "%s/enlightenment_open", bindir); > > > - sb = e_util_string_append_quoted(sb, &size, &len, uri); > > > - DBG("launched command: %s", sb); > > > - ecore_exe_run(sb, NULL); > > > - free(sb); > > > + char *uri = data; > > > + > > > + e_util_open(uri, NULL); > > > + DBG("launched uri: %s", uri); > > > free(uri); > > > auth_popup = 0; > > > } > > > > > > -- > > > > > > > > > > > ------------------------------------------------------------ > ------------------ > > _______________________________________________ > > enlightenment-devel mailing list > > enl...@li... > > https://lists.sourceforge.net/lists/listinfo/enlightenment-devel > > > > > -- > ------------- Codito, ergo sum - "I code, therefore I am" -------------- > The Rasterman (Carsten Haitzler) ra...@ra... > > |