summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Fleischer <calcurse@cryptocrack.de>2011-12-05 00:43:17 +0100
committerLukas Fleischer <calcurse@cryptocrack.de>2011-12-05 00:48:47 +0100
commitdfe835190fa48013d6a5fa6cf687a36276a4bd0a (patch)
tree2d262b3ab1e1e3023a983cc0697ff6406ea46885
parentfc9cd6149b640ff8f62a6de9ccd0c6b009110407 (diff)
downloadcalcurse-dfe835190fa48013d6a5fa6cf687a36276a4bd0a.tar.gz
calcurse-dfe835190fa48013d6a5fa6cf687a36276a4bd0a.zip
src/apoint.c: Remove several unneeded variables
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
-rw-r--r--src/apoint.c66
1 files changed, 30 insertions, 36 deletions
diff --git a/src/apoint.c b/src/apoint.c
index 412f122..9e0d1b9 100644
--- a/src/apoint.c
+++ b/src/apoint.c
@@ -268,57 +268,51 @@ apoint_delete (unsigned *nb_events, unsigned *nb_apoints)
char *del_app_str = _("Do you really want to delete this item ?");
long date;
int nb_items = *nb_apoints + *nb_events;
- unsigned go_for_deletion = 0;
int to_be_removed = 0;
- int answer = 0;
- int deleted_item_type = 0;
date = calendar_get_slctd_day_sec ();
+ if (nb_items == 0)
+ return;
+
if (conf.confirm_delete)
{
status_mesg (del_app_str, choices);
- answer = wgetch (win[STA].p);
- if ((answer == 'y') && (nb_items != 0))
- go_for_deletion = 1;
- else
+ if (wgetch (win[STA].p) != 'y')
{
wins_erase_status_bar ();
return;
}
}
- else if (nb_items != 0)
- go_for_deletion = 1;
- if (go_for_deletion)
- {
- if (nb_items != 0)
- {
- deleted_item_type = day_erase_item (date, hilt, ERASE_DONT_FORCE);
- if (deleted_item_type == EVNT || deleted_item_type == RECUR_EVNT)
- {
- (*nb_events)--;
- to_be_removed = 1;
- }
- else if (deleted_item_type == APPT || deleted_item_type == RECUR_APPT)
- {
- (*nb_apoints)--;
- to_be_removed = 3;
- }
- else if (deleted_item_type == 0)
+ if (nb_items != 0)
+ {
+ switch (day_erase_item (date, hilt, ERASE_DONT_FORCE))
+ {
+ case EVNT:
+ case RECUR_EVNT:
+ (*nb_events)--;
+ to_be_removed = 1;
+ break;
+ case APPT:
+ case RECUR_APPT:
+ (*nb_apoints)--;
+ to_be_removed = 3;
+ break;
+ case 0:
return;
- else
+ default:
EXIT (_("no such type"));
- /* NOTREACHED */
-
- if (hilt > 1)
- hilt--;
- if (apad.first_onscreen >= to_be_removed)
- apad.first_onscreen = apad.first_onscreen - to_be_removed;
- if (nb_items == 1)
- hilt = 0;
- }
- }
+ /* NOTREACHED */
+ }
+
+ if (hilt > 1)
+ hilt--;
+ if (apad.first_onscreen >= to_be_removed)
+ apad.first_onscreen = apad.first_onscreen - to_be_removed;
+ if (nb_items == 1)
+ hilt = 0;
+ }
}
/* Cut an item, so that it can be pasted somewhere else later. */