From a01cbe0c36e27920efe57ac7f3323602f0695afb Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Fri, 9 Dec 2011 01:14:05 +0100 Subject: src/todo.c: Remove several unneeded variables Signed-off-by: Lukas Fleischer --- src/todo.c | 33 ++++++++++++++------------------- 1 file changed, 14 insertions(+), 19 deletions(-) (limited to 'src/todo.c') diff --git a/src/todo.c b/src/todo.c index 4418710..38ffca3 100644 --- a/src/todo.c +++ b/src/todo.c @@ -248,27 +248,19 @@ todo_delete (void) _("This item has a note attached to it. " "Delete (t)odo or just its (n)ote ?"); char *erase_choice = _("[t/n] "); - unsigned go_for_todo_del = 0; int answer, has_note; if (conf.confirm_delete) { status_mesg (del_todo_str, choices); answer = wgetch (win[STA].p); - if ((answer == 'y') && (todos > 0)) - { - go_for_todo_del = 1; - } - else + if ((answer != 'y') || (todos <= 0)) { wins_erase_status_bar (); return; } } - else if (todos > 0) - go_for_todo_del = 1; - - if (go_for_todo_del == 0) + else if (todos <= 0) { wins_erase_status_bar (); return; @@ -335,7 +327,6 @@ todo_chg_priority (int action) char backup_mesg[BUFSIZ]; int backup_id; char backup_note[MAX_NOTESIZ + 1]; - int do_chg = 1; backup = todo_get_item (hilt); strncpy (backup_mesg, backup->mesg, strlen (backup->mesg) + 1); @@ -347,21 +338,25 @@ todo_chg_priority (int action) switch (action) { case KEY_RAISE_PRIORITY: - (backup_id > 1) ? backup_id-- : do_chg--; + if (backup_id > 1) + backup_id--; + else + return; break; case KEY_LOWER_PRIORITY: - (backup_id > 0 && backup_id < 9) ? backup_id++ : do_chg--; + if (backup_id > 0 && backup_id < 9) + backup_id++; + else + return; break; default: EXIT (_("no such action")); /* NOTREACHED */ } - if (do_chg) - { - todo_delete_bynum (hilt - 1); - backup = todo_add (backup_mesg, backup_id, backup_note); - hilt = todo_get_position (backup); - } + + todo_delete_bynum (hilt - 1); + backup = todo_add (backup_mesg, backup_id, backup_note); + hilt = todo_get_position (backup); } /* Edit the description of an already existing todo item. */ -- cgit v1.2.3-54-g00ecf