diff --git a/src/bin/e_apps.c b/src/bin/e_apps.c index d2c38bc5e..ec589bbc8 100644 --- a/src/bin/e_apps.c +++ b/src/bin/e_apps.c @@ -115,7 +115,7 @@ static Evas_List *_e_apps_start_pending = NULL; EAPI int e_app_init(void) { - char *home; + const char *home; char buf[PATH_MAX]; home = e_user_homedir_get(); @@ -123,7 +123,6 @@ e_app_init(void) _e_apps_path_trash = evas_stringshare_add(buf); snprintf(buf, sizeof(buf), "%s/.e/e/applications/all", home); _e_apps_path_all = evas_stringshare_add(buf); - free(home); _e_apps_repositories = evas_list_append(_e_apps_repositories, evas_stringshare_add(buf)); _e_apps_exit_handler = ecore_event_handler_add(ECORE_EXE_EVENT_DEL, _e_apps_cb_exit, NULL); _e_apps_border_add_handler = ecore_event_handler_add(E_EVENT_BORDER_ADD, _e_app_cb_event_border_add, NULL); diff --git a/src/bin/e_config.c b/src/bin/e_config.c index 75c2ccbdb..a7d654174 100644 --- a/src/bin/e_config.c +++ b/src/bin/e_config.c @@ -51,13 +51,12 @@ e_config_init(void) { Eet_File *ef; char buf[4096]; - char *homedir; + const char *homedir; homedir = e_user_homedir_get(); snprintf(buf, sizeof(buf), "%s/.e/e/config/profile.cfg", homedir); ef = eet_open(buf, EET_FILE_MODE_READ); - E_FREE(homedir); if (ef) { char *data; @@ -1465,7 +1464,7 @@ e_config_profile_list(void) { Ecore_List *files; char buf[4096]; - char *homedir; + const char *homedir; Evas_List *flist = NULL; homedir = e_user_homedir_get(); @@ -1485,7 +1484,6 @@ e_config_profile_list(void) } ecore_list_destroy(files); } - E_FREE(homedir); return flist; } @@ -1493,13 +1491,12 @@ EAPI void e_config_profile_add(char *prof) { char buf[4096]; - char *homedir; + const char *homedir; homedir = e_user_homedir_get(); snprintf(buf, sizeof(buf), "%s/.e/e/config/%s", homedir, prof); ecore_file_mkpath(buf); - E_FREE(homedir); } EAPI void @@ -1507,7 +1504,7 @@ e_config_profile_del(char *prof) { Ecore_List *files; char buf[4096]; - char *homedir; + const char *homedir; homedir = e_user_homedir_get(); snprintf(buf, sizeof(buf), "%s/.e/e/config/%s", homedir, prof); @@ -1528,7 +1525,6 @@ e_config_profile_del(char *prof) } snprintf(buf, sizeof(buf), "%s/.e/e/config/%s", homedir, prof); ecore_file_rmdir(buf); - E_FREE(homedir); } EAPI Evas_List * @@ -1562,7 +1558,7 @@ e_config_domain_load(char *domain, E_Config_DD *edd) { Eet_File *ef; char buf[4096]; - char *homedir; + const char *homedir; void *data = NULL; homedir = e_user_homedir_get(); @@ -1575,7 +1571,6 @@ e_config_domain_load(char *domain, E_Config_DD *edd) homedir, "default", domain); ef = eet_open(buf, EET_FILE_MODE_READ); } - E_FREE(homedir); if (ef) { data = eet_data_read(ef, edd, "config"); @@ -1589,7 +1584,7 @@ e_config_profile_save(void) { Eet_File *ef; char buf[4096], buf2[4096]; - char *homedir; + const char *homedir; int ok = 0; /* FIXME: check for other sessions fo E running */ @@ -1597,7 +1592,6 @@ e_config_profile_save(void) snprintf(buf, sizeof(buf), "%s/.e/e/config/profile.cfg", homedir); snprintf(buf2, sizeof(buf2), "%s.tmp", buf); - free(homedir); ef = eet_open(buf2, EET_FILE_MODE_WRITE); if (ef) @@ -1619,7 +1613,7 @@ e_config_domain_save(char *domain, E_Config_DD *edd, void *data) { Eet_File *ef; char buf[4096], buf2[4096]; - char *homedir; + const char *homedir; int ok = 0; if (_e_config_save_block) return 0; @@ -1631,7 +1625,6 @@ e_config_domain_save(char *domain, E_Config_DD *edd, void *data) snprintf(buf, sizeof(buf), "%s/.e/e/config/%s/%s.cfg", homedir, _e_config_profile, domain); snprintf(buf2, sizeof(buf2), "%s.tmp", buf); - E_FREE(homedir); ef = eet_open(buf2, EET_FILE_MODE_WRITE); if (ef) { diff --git a/src/bin/e_fm.c b/src/bin/e_fm.c index 8a7ef4c76..4a6f54bd1 100644 --- a/src/bin/e_fm.c +++ b/src/bin/e_fm.c @@ -223,19 +223,13 @@ static Evas_Smart *_e_fm2_smart = NULL; EAPI int e_fm2_init(void) { - char *homedir; + const char *homedir; char path[PATH_MAX]; homedir = e_user_homedir_get(); - if (homedir) - { - snprintf(path, sizeof(path), "%s/.e/e/fileman/metadata", homedir); - ecore_file_mkpath(path); - _meta_path = strdup(path); - free(homedir); - } - else return 0; - + snprintf(path, sizeof(path), "%s/.e/e/fileman/metadata", homedir); + ecore_file_mkpath(path); + _meta_path = strdup(path); _e_fm2_smart = evas_smart_new("e_fm", _e_fm2_smart_add, /* add */ @@ -665,7 +659,6 @@ _e_fm2_dev_path_map(const char *dev, const char *path) else if (CMP("~/")) { s = e_user_homedir_get(); PRT("%s%s", s, path); - free(s); } else if (dev[0] == '/') { /* dev is a full path - consider it a mountpoint device on its own */ @@ -679,7 +672,6 @@ _e_fm2_dev_path_map(const char *dev, const char *path) */ s = e_user_homedir_get(); PRT("%s/.e/e/fileman/favorites", s); - free(s); } else if (CMP("dvd") || CMP("dvd-*")) { /* FIXME: find dvd mountpoint optionally for dvd no. X */ diff --git a/src/bin/e_fm_mime.c b/src/bin/e_fm_mime.c index 071f1fcf0..ab55d55eb 100644 --- a/src/bin/e_fm_mime.c +++ b/src/bin/e_fm_mime.c @@ -65,7 +65,8 @@ e_fm_mime_filename_get(const char *fname) EAPI const char * e_fm_mime_icon_get(const char *mime) { - char buf[4096], buf2[4096], *homedir = NULL, *val; + char buf[4096], buf2[4096], *val; + const char *homedir = NULL; Evas_List *l; E_Config_Mime_Icon *mi; Evas_List *freelist = NULL; @@ -105,8 +106,7 @@ e_fm_mime_icon_get(const char *mime) /* 2. look up in ~/.e/e/icons */ homedir = e_user_homedir_get(); - if (!homedir) return NULL; - + snprintf(buf, sizeof(buf), "%s/.e/e/icons/%s.edj", homedir, mime); if (ecore_file_exists(buf)) goto ok; snprintf(buf, sizeof(buf), "%s/.e/e/icons/%s.svg", homedir, mime); @@ -142,13 +142,11 @@ e_fm_mime_icon_get(const char *mime) snprintf(buf, sizeof(buf), "%s/data/icons/%s.png", e_prefix_data_get(), buf2); if (ecore_file_exists(buf)) goto ok; - if (homedir) free(homedir); return NULL; ok: val = (char *)evas_stringshare_add(buf); icon_map = evas_hash_add(icon_map, mime, val); - if (homedir) free(homedir); return val; } @@ -184,7 +182,7 @@ _e_fm_mime_update(void) { static double last_t = 0.0, t; char buf[4096]; - char *homedir; + const char *homedir; int reload = 0; /* load /etc/mime.types @@ -197,8 +195,7 @@ _e_fm_mime_update(void) if ((t - last_t) < 1.0) return; homedir = e_user_homedir_get(); - if (!homedir) return; - + { static time_t last_changed = 0; time_t ch; @@ -280,7 +277,6 @@ _e_fm_mime_update(void) _e_fm_mime_shared_mimeinfo_globs_load(buf); } } - free(homedir); } static int diff --git a/src/bin/e_int_border_menu.c b/src/bin/e_int_border_menu.c index 13f54fea4..ee797f82e 100644 --- a/src/bin/e_int_border_menu.c +++ b/src/bin/e_int_border_menu.c @@ -559,15 +559,11 @@ _e_border_menu_cb_icon_edit(void *data, E_Menu *m, E_Menu_Item *mi) { if (bname) { - char *homedir; + const char *homedir; homedir = e_user_homedir_get(); - if (homedir) - { - snprintf(path, sizeof(path), "%s/.e/e/applications/all/%s.desktop", homedir, bname); - free(homedir); - a = e_app_empty_new(path); - } + snprintf(path, sizeof(path), "%s/.e/e/applications/all/%s.desktop", homedir, bname); + a = e_app_empty_new(path); } else a = e_app_empty_new(NULL); diff --git a/src/bin/e_int_config_apps.c b/src/bin/e_int_config_apps.c index 7efb6247b..3133ca3ad 100644 --- a/src/bin/e_int_config_apps.c +++ b/src/bin/e_int_config_apps.c @@ -96,9 +96,9 @@ e_int_config_apps(E_Container *con) static void _fill_data(E_Config_Dialog_Data *cfdata) { - cfdata->homedir = e_user_homedir_get(); + cfdata->homedir = strdup(e_user_homedir_get()); if (!cfdata->homedir) return; - + snprintf(cfdata->path_everything, sizeof(cfdata->path_everything), "%s/.e/e/applications/all", cfdata->homedir); snprintf(cfdata->path, sizeof(cfdata->path), "%s/.e/e/applications", cfdata->homedir); snprintf(cfdata->path_all, sizeof(cfdata->path_all), "%s/.e/e/applications/menu/all", cfdata->homedir); diff --git a/src/bin/e_int_config_desklock.c b/src/bin/e_int_config_desklock.c index c71116d65..81c506073 100644 --- a/src/bin/e_int_config_desklock.c +++ b/src/bin/e_int_config_desklock.c @@ -194,8 +194,8 @@ static void _cb_files_files_changed(void *data, Evas_Object *obj, void *event_info) { E_Config_Dialog_Data *cfdata; - const char *p; - char *homedir, buf[4096]; + const char *p, *homedir; + char buf[4096]; cfdata = data; if (!cfdata->bg) return; @@ -206,9 +206,7 @@ _cb_files_files_changed(void *data, Evas_Object *obj, void *event_info) if (strncmp(p, cfdata->bg, strlen(p))) return; } homedir = e_user_homedir_get(); - if (!homedir) return; snprintf(buf, sizeof(buf), "%s/.e/e/backgrounds", homedir); - free(homedir); if (!p) return; if (!strncmp(cfdata->bg, buf, strlen(buf))) p = cfdata->bg + strlen(buf) + 1; @@ -228,7 +226,8 @@ static void _cb_dir(void *data, Evas_Object *obj, void *event_info) { E_Config_Dialog_Data *cfdata; - char path[4096], *homedir; + char path[4096]; + const char *homedir; cfdata = data; if (cfdata->fmdir == 1) @@ -239,7 +238,6 @@ _cb_dir(void *data, Evas_Object *obj, void *event_info) { homedir = e_user_homedir_get(); snprintf(path, sizeof(path), "%s/.e/e/backgrounds", homedir); - free(homedir); } e_fm2_path_set(cfdata->o_fm, path, "/"); } @@ -281,7 +279,8 @@ _bg_mode(void *data, Evas_Object *obj, void *event_info) static void _fill_data(E_Config_Dialog_Data *cfdata) { - char path[4096], *homedir; + char path[4096]; + const char *homedir; // we have to read it from e_config->... if (e_config->desklock_personal_passwd) @@ -348,7 +347,6 @@ _fill_data(E_Config_Dialog_Data *cfdata) cfdata->bg = strdup(path); } } - free(homedir); } #ifdef HAVE_PAM @@ -534,7 +532,8 @@ _advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data { Evas_Object *ob, *oc; Evas_Object *o, *ot, *of, *il, *ol; - char path[4096], *homedir; + char path[4096]; + const char *homedir; const char *f; E_Fm2_Config fmc; E_Zone *z; @@ -544,8 +543,7 @@ _advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data #endif homedir = e_user_homedir_get(); - if (!homedir) return NULL; - + z = e_zone_current_get(cfd->con); cfdata->evas = evas; @@ -786,7 +784,6 @@ _advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data e_widget_table_object_append(ot, of, 1, 2, 1, 1 ,1 ,1 ,1 ,1); #endif - free(homedir); e_dialog_resizable_set(cfd->dia, 0); return ot; } diff --git a/src/bin/e_int_config_startup.c b/src/bin/e_int_config_startup.c index b3418e79c..b1f30d4c7 100644 --- a/src/bin/e_int_config_startup.c +++ b/src/bin/e_int_config_startup.c @@ -116,8 +116,8 @@ static void _cb_files_files_changed(void *data, Evas_Object *obj, void *event_info) { E_Config_Dialog_Data *cfdata; - const char *p; - char *homedir, buf[4096]; + const char *p, *homedir; + char buf[4096]; cfdata = data; if (!cfdata->splash) return; @@ -128,9 +128,7 @@ _cb_files_files_changed(void *data, Evas_Object *obj, void *event_info) if (strncmp(p, cfdata->splash, strlen(p))) return; } homedir = e_user_homedir_get(); - if (!homedir) return; snprintf(buf, sizeof(buf), "%s/.e/e/init", homedir); - free(homedir); if (!p) return; if (!strncmp(cfdata->splash, buf, strlen(buf))) p = cfdata->splash + strlen(buf) + 1; @@ -150,7 +148,8 @@ static void _cb_dir(void *data, Evas_Object *obj, void *event_info) { E_Config_Dialog_Data *cfdata; - char path[4096], *homedir; + char path[4096]; + const char *homedir; cfdata = data; if (cfdata->fmdir == 1) @@ -161,7 +160,6 @@ _cb_dir(void *data, Evas_Object *obj, void *event_info) { homedir = e_user_homedir_get(); snprintf(path, sizeof(path), "%s/.e/e/init", homedir); - free(homedir); } e_fm2_path_set(cfdata->o_fm, path, "/"); } @@ -169,8 +167,9 @@ _cb_dir(void *data, Evas_Object *obj, void *event_info) static void _fill_data(E_Config_Dialog_Data *cfdata) { - char path[4096], *homedir; - + char path[4096]; + const char *homedir; + cfdata->show_splash = e_config->show_splash; cfdata->splash = NULL; if (e_config->init_default_theme) @@ -198,7 +197,6 @@ _fill_data(E_Config_Dialog_Data *cfdata) cfdata->splash = strdup(path); } } - free(homedir); } snprintf(path, sizeof(path), "%s/data/init", e_prefix_data_get()); @@ -252,14 +250,13 @@ static Evas_Object * _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata) { Evas_Object *o, *ot, *of, *il, *ol; - char path[4096], *homedir; - const char *f; + char path[4096]; + const char *f, *homedir; E_Fm2_Config fmc; E_Zone *z; E_Radio_Group *rg; homedir = e_user_homedir_get(); - if (!homedir) return NULL; z = e_zone_current_get(cfd->con); @@ -347,6 +344,5 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf &(cfdata->show_splash)); e_widget_table_object_append(ot, o, 1, 3, 1, 1, 1, 0, 0, 0); - free(homedir); return ot; } diff --git a/src/bin/e_int_config_theme.c b/src/bin/e_int_config_theme.c index 9ad06aba8..ae3596dc1 100644 --- a/src/bin/e_int_config_theme.c +++ b/src/bin/e_int_config_theme.c @@ -60,17 +60,16 @@ EAPI void e_int_config_theme_update(E_Config_Dialog *dia, char *file) { E_Config_Dialog_Data *cfdata; - char *homedir, path[4096]; + const char *homedir; + char path[4096]; cfdata = dia->cfdata; homedir = e_user_homedir_get(); - if (!homedir) return; cfdata->fmdir = 1; e_widget_radio_toggle_set(cfdata->o_personal, 1); snprintf(path, sizeof(path), "%s/.e/e/themes", homedir); - E_FREE(homedir); E_FREE(cfdata->theme); cfdata->theme = strdup(file); @@ -176,7 +175,8 @@ _cb_files_files_changed(void *data, Evas_Object *obj, void *event_info) { E_Config_Dialog_Data *cfdata; const char *p; - char *homedir, buf[4096]; + const char *homedir; + char buf[4096]; cfdata = data; if (!cfdata->theme) return; @@ -187,9 +187,7 @@ _cb_files_files_changed(void *data, Evas_Object *obj, void *event_info) if (strncmp(p, cfdata->theme, strlen(p))) return; } homedir = e_user_homedir_get(); - if (!homedir) return; snprintf(buf, sizeof(buf), "%s/.e/e/themes", homedir); - free(homedir); if (!p) return; if (!strncmp(cfdata->theme, buf, strlen(buf))) p = cfdata->theme + strlen(buf) + 1; @@ -209,8 +207,9 @@ static void _cb_dir(void *data, Evas_Object *obj, void *event_info) { E_Config_Dialog_Data *cfdata; - char path[4096], *homedir; - + char path[4096]; + const char *homedir; + cfdata = data; if (cfdata->fmdir == 1) { @@ -220,7 +219,6 @@ _cb_dir(void *data, Evas_Object *obj, void *event_info) { homedir = e_user_homedir_get(); snprintf(path, sizeof(path), "%s/.e/e/themes", homedir); - free(homedir); } e_fm2_path_set(cfdata->o_fm, path, "/"); } @@ -278,7 +276,8 @@ static void _fill_data(E_Config_Dialog_Data *cfdata) { E_Config_Theme * c; - char path[4096], *homedir; + char path[4096]; + const char *homedir; c = e_theme_config_get("theme"); if (c) @@ -306,7 +305,6 @@ _fill_data(E_Config_Dialog_Data *cfdata) cfdata->theme = strdup(path); } } - free(homedir); } snprintf(path, sizeof(path), "%s/data/themes", e_prefix_data_get()); @@ -340,14 +338,13 @@ static Evas_Object * _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata) { Evas_Object *o, *ot, *of, *il, *ol; - char path[4096], *homedir; - const char *f; + char path[4096]; + const char *f, *homedir; E_Fm2_Config fmc; E_Zone *z; E_Radio_Group *rg; homedir = e_user_homedir_get(); - if (!homedir) return NULL; z = e_zone_current_get(cfd->con); @@ -440,7 +437,6 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf e_widget_table_object_append(ot, of, 1, 0, 1, 1, 1, 1, 1, 1); - free(homedir); e_dialog_resizable_set(cfd->dia, 1); return ot; } diff --git a/src/bin/e_int_config_theme_import.c b/src/bin/e_int_config_theme_import.c index 29c1c96a3..33de20918 100644 --- a/src/bin/e_int_config_theme_import.c +++ b/src/bin/e_int_config_theme_import.c @@ -238,7 +238,7 @@ _theme_import_cb_ok(void *data, void *data2) E_Win *win; const char *path; const char *file; - char *homedir; + const char *homedir; char buf[4096]; win = data; @@ -246,8 +246,7 @@ _theme_import_cb_ok(void *data, void *data2) if (!import) return; homedir = e_user_homedir_get(); - if (!homedir) return; - + path = e_widget_fsel_selection_path_get(import->fsel_obj); E_FREE(import->cfdata->file); if (path) @@ -257,7 +256,6 @@ _theme_import_cb_ok(void *data, void *data2) { file = ecore_file_get_file(import->cfdata->file); snprintf(buf, sizeof(buf), "%s/.e/e/themes/%s", homedir, file); - E_FREE(homedir); if (!ecore_file_strip_ext(file)) return; @@ -284,9 +282,7 @@ _theme_import_cb_ok(void *data, void *data2) e_int_config_theme_update(import->parent, buf); } } - else - E_FREE(homedir); - + e_int_config_theme_del(import->win); } diff --git a/src/bin/e_int_config_wallpaper.c b/src/bin/e_int_config_wallpaper.c index b6e811ed2..6947a58ee 100644 --- a/src/bin/e_int_config_wallpaper.c +++ b/src/bin/e_int_config_wallpaper.c @@ -59,15 +59,14 @@ EAPI void e_int_config_wallpaper_update(E_Config_Dialog *dia, char *file) { E_Config_Dialog_Data *cfdata; - char path[4096], *homedir; + char path[4096]; + const char *homedir; cfdata = dia->cfdata; homedir = e_user_homedir_get(); - if (!homedir) return; cfdata->fmdir = 1; e_widget_radio_toggle_set(cfdata->o_personal, 1); snprintf(path, sizeof(path), "%s/.e/e/backgrounds", homedir); - E_FREE(homedir); E_FREE(cfdata->bg); cfdata->bg = strdup(file); cfdata->use_theme_bg = 0; @@ -180,8 +179,8 @@ static void _cb_files_files_changed(void *data, Evas_Object *obj, void *event_info) { E_Config_Dialog_Data *cfdata; - const char *p; - char *homedir, buf[4096]; + const char *p, *homedir; + char buf[4096]; cfdata = data; if (!cfdata->bg) return; @@ -192,9 +191,7 @@ _cb_files_files_changed(void *data, Evas_Object *obj, void *event_info) if (strncmp(p, cfdata->bg, strlen(p))) return; } homedir = e_user_homedir_get(); - if (!homedir) return; snprintf(buf, sizeof(buf), "%s/.e/e/backgrounds", homedir); - free(homedir); if (!p) return; if (!strncmp(cfdata->bg, buf, strlen(buf))) p = cfdata->bg + strlen(buf) + 1; @@ -275,7 +272,8 @@ static void _cb_dir(void *data, Evas_Object *obj, void *event_info) { E_Config_Dialog_Data *cfdata; - char path[4096], *homedir; + char path[4096]; + const char *homedir; cfdata = data; if (cfdata->fmdir == 1) @@ -286,7 +284,6 @@ _cb_dir(void *data, Evas_Object *obj, void *event_info) { homedir = e_user_homedir_get(); snprintf(path, sizeof(path), "%s/.e/e/backgrounds", homedir); - free(homedir); } e_fm2_path_set(cfdata->o_fm, path, "/"); } @@ -392,14 +389,13 @@ static Evas_Object * _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata) { Evas_Object *o, *ot, *of, *il, *ol; - char path[4096], *homedir; - const char *f; + char path[4096]; + const char *f, *homedir; E_Fm2_Config fmc; E_Zone *z; E_Radio_Group *rg; homedir = e_user_homedir_get(); - if (!homedir) return NULL; z = e_zone_current_get(cfd->con); @@ -505,7 +501,6 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf e_widget_table_object_append(ot, of, 1, 0, 1, 1, 1, 1, 1, 1); - free(homedir); e_dialog_resizable_set(cfd->dia, 1); return ot; } @@ -537,14 +532,13 @@ static Evas_Object * _advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata) { Evas_Object *o, *ot, *of, *il, *ol; - char path[4096], *homedir; - const char *f; + char path[4096]; + const char *f, *homedir; E_Fm2_Config fmc; E_Zone *z; E_Radio_Group *rg; homedir = e_user_homedir_get(); - if (!homedir) return NULL; z = e_zone_current_get(cfd->con); @@ -663,7 +657,6 @@ _advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data e_widget_table_object_append(ot, of, 1, 0, 1, 1, 1, 1, 1, 1); - free(homedir); e_dialog_resizable_set(cfd->dia, 1); return ot; } diff --git a/src/bin/e_int_config_wallpaper_gradient.c b/src/bin/e_int_config_wallpaper_gradient.c index 808684c1f..99cf6610e 100644 --- a/src/bin/e_int_config_wallpaper_gradient.c +++ b/src/bin/e_int_config_wallpaper_gradient.c @@ -241,21 +241,17 @@ _import_edj_gen(Import *import) Evas *evas; int fd, num = 1; const char *file; + const char *homedir; char buf[4096], cmd[4096], tmpn[4096]; - char *homedir, *fstrip; + char *fstrip; FILE *f; evas = e_win_evas_get(import->dia->win); file = import->cfdata->name; homedir = e_user_homedir_get(); - if (!homedir) return; fstrip = ecore_file_strip_ext(file); - if (!fstrip) - { - free(homedir); - return; - } + if (!fstrip) return; snprintf(buf, sizeof(buf), "%s/.e/e/backgrounds/%s.edj", homedir, fstrip); while (ecore_file_exists(buf)) { @@ -263,7 +259,6 @@ _import_edj_gen(Import *import) num++; } free(fstrip); - free(homedir); strcpy(tmpn, "/tmp/e_bgdlg_new.edc-tmp-XXXXXX"); fd = mkstemp(tmpn); if (fd < 0) diff --git a/src/bin/e_int_config_wallpaper_import.c b/src/bin/e_int_config_wallpaper_import.c index 8d874ef71..f6f2f9e2d 100644 --- a/src/bin/e_int_config_wallpaper_import.c +++ b/src/bin/e_int_config_wallpaper_import.c @@ -292,22 +292,17 @@ _import_edj_gen(Import *import) Evas_Object *img; int fd, num = 1; int w = 0, h = 0; - const char *file; + const char *file, *homedir; char buf[4096], cmd[4096], tmpn[4096], ipart[4096], enc[128]; - char *imgdir = NULL, *homedir, *fstrip; + char *imgdir = NULL, *fstrip; int cr = 255, cg = 255, cb = 255, ca = 255; FILE *f; evas = e_win_evas_get(import->win); file = ecore_file_get_file(import->cfdata->file); homedir = e_user_homedir_get(); - if (!homedir) return; fstrip = ecore_file_strip_ext(file); - if (!fstrip) - { - free(homedir); - return; - } + if (!fstrip) return; snprintf(buf, sizeof(buf), "%s/.e/e/backgrounds/%s.edj", homedir, fstrip); while (ecore_file_exists(buf)) { @@ -315,7 +310,6 @@ _import_edj_gen(Import *import) num++; } free(fstrip); - free(homedir); strcpy(tmpn, "/tmp/e_bgdlg_new.edc-tmp-XXXXXX"); fd = mkstemp(tmpn); if (fd < 0) @@ -503,7 +497,8 @@ _import_cb_ok(void *data, void *data2) E_Win *win; const char *path; const char *file; - char buf[4096], *homedir; + const char *homedir; + char buf[4096]; int is_bg, is_theme; win = data; @@ -520,11 +515,9 @@ _import_cb_ok(void *data, void *data2) else { homedir = e_user_homedir_get(); - if (!homedir) return; snprintf(buf, sizeof(buf), "%s/.e/e/backgrounds/%s", homedir, file); - E_FREE(homedir); - + is_bg = edje_file_group_exists(import->cfdata->file, "e/desktop/background"); is_theme = diff --git a/src/bin/e_int_menus.c b/src/bin/e_int_menus.c index fac99fc83..599d2283a 100644 --- a/src/bin/e_int_menus.c +++ b/src/bin/e_int_menus.c @@ -183,17 +183,12 @@ e_int_menus_favorite_apps_new(void) { E_Menu *m; char buf[4096]; - char *homedir; + const char *homedir; homedir = e_user_homedir_get(); - if (homedir) - { - snprintf(buf, sizeof(buf), "%s/.e/e/applications/menu/favorite", homedir); - m = e_int_menus_apps_new(buf); - free(homedir); - return m; - } - return NULL; + snprintf(buf, sizeof(buf), "%s/.e/e/applications/menu/favorite", homedir); + m = e_int_menus_apps_new(buf); + return m; } EAPI E_Menu * @@ -201,17 +196,12 @@ e_int_menus_all_apps_new(void) { E_Menu *m; char buf[4096]; - char *homedir; + const char *homedir; homedir = e_user_homedir_get(); - if (homedir) - { - snprintf(buf, sizeof(buf), "%s/.e/e/applications/menu/all", homedir); - m = e_int_menus_apps_new(buf); - free(homedir); - return m; - } - return NULL; + snprintf(buf, sizeof(buf), "%s/.e/e/applications/menu/all", homedir); + m = e_int_menus_apps_new(buf); + return m; } EAPI E_Menu * diff --git a/src/bin/e_main.c b/src/bin/e_main.c index c5c1fb75c..a8a76c153 100644 --- a/src/bin/e_main.c +++ b/src/bin/e_main.c @@ -267,16 +267,12 @@ main(int argc, char **argv) /* fixes for FOOLS that keep cp'ing default.edj into ~/.e/e/themes */ { - char *homedir; + const char *homedir; homedir = e_user_homedir_get(); - if (homedir) - { - snprintf(buf, sizeof(buf), "%s/.e/e/themes/default.edj", homedir); - if (ecore_file_exists(buf)) - ecore_file_unlink(buf); - free(homedir); - } + snprintf(buf, sizeof(buf), "%s/.e/e/themes/default.edj", homedir); + if (ecore_file_exists(buf)) + ecore_file_unlink(buf); } @@ -828,7 +824,7 @@ _e_main_x_shutdown(void) static int _e_main_dirs_init(void) { - char *homedir; + const char *homedir; char buf[PATH_MAX]; const char *dirs[] = { @@ -857,7 +853,6 @@ _e_main_dirs_init(void) int i; homedir = e_user_homedir_get(); - if (!homedir) return 0; for (i = 0; i < (int)(sizeof(dirs) / sizeof(char *)); i++) { snprintf(buf, sizeof(buf), dirs[i], homedir); @@ -866,7 +861,6 @@ _e_main_dirs_init(void) e_error_message_show("Error creating directory:\n" "%s", buf); - free(homedir); return 0; } } @@ -911,7 +905,6 @@ _e_main_dirs_init(void) homedir); system(buf); } - free(homedir); return 1; } diff --git a/src/bin/e_path.c b/src/bin/e_path.c index 67de09d52..d953f256f 100644 --- a/src/bin/e_path.c +++ b/src/bin/e_path.c @@ -28,23 +28,17 @@ e_path_default_path_append(E_Path *ep, const char *path) { E_Path_Dir *epd; char *new_path; - char *home_dir; + const char *home_dir; int len1, len2; home_dir = e_user_homedir_get(); - if (!home_dir) return; len1 = strlen(home_dir); len2 = strlen(path); new_path = malloc(len1 + len2 + 1); - if (!new_path) - { - free(home_dir); - return; - } + if (!new_path) return; epd = malloc(sizeof(E_Path_Dir)); if (!epd) { - free(home_dir); free(new_path); return; } @@ -53,7 +47,6 @@ e_path_default_path_append(E_Path *ep, const char *path) strcat(new_path, path + 1); epd->dir = evas_stringshare_add(new_path); free(new_path); - free(home_dir); ep->default_dir_list = evas_list_append(ep->default_dir_list, epd); } else @@ -89,23 +82,17 @@ e_path_user_path_append(E_Path *ep, const char *path) { E_Path_Dir *epd; char *new_path; - char *home_dir; + const char *home_dir; int len1, len2; home_dir = e_user_homedir_get(); - if (!home_dir) return; len1 = strlen(home_dir); len2 = strlen(path); new_path = malloc(len1 + len2 + 1); - if (!new_path) - { - free(home_dir); - return; - } + if (!new_path) return; epd = malloc(sizeof(E_Path_Dir)); if (!epd) { - free(home_dir); free(new_path); return; } @@ -114,7 +101,6 @@ e_path_user_path_append(E_Path *ep, const char *path) strcat(new_path, path + 1); epd->dir = evas_stringshare_add(new_path); free(new_path); - free(home_dir); *(ep->user_dir_list) = evas_list_append(*(ep->user_dir_list), epd); } else @@ -139,23 +125,17 @@ e_path_user_path_prepend(E_Path *ep, const char *path) { E_Path_Dir *epd; char *new_path; - char *home_dir; + const char *home_dir; int len1, len2; home_dir = e_user_homedir_get(); - if (!home_dir) return; len1 = strlen(home_dir); len2 = strlen(path); new_path = malloc(len1 + len2 + 1); - if (!new_path) - { - free(home_dir); - return; - } + if (!new_path) return; epd = malloc(sizeof(E_Path_Dir)); if (!epd) { - free(home_dir); free(new_path); return; } @@ -164,7 +144,6 @@ e_path_user_path_prepend(E_Path *ep, const char *path) strcat(new_path, path + 1); epd->dir = evas_stringshare_add(new_path); free(new_path); - free(home_dir); *(ep->user_dir_list) = evas_list_prepend(*(ep->user_dir_list), epd); } else @@ -190,22 +169,16 @@ e_path_user_path_remove(E_Path *ep, const char *path) if (path[0] == '~') { char *new_path; - char *home_dir; + const char *home_dir; int len1, len2; home_dir = e_user_homedir_get(); - if (!home_dir) return; len1 = strlen(home_dir); len2 = strlen(path); new_path = malloc(len1 + len2 + 1); - if (!new_path) - { - free(home_dir); - return; - } + if (!new_path) return; strcpy(new_path, home_dir); strcat(new_path, path + 1); - free(home_dir); for (l = *(ep->user_dir_list); l; l = l->next) { E_Path_Dir *epd; diff --git a/src/bin/e_prefix.c b/src/bin/e_prefix.c index 17a8e996f..87d07d0c3 100644 --- a/src/bin/e_prefix.c +++ b/src/bin/e_prefix.c @@ -195,7 +195,7 @@ _e_prefix_share_hunt(void) char buf[4096], buf2[4096], *p; FILE *f; #ifdef PREFIX_CACHE_FILE - char *home; + const char *home; #endif /* sometimes this isnt the case - so we need to do a more exhaustive search @@ -214,8 +214,7 @@ _e_prefix_share_hunt(void) /* 1. check cache file - as a first attempt. this will speed up subsequent * hunts - if needed */ home = e_user_homedir_get(); - if (!home) return 0; - + snprintf(buf, sizeof(buf), "%s/.e/e/prefix_share_cache.txt", home); f = fopen(buf, "r"); if (f) @@ -237,7 +236,6 @@ _e_prefix_share_hunt(void) snprintf(buf2, sizeof(buf2), "%s/locale", buf); _prefix_path_locale = strdup(buf2); fclose(f); - free(home); return 1; } } @@ -319,14 +317,10 @@ _e_prefix_share_hunt(void) fprintf(f, "%s\n", _prefix_path_data); fclose(f); } - free(home); #endif return 1; } /* fail. everything failed */ -#ifdef PREFIX_CACHE_FILE - free(home); -#endif return 0; } diff --git a/src/bin/e_startup.c b/src/bin/e_startup.c index ce6bab8b9..b07455e4d 100644 --- a/src/bin/e_startup.c +++ b/src/bin/e_startup.c @@ -20,7 +20,7 @@ static E_App *waiting_app = NULL; EAPI void e_startup(E_Startup_Mode mode) { - char *homedir; + const char *homedir; char buf[PATH_MAX]; homedir = e_user_homedir_get(); @@ -28,7 +28,6 @@ e_startup(E_Startup_Mode mode) snprintf(buf, sizeof(buf), "%s/.e/e/applications/startup", homedir); else if (mode == E_STARTUP_RESTART) snprintf(buf, sizeof(buf), "%s/.e/e/applications/restart", homedir); - free(homedir); startup_apps = e_app_new(buf, 1); if (!startup_apps) { diff --git a/src/bin/e_user.c b/src/bin/e_user.c index 5d889d1c5..32cfad3f4 100644 --- a/src/bin/e_user.c +++ b/src/bin/e_user.c @@ -4,19 +4,19 @@ #include "e.h" /* externally accessible functions */ -EAPI char * +EAPI const char * e_user_homedir_get(void) { char *homedir; int len; homedir = getenv("HOME"); - if (!homedir) return strdup("/tmp"); + if (!homedir) return "/tmp"; len = strlen(homedir); while ((len > 1) && (homedir[len - 1] == '/')) { homedir[len - 1] = 0; len--; } - return strdup(homedir); + return homedir; } diff --git a/src/bin/e_user.h b/src/bin/e_user.h index e724e7d5e..d65eb2944 100644 --- a/src/bin/e_user.h +++ b/src/bin/e_user.h @@ -6,7 +6,7 @@ #ifndef E_USER_H #define E_USER_H -EAPI char *e_user_homedir_get(void); +EAPI const char *e_user_homedir_get(void); #endif #endif diff --git a/src/bin/e_widget_fsel.c b/src/bin/e_widget_fsel.c index e9255afe8..4e3f80b9f 100644 --- a/src/bin/e_widget_fsel.c +++ b/src/bin/e_widget_fsel.c @@ -70,8 +70,8 @@ static void _e_wid_fsel_favorites_add(void *data1, void *data2) { E_Widget_Data *wd; - const char *current_path; - char buf[4096], *fname, *homedir; + const char *current_path, *homedir; + char buf[4096], *fname; struct stat st; int i = 1; FILE *f; @@ -80,7 +80,6 @@ _e_wid_fsel_favorites_add(void *data1, void *data2) current_path = e_fm2_real_path_get(wd->o_files_fm); if (!ecore_file_is_dir(current_path)) return; homedir = e_user_homedir_get(); - if (!homedir) return; snprintf(buf, sizeof(buf), "%s/.e/e/fileman/favorites/%s", homedir, ecore_file_get_file(current_path)); if (stat(buf, &st) < 0) symlink(current_path, buf); @@ -109,7 +108,6 @@ _e_wid_fsel_favorites_add(void *data1, void *data2) } } e_fm2_refresh(wd->o_favorites_fm); - free(homedir); } static void diff --git a/src/modules/ibar/e_mod_config.c b/src/modules/ibar/e_mod_config.c index 0b22831a4..faf2faa64 100644 --- a/src/modules/ibar/e_mod_config.c +++ b/src/modules/ibar/e_mod_config.c @@ -226,7 +226,8 @@ static void _load_tlist(E_Config_Dialog_Data *cfdata) { Ecore_List *dirs; - char *home, buf[4096], *file; + const char *home; + char buf[4096], *file; int selnum = -1; e_widget_tlist_clear(cfdata->tlist); @@ -254,7 +255,6 @@ _load_tlist(E_Config_Dialog_Data *cfdata) } ecore_list_destroy(dirs); } - free(home); e_widget_tlist_go(cfdata->tlist); if (selnum >= 0) e_widget_tlist_selected_set(cfdata->tlist, selnum); diff --git a/src/modules/ibar/e_mod_main.c b/src/modules/ibar/e_mod_main.c index 2d8c1f665..3aed33f00 100644 --- a/src/modules/ibar/e_mod_main.c +++ b/src/modules/ibar/e_mod_main.c @@ -145,7 +145,7 @@ _gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style) evas_object_geometry_get(o, &x, &y, &w, &h); inst->drop_handler = - e_drop_handler_add(inst->gcc->gadcon, inst, + e_drop_handler_add(E_OBJECT(inst->gcc->gadcon), inst, _ibar_inst_cb_enter, _ibar_inst_cb_move, _ibar_inst_cb_leave, _ibar_inst_cb_drop, drop, 3, x, y, w, h); @@ -242,14 +242,10 @@ _ibar_new(Evas *evas, const char *dir) e_box_align_set(b->o_box, 0.5, 0.5); if (dir[0] != '/') { - char *homedir; + const char *homedir; homedir = e_user_homedir_get(); - if (homedir) - { - snprintf(buf, sizeof(buf), "%s/.e/e/applications/bar/%s", homedir, dir); - free(homedir); - } + snprintf(buf, sizeof(buf), "%s/.e/e/applications/bar/%s", homedir, dir); } else snprintf(buf, sizeof(buf), dir); @@ -468,14 +464,10 @@ _ibar_config_update(void) e_object_unref(E_OBJECT(inst->ibar->apps)); if (inst->dir[0] != '/') { - char *homedir; + const char *homedir; homedir = e_user_homedir_get(); - if (homedir) - { - snprintf(buf, sizeof(buf), "%s/.e/e/applications/bar/%s", homedir, inst->dir); - free(homedir); - } + snprintf(buf, sizeof(buf), "%s/.e/e/applications/bar/%s", homedir, inst->dir); } else snprintf(buf, sizeof(buf), inst->dir);