From 54d4dfc534bded789d59c92b8a90a0268d813dab Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Thu, 12 Sep 2024 09:51:39 +0300 Subject: [PATCH] (spell_dialog_spell_suggest_show): refactoring. Reduce variable scope. Get rid of extra NULL check: g_strdup() handles NULL correctly. Remove intermediate variable. Signed-off-by: Andrew Borodin --- src/editor/spell.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/editor/spell.c b/src/editor/spell.c index b8c16903b..f1226a63b 100644 --- a/src/editor/spell.c +++ b/src/editor/spell.c @@ -330,7 +330,6 @@ spell_dialog_spell_suggest_show (WEdit *edit, const char *word, char **new_word, char *word_label; unsigned int i; int res; - char *curr = NULL; WDialog *sug_dlg; WGroup *g; WListbox *sug_list; @@ -393,12 +392,10 @@ spell_dialog_spell_suggest_show (WEdit *edit, const char *word, char **new_word, res = dlg_run (sug_dlg); if (res == B_ENTER) { - char *tmp = NULL; - listbox_get_current (sug_list, &curr, NULL); + char *curr = NULL; - if (curr != NULL) - tmp = g_strdup (curr); - *new_word = tmp; + listbox_get_current (sug_list, &curr, NULL); + *new_word = g_strdup (curr); } widget_destroy (WIDGET (sug_dlg)); -- 2.11.4.GIT