aboutsummaryrefslogtreecommitdiffstats
path: root/src/todo.c
diff options
context:
space:
mode:
authorFrederic Culot <calcurse@culot.org>2008-12-12 20:44:50 +0000
committerFrederic Culot <calcurse@culot.org>2008-12-12 20:44:50 +0000
commit53db22a380ec76a684fd5000d216350aaa795278 (patch)
tree8902b4442302bfd8f5d2be0385357705e629be62 /src/todo.c
parentbd286546f42bbeb568e2a003882e78bf4f1ae831 (diff)
downloadcalcurse-53db22a380ec76a684fd5000d216350aaa795278.tar.gz
calcurse-53db22a380ec76a684fd5000d216350aaa795278.zip
code cleanup
Diffstat (limited to 'src/todo.c')
-rwxr-xr-xsrc/todo.c33
1 files changed, 14 insertions, 19 deletions
diff --git a/src/todo.c b/src/todo.c
index 6da9c42..16c9a79 100755
--- a/src/todo.c
+++ b/src/todo.c
@@ -1,4 +1,4 @@
-/* $calcurse: todo.c,v 1.26 2008/12/08 19:17:07 culot Exp $ */
+/* $calcurse: todo.c,v 1.27 2008/12/12 20:44:50 culot Exp $ */
/*
* Calcurse - text-based organizer
@@ -190,8 +190,7 @@ todo_delete_note_bynum (unsigned num)
if (n == num)
{
if (i->note == NULL)
- ierror (_("FATAL ERROR in todo_delete_note_bynum: "
- "no note attached\n"), IERROR_FATAL);
+ EXIT (_("no note attached"));
erase_note (&i->note, ERASE_FORCE_ONLY_NOTE);
return;
}
@@ -199,9 +198,7 @@ todo_delete_note_bynum (unsigned num)
n++;
}
/* NOTREACHED */
- ierror (_("FATAL ERROR in todo_delete_note_bynum: no such todo\n"),
- IERROR_FATAL);
- exit (EXIT_FAILURE);
+ EXIT (_("no such todo"));
}
/* Delete an item from the todo linked list. */
@@ -228,9 +225,7 @@ todo_delete_bynum (unsigned num, erase_flag_e flag)
n++;
}
/* NOTREACHED */
- ierror (_("FATAL ERROR in todo_delete_bynum: no such todo\n"),
- IERROR_FATAL);
- exit (EXIT_FAILURE);
+ EXIT (_("no such todo"));
}
/* Delete an item from the ToDo list. */
@@ -326,8 +321,8 @@ todo_get_position (struct todo_s *i)
}
else
{
- fputs (_("FATAL ERROR in todo_get_position: todo not found\n"), stderr);
- exit (EXIT_FAILURE);
+ EXIT (_("todo not found"));
+ return -1; /* avoid compiler warnings */
}
}
@@ -348,17 +343,17 @@ todo_chg_priority (int action)
strncpy (backup_note, backup->note, NOTESIZ + 1);
else
backup_note[0] = '\0';
- if (action == KEY_RAISE_PRIORITY)
+ switch (action)
{
+ case KEY_RAISE_PRIORITY:
(backup_id > 1) ? backup_id-- : do_chg--;
- }
- else if (action == KEY_LOWER_PRIORITY)
- {
+ break;
+ case KEY_LOWER_PRIORITY:
(backup_id < 9) ? backup_id++ : do_chg--;
- }
- else
- { /* NOTREACHED */
- fputs (_("FATAL ERROR in todo_chg_priority: no such action\n"), stderr);
+ break;
+ default:
+ EXIT (_("no such action"));
+ /* NOTREACHED */
}
if (do_chg)
{