diff --git a/src/bin/media.c b/src/bin/media.c index 28bfd2b1..62404456 100644 --- a/src/bin/media.c +++ b/src/bin/media.c @@ -964,8 +964,8 @@ _smart_del(Evas_Object *obj) if (sd->realf) unlink(sd->realf); close(sd->tmpfd); } - if (sd->src) eina_stringshare_del(sd->src); - if (sd->realf) eina_stringshare_del(sd->realf); + eina_stringshare_del(sd->src); + eina_stringshare_del(sd->realf); if (sd->clip) evas_object_del(sd->clip); if (sd->o_img) evas_object_del(sd->o_img); if (sd->o_tmp) evas_object_del(sd->o_tmp); diff --git a/src/bin/termio.c b/src/bin/termio.c index 4ab0ebb4..2d86ea7d 100644 --- a/src/bin/termio.c +++ b/src/bin/termio.c @@ -176,11 +176,8 @@ termio_user_title_set(Evas_Object *obj, const char *title) size_t len = 0; EINA_SAFETY_ON_NULL_RETURN(sd); - if (sd->pty->prop.user_title) - { - eina_stringshare_del(sd->pty->prop.user_title); - sd->pty->prop.user_title = NULL; - } + eina_stringshare_del(sd->pty->prop.user_title); + sd->pty->prop.user_title = NULL; if (title) { @@ -409,7 +406,7 @@ termio_config_update(Evas_Object *obj) EINA_SAFETY_ON_NULL_RETURN(sd); - if (sd->font.name) eina_stringshare_del(sd->font.name); + eina_stringshare_del(sd->font.name); sd->font.name = NULL; if (sd->config->font.bitmap) @@ -872,11 +869,8 @@ _lost_selection(void *data, Elm_Sel_Type selection) } if (sd->have_sel) { - if (sd->sel_str) - { - eina_stringshare_del(sd->sel_str); - sd->sel_str = NULL; - } + eina_stringshare_del(sd->sel_str); + sd->sel_str = NULL; termio_sel_set(sd, EINA_FALSE); elm_object_cnp_selection_clear(sd->win, selection); termio_smart_update_queue(sd); @@ -906,7 +900,7 @@ termio_take_selection_text(Termio *sd, Elm_Sel_Type type, const char *text) elm_cnp_selection_loss_callback_set(sd->win, type, _lost_selection, sd->self); sd->have_sel = EINA_TRUE; - if (sd->sel_str) eina_stringshare_del(sd->sel_str); + eina_stringshare_del(sd->sel_str); sd->sel_str = text; } @@ -1439,11 +1433,9 @@ _remove_links(Termio *sd) { Eina_Bool same_geom = EINA_FALSE; - if (sd->link.string) - { - eina_stringshare_del(sd->link.string); - sd->link.string = NULL; - } + eina_stringshare_del(sd->link.string); + sd->link.string = NULL; + sd->link.x1 = -1; sd->link.y1 = -1; sd->link.x2 = -1; @@ -2383,8 +2375,7 @@ _smart_mouseover_apply(Termio *sd) goto end; } - if (sd->link.string) - eina_stringshare_del(sd->link.string); + eina_stringshare_del(sd->link.string); sd->link.string = eina_stringshare_add(s); if ((x1 == sd->link.x1) && (y1 == sd->link.y1) && @@ -2829,13 +2820,13 @@ termio_file_send_ok(const Evas_Object *obj, const char *file) sd->sendfile.f = fopen(file, "w"); if (sd->sendfile.f) { - if (sd->sendfile.file) eina_stringshare_del(sd->sendfile.file); + eina_stringshare_del(sd->sendfile.file); sd->sendfile.file = eina_stringshare_add(file); sd->sendfile.active = EINA_TRUE; termpty_write(ty, "k\n", 2); return EINA_TRUE; } - if (sd->sendfile.file) eina_stringshare_del(sd->sendfile.file); + eina_stringshare_del(sd->sendfile.file); sd->sendfile.file = NULL; sd->sendfile.active = EINA_FALSE; termpty_write(ty, "n\n", 2); @@ -3226,10 +3217,9 @@ _smart_del(Evas_Object *obj) if (sd->link_do_timer) ecore_timer_del(sd->link_do_timer); if (sd->mouse_move_job) ecore_job_del(sd->mouse_move_job); if (sd->mouseover_delay) ecore_timer_del(sd->mouseover_delay); - if (sd->font.name) eina_stringshare_del(sd->font.name); + eina_stringshare_del(sd->font.name); if (sd->pty) termpty_free(sd->pty); - if (sd->link.string) - eina_stringshare_del(sd->link.string); + eina_stringshare_del(sd->link.string); if (sd->glayer) evas_object_del(sd->glayer); if (sd->win) evas_object_event_callback_del_full(sd->win, EVAS_CALLBACK_DEL, @@ -3255,7 +3245,7 @@ _smart_del(Evas_Object *obj) } sd->sendfile.active = EINA_FALSE; } - if (sd->sel_str) eina_stringshare_del(sd->sel_str); + eina_stringshare_del(sd->sel_str); if (sd->sel_reset_job) ecore_job_del(sd->sel_reset_job); EINA_LIST_FREE(sd->cur_chids, chid) eina_stringshare_del(chid); sd->sel_str = NULL; @@ -3800,11 +3790,8 @@ _smart_pty_command(void *data) { sd->sendfile.progress = 0.0; sd->sendfile.size = 0; - if (sd->sendfile.file) - { - eina_stringshare_del(sd->sendfile.file); - sd->sendfile.file = NULL; - } + eina_stringshare_del(sd->sendfile.file); + sd->sendfile.file = NULL; if (sd->sendfile.f) { fclose(sd->sendfile.f); diff --git a/src/bin/termpty.c b/src/bin/termpty.c index 6ac1e02a..99179346 100644 --- a/src/bin/termpty.c +++ b/src/bin/termpty.c @@ -818,9 +818,9 @@ termpty_free(Termpty *ty) } if (ty->hand_exe_exit) ecore_event_handler_del(ty->hand_exe_exit); if (ty->hand_fd) ecore_main_fd_handler_del(ty->hand_fd); - if (ty->prop.title) eina_stringshare_del(ty->prop.title); - if (ty->prop.user_title) eina_stringshare_del(ty->prop.user_title); - if (ty->prop.icon) eina_stringshare_del(ty->prop.icon); + eina_stringshare_del(ty->prop.title); + eina_stringshare_del(ty->prop.user_title); + eina_stringshare_del(ty->prop.icon); termpty_backlog_free(ty); free(ty->screen); free(ty->screen2); @@ -1395,11 +1395,17 @@ void termpty_block_free(Termblock *tb) { char *s; - if (tb->path) eina_stringshare_del(tb->path); - if (tb->link) eina_stringshare_del(tb->link); - if (tb->chid) eina_stringshare_del(tb->chid); - if (tb->obj) evas_object_del(tb->obj); - EINA_LIST_FREE(tb->cmds, s) free(s); + + if (!tb) + return; + + eina_stringshare_del(tb->path); + eina_stringshare_del(tb->link); + eina_stringshare_del(tb->chid); + if (tb->obj) + evas_object_del(tb->obj); + EINA_LIST_FREE(tb->cmds, s) + free(s); free(tb); } diff --git a/src/bin/termptyesc.c b/src/bin/termptyesc.c index 84f93f26..8dcecb21 100644 --- a/src/bin/termptyesc.c +++ b/src/bin/termptyesc.c @@ -3762,8 +3762,8 @@ _handle_esc_osc(Termpty *ty, const Eina_Unicode *c, const Eina_Unicode *ce) if (!*p) goto err; s = eina_unicode_unicode_to_utf8(p, &len); - if (ty->prop.title) eina_stringshare_del(ty->prop.title); - if (ty->prop.icon) eina_stringshare_del(ty->prop.icon); + eina_stringshare_del(ty->prop.title); + eina_stringshare_del(ty->prop.icon); if (s) { ty->prop.title = eina_stringshare_add(s); @@ -3777,14 +3777,15 @@ _handle_esc_osc(Termpty *ty, const Eina_Unicode *c, const Eina_Unicode *ce) } if (ty->cb.set_title.func) ty->cb.set_title.func(ty->cb.set_title.data); - if (ty->cb.set_icon.func) ty->cb.set_icon.func(ty->cb.set_icon.data); + if (ty->cb.set_icon.func) + ty->cb.set_icon.func(ty->cb.set_icon.data); break; case 1: // icon name if (!*p) goto err; s = eina_unicode_unicode_to_utf8(p, &len); - if (ty->prop.icon) eina_stringshare_del(ty->prop.icon); + eina_stringshare_del(ty->prop.icon); if (s) { ty->prop.icon = eina_stringshare_add(s); @@ -3801,7 +3802,7 @@ _handle_esc_osc(Termpty *ty, const Eina_Unicode *c, const Eina_Unicode *ce) if (!*p) goto err; s = eina_unicode_unicode_to_utf8(p, &len); - if (ty->prop.title) eina_stringshare_del(ty->prop.title); + eina_stringshare_del(ty->prop.title); if (s) { ty->prop.title = eina_stringshare_add(s); diff --git a/src/bin/win.c b/src/bin/win.c index 56d44a84..d374fe69 100644 --- a/src/bin/win.c +++ b/src/bin/win.c @@ -1000,10 +1000,8 @@ win_free(Win *wn) } if (wn->size_job) ecore_job_del(wn->size_job); - if (wn->config) - config_del(wn->config); - if (wn->preedit_str) - eina_stringshare_del(wn->preedit_str); + config_del(wn->config); + eina_stringshare_del(wn->preedit_str); keyin_compose_seq_reset(&wn->khdl); if (wn->khdl.imf) { @@ -1488,11 +1486,8 @@ _imf_event_commit_cb(void *data, termpty_write(ty, str, len); } } - if (wn->preedit_str) - { - eina_stringshare_del(wn->preedit_str); - wn->preedit_str = NULL; - } + eina_stringshare_del(wn->preedit_str); + wn->preedit_str = NULL; } @@ -1520,8 +1515,7 @@ _imf_event_preedit_changed_cb(void *data, if (!preedit_string) return; DBG("IMF preedit str '%s'", preedit_string); - if (wn->preedit_str) - eina_stringshare_del(wn->preedit_str); + eina_stringshare_del(wn->preedit_str); wn->preedit_str = eina_stringshare_add(preedit_string); free(preedit_string); } @@ -5629,11 +5623,8 @@ _term_free(Term *term) ecore_timer_del(term->sendfile_progress_hide_timer); term->sendfile_progress_hide_timer = NULL; } - if (term->sendfile_dir) - { - eina_stringshare_del(term->sendfile_dir); - term->sendfile_dir = NULL; - } + eina_stringshare_del(term->sendfile_dir); + term->sendfile_dir = NULL; _popmedia_queue_free(term); if (term->media) {