diff options
author | Lukas Fleischer <calcurse@cryptocrack.de> | 2011-04-14 12:49:44 +0200 |
---|---|---|
committer | Lukas Fleischer <calcurse@cryptocrack.de> | 2011-04-19 11:42:34 +0200 |
commit | bf431d6cd9411714f849050a10071dc0fe0d7741 (patch) | |
tree | 9f97ddbc64b46e3e669794e1c2a0f15355ee99b4 /src/args.c | |
parent | 6f883c0f3f4c08fe8e125f269da9b940519ccf44 (diff) | |
download | calcurse-bf431d6cd9411714f849050a10071dc0fe0d7741.zip |
Use generic lists for todo items.
Use the new generic list implementation instead of "next" pointers in
todo items.
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
Diffstat (limited to 'src/args.c')
-rw-r--r-- | src/args.c | 19 |
1 files changed, 10 insertions, 9 deletions
@@ -242,7 +242,7 @@ print_notefile (FILE *out, char *filename, int nbtab) static void todo_arg (int priority, int print_note, regex_t *regex) { - struct todo *i; + llist_item_t *i; int title = 1; char *titlestr, priority_str[BUFSIZ] = ""; char *all_todos_title = _("to do:\n"); @@ -259,20 +259,21 @@ todo_arg (int priority, int print_note, regex_t *regex) } while (0) #define DISPLAY_TODO do { \ - (void)snprintf (priority_str, BUFSIZ, "%d. ", abs (i->id)); \ + (void)snprintf (priority_str, BUFSIZ, "%d. ", abs (todo->id)); \ fputs (priority_str, stdout); \ - fputs (i->mesg, stdout); \ + fputs (todo->mesg, stdout); \ fputs ("\n", stdout); \ - if (print_note && i->note) \ - print_notefile (stdout, i->note, 1); \ + if (print_note && todo->note) \ + print_notefile (stdout, todo->note, 1); \ } while (0) - for (i = todolist; i != NULL; i = i->next) + LLIST_FOREACH (&todolist, i) { - if (regex && regexec (regex, i->mesg, 0, 0, 0) != 0) + struct todo *todo = LLIST_TS_GET_DATA (i); + if (regex && regexec (regex, todo->mesg, 0, 0, 0) != 0) continue; - if (i->id < 0) /* completed task */ + if (todo->id < 0) /* completed task */ { if (priority == 0) { @@ -282,7 +283,7 @@ todo_arg (int priority, int print_note, regex_t *regex) } else { - if (priority < 0 || i->id == priority) + if (priority < 0 || todo->id == priority) { DISPLAY_TITLE; DISPLAY_TODO; |