ryuan pushed a commit to branch master.
commit 771d8474cd0795dbde90ce3e4d22b0d54bbbca1b
Author: Ryuan Choi <[email protected]>
Date: Thu Jul 18 02:48:07 2013 +0900
Cleanup _on_item_selected
Just return for the exception and avoid unnecessary allocation.
---
src/lib/elc_fileselector.c | 25 +++++++++++--------------
1 file changed, 11 insertions(+), 14 deletions(-)
diff --git a/src/lib/elc_fileselector.c b/src/lib/elc_fileselector.c
index 68b6df1..720df02 100644
--- a/src/lib/elc_fileselector.c
+++ b/src/lib/elc_fileselector.c
@@ -662,32 +662,29 @@ _on_item_selected(void *data,
struct sel_data *sdata;
void *old_sd;
char *dir;
+ const char *path;
ELM_FILESELECTOR_DATA_GET(data, sd);
+ path = elm_object_item_data_get(it);
+ if (!path)
+ return;
+
sdata = malloc(sizeof(*sdata));
sdata->fs = data;
- sdata->path = elm_object_item_data_get(it);
+ sdata->path = path;
- if (!sdata->path)
+ if (sd->only_folder)
+ eina_stringshare_replace(&sd->path, path);
+ else
{
- eina_stringshare_replace(&sd->path, "");
- goto end;
- }
+ dir = ecore_file_dir_get(sdata->path);
+ if (!dir) return;
- dir = sd->only_folder ? strdup(sdata->path) :
- ecore_file_dir_get(sdata->path);
- if (dir)
- {
eina_stringshare_replace(&sd->path, dir);
free(dir);
}
- else
- {
- eina_stringshare_replace(&sd->path, "");
- }
-end:
if (sd->sel_idler)
{
old_sd = ecore_idler_del(sd->sel_idler);
--
------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk