From 6fb0f6f4c6c5e17b9485fc666823feede35723b9 Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Tue, 5 Apr 2011 01:50:23 +0200 Subject: Compare pointers to "NULL" instead of "0". "bad_zero.cocci" spatch from http://coccinelle.lip6.fr/impact_linux.php. Signed-off-by: Lukas Fleischer --- src/apoint.c | 8 ++++---- src/args.c | 10 +++++----- src/custom.c | 2 +- src/day.c | 28 ++++++++++++++-------------- src/event.c | 4 ++-- src/io.c | 50 +++++++++++++++++++++++++------------------------- src/keys.c | 6 +++--- src/mem.c | 24 ++++++++++++------------ src/recur.c | 36 ++++++++++++++++++------------------ src/todo.c | 8 ++++---- src/utils.c | 6 +++--- src/wins.c | 4 ++-- 12 files changed, 93 insertions(+), 93 deletions(-) diff --git a/src/apoint.c b/src/apoint.c index 4b562f7..f612071 100644 --- a/src/apoint.c +++ b/src/apoint.c @@ -141,7 +141,7 @@ apoint_new (char *mesg, char *note, long start, long dur, char state) i = &alist_p->root; for (;;) { - if (*i == 0 || (*i)->start > start) + if (*i == NULL || (*i)->start > start) { o->next = *i; *i = o; @@ -509,7 +509,7 @@ apoint_delete_bynum (long start, unsigned num, enum eraseflg flag) n = 0; pthread_mutex_lock (&(alist_p->mutex)); iptr = &alist_p->root; - for (i = alist_p->root; i != 0; i = i->next) + for (i = alist_p->root; i != NULL; i = i->next) { if (apoint_inday (i, start)) { @@ -616,7 +616,7 @@ apoint_check_next (struct notify_app *app, long start) struct apoint *i; pthread_mutex_lock (&(alist_p->mutex)); - for (i = alist_p->root; i != 0; i = i->next) + for (i = alist_p->root; i != NULL; i = i->next) { if (i->start > app->time) { @@ -684,7 +684,7 @@ apoint_switch_notify (void) need_chk_notify = 0; pthread_mutex_lock (&(alist_p->mutex)); - for (apoint = alist_p->root; apoint != 0; apoint = apoint->next) + for (apoint = alist_p->root; apoint != NULL; apoint = apoint->next) { if (apoint_inday (apoint, date)) { diff --git a/src/args.c b/src/args.c index 4ac2fd5..cd2c5d5 100644 --- a/src/args.c +++ b/src/args.c @@ -267,7 +267,7 @@ todo_arg (int priority, int print_note, regex_t *regex) print_notefile (stdout, i->note, 1); \ } while (0) - for (i = todolist; i != 0; i = i->next) + for (i = todolist; i != NULL; i = i->next) { if (regex && regexec (regex, i->mesg, 0, 0, 0) != 0) continue; @@ -370,7 +370,7 @@ app_arg (int add_line, struct date *day, long date, int print_note, * that date and it is the first one, and then print all the events for * that date. */ - for (re = recur_elist; re != 0; re = re->next) + for (re = recur_elist; re != NULL; re = re->next) { if (recur_item_inday (re->day, re->exc, re->rpt->type, re->rpt->freq, re->rpt->until, today)) @@ -397,7 +397,7 @@ app_arg (int add_line, struct date *day, long date, int print_note, } } - for (j = eventlist; j != 0; j = j->next) + for (j = eventlist; j != NULL; j = j->next) { if (event_inday (j, today)) { @@ -425,7 +425,7 @@ app_arg (int add_line, struct date *day, long date, int print_note, /* Same process is performed but this time on the appointments. */ pthread_mutex_lock (&(recur_alist_p->mutex)); - for (ra = recur_alist_p->root; ra != 0; ra = ra->next) + for (ra = recur_alist_p->root; ra != NULL; ra = ra->next) { if (recur_item_inday (ra->start, ra->exc, ra->rpt->type, ra->rpt->freq, ra->rpt->until, today)) @@ -465,7 +465,7 @@ app_arg (int add_line, struct date *day, long date, int print_note, pthread_mutex_unlock (&(recur_alist_p->mutex)); pthread_mutex_lock (&(alist_p->mutex)); - for (i = alist_p->root; i != 0; i = i->next) + for (i = alist_p->root; i != NULL; i = i->next) { if (apoint_inday (i, today)) { diff --git a/src/custom.c b/src/custom.c index 29a6261..e8cf0fe 100644 --- a/src/custom.c +++ b/src/custom.c @@ -1243,7 +1243,7 @@ print_keys_bindings (WINDOW *win, int selected_row, int selected_elm, int yoff) int pos; pos = KEYPOS; - while ((key = keys_action_nkey (action, noelm)) != 0) + while ((key = keys_action_nkey (action, noelm)) != NULL) { if (noelm == selected_elm) print_key_incolor (win, key, y, pos); diff --git a/src/day.c b/src/day.c index 8561123..0dc888e 100644 --- a/src/day.c +++ b/src/day.c @@ -90,7 +90,7 @@ day_add_event (int type, char *mesg, char *note, long day, int id) i = &day_items_ptr; for (;;) { - if (*i == 0) + if (*i == NULL) { o->next = *i; *i = o; @@ -121,7 +121,7 @@ day_add_apoint (int type, char *mesg, char *note, long start, long dur, i = &day_items_ptr; for (;;) { - if (*i == 0) + if (*i == NULL) { insert_item = 1; } @@ -153,7 +153,7 @@ day_store_events (long date) struct event *j; int e_nb = 0; - for (j = eventlist; j != 0; j = j->next) + for (j = eventlist; j != NULL; j = j->next) { if (event_inday (j, date)) { @@ -178,7 +178,7 @@ day_store_recur_events (long date) struct recur_event *j; int e_nb = 0; - for (j = recur_elist; j != 0; j = j->next) + for (j = recur_elist; j != NULL; j = j->next) { if (recur_item_inday (j->day, j->exc, j->rpt->type, j->rpt->freq, j->rpt->until, date)) @@ -205,7 +205,7 @@ day_store_apoints (long date) int a_nb = 0; pthread_mutex_lock (&(alist_p->mutex)); - for (j = alist_p->root; j != 0; j = j->next) + for (j = alist_p->root; j != NULL; j = j->next) { if (apoint_inday (j, date)) { @@ -234,7 +234,7 @@ day_store_recur_apoints (long date) int a_nb = 0, n = 0; pthread_mutex_lock (&(recur_alist_p->mutex)); - for (j = recur_alist_p->root; j != 0; j = j->next) + for (j = recur_alist_p->root; j != NULL; j = j->next) { if ((real_start = recur_item_inday (j->start, j->exc, j->rpt->type, j->rpt->freq, @@ -266,7 +266,7 @@ day_store_items (long date, unsigned *pnb_events, unsigned *pnb_apoints) int nb_events, nb_recur_events; int nb_apoints, nb_recur_apoints; - if (day_items_ptr != 0) + if (day_items_ptr != NULL) day_free_list (); nb_recur_events = day_store_recur_events (date); nb_events = day_store_events (date); @@ -405,7 +405,7 @@ day_write_pad (long date, int width, int length, int incolor) line = item_number = 0; - for (p = day_items_ptr; p != 0; p = p->next) + for (p = day_items_ptr; p != NULL; p = p->next) { if (p->type == RECUR_EVNT || p->type == RECUR_APPT) recur = 1; @@ -481,13 +481,13 @@ day_check_if_item (struct date day) struct apoint *a; const long date = date2sec (day, 0, 0); - for (re = recur_elist; re != 0; re = re->next) + for (re = recur_elist; re != NULL; re = re->next) if (recur_item_inday (re->day, re->exc, re->rpt->type, re->rpt->freq, re->rpt->until, date)) return (1); pthread_mutex_lock (&(recur_alist_p->mutex)); - for (ra = recur_alist_p->root; ra != 0; ra = ra->next) + for (ra = recur_alist_p->root; ra != NULL; ra = ra->next) if (recur_item_inday (ra->start, ra->exc, ra->rpt->type, ra->rpt->freq, ra->rpt->until, date)) { @@ -496,12 +496,12 @@ day_check_if_item (struct date day) } pthread_mutex_unlock (&(recur_alist_p->mutex)); - for (e = eventlist; e != 0; e = e->next) + for (e = eventlist; e != NULL; e = e->next) if (event_inday (e, date)) return (1); pthread_mutex_lock (&(alist_p->mutex)); - for (a = alist_p->root; a != 0; a = a->next) + for (a = alist_p->root; a != NULL; a = a->next) if (apoint_inday (a, date)) { pthread_mutex_unlock (&(alist_p->mutex)); @@ -547,7 +547,7 @@ day_chk_busy_slices (struct date day, int slicesno, int *slices) #define SLICENUM(tsec) ((tsec) / slicelen % slicesno) pthread_mutex_lock (&(recur_alist_p->mutex)); - for (ra = recur_alist_p->root; ra != 0; ra = ra->next) + for (ra = recur_alist_p->root; ra != NULL; ra = ra->next) if (recur_item_inday (ra->start, ra->exc, ra->rpt->type, ra->rpt->freq, ra->rpt->until, date)) { @@ -564,7 +564,7 @@ day_chk_busy_slices (struct date day, int slicesno, int *slices) pthread_mutex_unlock (&(recur_alist_p->mutex)); pthread_mutex_lock (&(alist_p->mutex)); - for (a = alist_p->root; a != 0; a = a->next) + for (a = alist_p->root; a != NULL; a = a->next) if (apoint_inday (a, date)) { long start, end; diff --git a/src/event.c b/src/event.c index fc527c6..a3c4750 100644 --- a/src/event.c +++ b/src/event.c @@ -96,7 +96,7 @@ event_new (char *mesg, char *note, long day, int id) i = &eventlist; for (;;) { - if (*i == 0 || (*i)->day > day) + if (*i == NULL || (*i)->day > day) { o->next = *i; *i = o; @@ -195,7 +195,7 @@ event_delete_bynum (long start, unsigned num, enum eraseflg flag) n = 0; iptr = &eventlist; - for (i = eventlist; i != 0; i = i->next) + for (i = eventlist; i != NULL; i = i->next) { if (event_inday (i, start)) { diff --git a/src/io.c b/src/io.c index 0fe930e..7619696 100644 --- a/src/io.c +++ b/src/io.c @@ -346,7 +346,7 @@ ical_export_recur_events (FILE *stream) struct days *day; char ical_date[BUFSIZ]; - for (i = recur_elist; i != 0; i = i->next) + for (i = recur_elist; i != NULL; i = i->next) { date_sec2date_fmt (i->day, ICALDATEFMT, ical_date); (void)fprintf (stream, "BEGIN:VEVENT\n"); @@ -416,7 +416,7 @@ pcal_export_recur_events (FILE *stream) (void)fprintf (stream, "# (pcal does not support from..until dates specification\n"); - for (i = recur_elist; i != 0; i = i->next) + for (i = recur_elist; i != NULL; i = i->next) { if (i->rpt->until == 0 && i->rpt->freq == 1) { @@ -464,7 +464,7 @@ ical_export_events (FILE *stream) struct event *i; char ical_date[BUFSIZ]; - for (i = eventlist; i != 0; i = i->next) + for (i = eventlist; i != NULL; i = i->next) { date_sec2date_fmt (i->day, ICALDATEFMT, ical_date); (void)fprintf (stream, "BEGIN:VEVENT\n"); @@ -480,7 +480,7 @@ pcal_export_events (FILE *stream) struct event *i; (void)fprintf (stream, "\n# ======\n# Events\n# ======\n"); - for (i = eventlist; i != 0; i = i->next) + for (i = eventlist; i != NULL; i = i->next) pcal_dump_event (stream, i->day, 0, i->mesg); (void)fprintf (stream, "\n"); } @@ -495,7 +495,7 @@ ical_export_recur_apoints (FILE *stream) char ical_date[BUFSIZ]; pthread_mutex_lock (&(recur_alist_p->mutex)); - for (i = recur_alist_p->root; i != 0; i = i->next) + for (i = recur_alist_p->root; i != NULL; i = i->next) { date_sec2date_fmt (i->start, ICALDATETIMEFMT, ical_datetime); (void)fprintf (stream, "BEGIN:VEVENT\n"); @@ -544,7 +544,7 @@ pcal_export_recur_apoints (FILE *stream) (void)fprintf (stream, "# (pcal does not support from..until dates specification\n"); - for (i = recur_alist_p->root; i != 0; i = i->next) + for (i = recur_alist_p->root; i != NULL; i = i->next) { if (i->rpt->until == 0 && i->rpt->freq == 1) { @@ -598,7 +598,7 @@ ical_export_apoints (FILE *stream) char ical_datetime[BUFSIZ]; pthread_mutex_lock (&(alist_p->mutex)); - for (i = alist_p->root; i != 0; i = i->next) + for (i = alist_p->root; i != NULL; i = i->next) { date_sec2date_fmt (i->start, ICALDATETIMEFMT, ical_datetime); (void)fprintf (stream, "BEGIN:VEVENT\n"); @@ -619,7 +619,7 @@ pcal_export_apoints (FILE *stream) (void)fprintf (stream, "\n# ============\n# Appointments\n# ============\n"); pthread_mutex_lock (&(alist_p->mutex)); - for (i = alist_p->root; i != 0; i = i->next) + for (i = alist_p->root; i != NULL; i = i->next) pcal_dump_apoint (stream, i->start, i->dur, i->mesg); pthread_mutex_unlock (&(alist_p->mutex)); (void)fprintf (stream, "\n"); @@ -631,7 +631,7 @@ ical_export_todo (FILE *stream) { struct todo *i; - for (i = todolist; i != 0; i = i->next) + for (i = todolist; i != NULL; i = i->next) { if (i->id < 0) /* completed items */ continue; @@ -649,7 +649,7 @@ pcal_export_todo (FILE *stream) struct todo *i; (void)fprintf (stream, "#\n# Todos\n#\n"); - for (i = todolist; i != 0; i = i->next) + for (i = todolist; i != NULL; i = i->next) { if (i->id < 0) /* completed items */ continue; @@ -831,7 +831,7 @@ io_save_conf (struct conf *conf) char theme_name[BUFSIZ]; FILE *fp; - if ((fp = fopen (path_conf, "w")) == 0) + if ((fp = fopen (path_conf, "w")) == NULL) return 0; custom_color_theme_name (theme_name); @@ -963,19 +963,19 @@ io_save_apts (void) struct event *e; FILE *fp; - if ((fp = fopen (path_apts, "w")) == 0) + if ((fp = fopen (path_apts, "w")) == NULL) return 0; recur_save_data (fp); if (ui_mode == UI_CURSES) pthread_mutex_lock (&(alist_p->mutex)); - for (a = alist_p->root; a != 0; a = a->next) + for (a = alist_p->root; a != NULL; a = a->next) apoint_write (a, fp); if (ui_mode == UI_CURSES) pthread_mutex_unlock (&(alist_p->mutex)); - for (e = eventlist; e != 0; e = e->next) + for (e = eventlist; e != NULL; e = e->next) event_write (e, fp); file_close (fp, __FILE_POS__); @@ -989,10 +989,10 @@ io_save_todo (void) struct todo *t; FILE *fp; - if ((fp = fopen (path_todo, "w")) == 0) + if ((fp = fopen (path_todo, "w")) == NULL) return 0; - for (t = todolist; t != 0; t = t->next) + for (t = todolist; t != NULL; t = t->next) { if (t->note) (void)fprintf (fp, "[%d]>%s %s\n", t->id, t->note, t->mesg); @@ -1010,7 +1010,7 @@ io_save_keys (void) { FILE *fp; - if ((fp = fopen (path_keys, "w")) == 0) + if ((fp = fopen (path_keys, "w")) == NULL) return 0; keys_save_bindings (fp); @@ -1516,7 +1516,7 @@ io_file_exist (char *file) if (!file) return 0; - if ((fd = fopen (file, "r")) == 0) + if ((fd = fopen (file, "r")) == NULL) return 0; (void)fclose (fd); @@ -1624,7 +1624,7 @@ io_export_data (enum export_type type, struct conf *conf) /* NOTREACHED */ } - if (stream == 0) + if (stream == NULL) return; cb_export_header[type] (stream); @@ -2774,7 +2774,7 @@ io_import_data (enum import_type type, struct conf *conf, char *stream_name) "Aborting...")); log = io_log_init (); - if (log == 0) + if (log == NULL) { if (stream != stdin) file_close (stream, __FILE_POS__); @@ -2840,15 +2840,15 @@ io_log_init (void) struct io_file *log; logname = new_tempfile (logprefix, NOTESIZ); - RETVAL_IF (logname == 0, 0, + RETVAL_IF (logname == NULL, 0, _("Warning: could not create temporary log file, Aborting...")); log = mem_malloc (sizeof (struct io_file)); - RETVAL_IF (log == 0, 0, + RETVAL_IF (log == NULL, 0, _("Warning: could not open temporary log file, Aborting...")); (void)snprintf (log->name, sizeof (log->name), "%s%s", logprefix, logname); mem_free (logname); log->fd = fopen (log->name, "w"); - if (log->fd == 0) + if (log->fd == NULL) { ERROR_MSG (_("Warning: could not open temporary log file, Aborting...")); mem_free (log); @@ -2871,7 +2871,7 @@ io_log_display (struct io_file *log, char *msg, char *pager) char *choices = "[y/n] "; int ans; - RETURN_IF (log == 0, _("No log file to display!")); + RETURN_IF (log == NULL, _("No log file to display!")); if (ui_mode == UI_CMDLINE) { printf ("\n%s %s", msg, choices); @@ -3030,7 +3030,7 @@ io_get_pid (char *file) if (!file) return 0; - if ((fp = fopen (file, "r")) == 0) + if ((fp = fopen (file, "r")) == NULL) return 0; if (fscanf (fp, "%u", &pid) != 1) diff --git a/src/keys.c b/src/keys.c index 792a8ad..916d4e8 100644 --- a/src/keys.c +++ b/src/keys.c @@ -145,7 +145,7 @@ keys_free (void) for (key = 0; key < NBKEYS; key++) { - if (keys[key] == 0) + if (keys[key] == NULL) continue; i = &keys[key]; @@ -607,7 +607,7 @@ keys_check_missing_bindings (void) for (i = 0; i < NBKEYS; i++) { - if (keys[i] == 0) + if (keys[i] == NULL) return 1; } return 0; @@ -620,7 +620,7 @@ keys_fill_missing (void) for (i = 0; i < NBKEYS; i++) { - if (keys[i] == 0) + if (keys[i] == NULL) { char *p, tmpbuf[BUFSIZ]; diff --git a/src/mem.c b/src/mem.c index f719f36..ac43103 100644 --- a/src/mem.c +++ b/src/mem.c @@ -74,7 +74,7 @@ stats_add_blk (size_t size, const char *pos) struct mem_blk *o, **i; o = malloc (sizeof (*o)); - EXIT_IF (o == 0, _("could not allocate memory to store block info")); + EXIT_IF (o == NULL, _("could not allocate memory to store block info")); mstats.ncall++; @@ -120,7 +120,7 @@ xmalloc (size_t size) EXIT_IF (size == 0, _("xmalloc: zero size")); p = malloc (size); - EXIT_IF (p == 0, _("xmalloc: out of memory")); + EXIT_IF (p == NULL, _("xmalloc: out of memory")); return p; } @@ -133,7 +133,7 @@ xcalloc (size_t nmemb, size_t size) EXIT_IF (nmemb == 0 || size == 0, _("xcalloc: zero size")); EXIT_IF (SIZE_MAX / nmemb < size, _("xcalloc: overflow")); p = calloc (nmemb, size); - EXIT_IF (p == 0, _("xcalloc: out of memory")); + EXIT_IF (p == NULL, _("xcalloc: out of memory")); return p; } @@ -148,7 +148,7 @@ xrealloc (void *ptr, size_t nmemb, size_t size) EXIT_IF (new_size == 0, _("xrealloc: zero size")); EXIT_IF (SIZE_MAX / nmemb < size, _("xrealloc: overflow")); new_ptr = realloc (ptr, new_size); - EXIT_IF (new_ptr == 0, _("xrealloc: out of memory")); + EXIT_IF (new_ptr == NULL, _("xrealloc: out of memory")); return new_ptr; } @@ -168,7 +168,7 @@ xstrdup (const char *str) void xfree (void *p) { - EXIT_IF (p == 0, _("xfree: null pointer")); + EXIT_IF (p == NULL, _("xfree: null pointer")); free (p); } @@ -204,7 +204,7 @@ dbg_calloc (size_t nmemb, size_t size, const char *pos) EXIT_IF (nmemb > SIZE_MAX / size, _("overflow at %s"), pos); size *= nmemb; - if ((buf = dbg_malloc (size, pos)) == 0) + if ((buf = dbg_malloc (size, pos)) == NULL) return (void *)0; bzero (buf, size); @@ -217,7 +217,7 @@ dbg_realloc (void *ptr, size_t nmemb, size_t size, const char *pos) { unsigned *buf, old_size, new_size, cpy_size; - if (ptr == 0) + if (ptr == NULL) return (void *)0; new_size = nmemb *size; @@ -226,7 +226,7 @@ dbg_realloc (void *ptr, size_t nmemb, size_t size, const char *pos) EXIT_IF (nmemb > SIZE_MAX / size, _("overflow at %s"), pos); - if ((buf = dbg_malloc (new_size, pos)) == 0) + if ((buf = dbg_malloc (new_size, pos)) == NULL) return (void *)0; old_size = *((unsigned *)ptr - EXTRA_SPACE_START + BLK_SIZE); @@ -244,11 +244,11 @@ dbg_strdup (const char *s, const char *pos) size_t size; char *buf; - if (s == 0) + if (s == NULL) return (char *)0; size = strlen (s); - if ((buf = dbg_malloc (size + 1, pos)) == 0) + if ((buf = dbg_malloc (size + 1, pos)) == NULL) return (char *)0; return strncpy (buf, s, size + 1); @@ -259,7 +259,7 @@ dbg_free (void *ptr, const char *pos) { unsigned *buf, size; - EXIT_IF (ptr == 0, _("dbg_free: null pointer at %s"), pos); + EXIT_IF (ptr == NULL, _("dbg_free: null pointer at %s"), pos); buf = (unsigned *)ptr - EXTRA_SPACE_START; size = buf[BLK_SIZE]; @@ -286,7 +286,7 @@ dbg_free (void *ptr, const char *pos) static void dump_block_info (struct mem_blk *blk) { - if (blk == 0) + if (blk == NULL) return; printf (_("---==== MEMORY BLOCK ====----------------\n")); diff --git a/src/recur.c b/src/recur.c index a4932a1..2a08cd1 100644 --- a/src/recur.c +++ b/src/recur.c @@ -72,7 +72,7 @@ recur_add_exc (struct days **exc, long day) i = exc; for (;;) { - if (*i == 0 || (*i)->st > day) + if (*i == NULL || (*i)->st > day) { o->next = *i; *i = o; @@ -243,7 +243,7 @@ recur_apoint_new (char *mesg, char *note, long start, long dur, char state, o = mem_malloc (sizeof (struct recur_apoint)); o->rpt = mem_malloc (sizeof (struct rpt)); o->mesg = mem_strdup (mesg); - o->note = (note != 0) ? mem_strdup (note) : 0; + o->note = (note != NULL) ? mem_strdup (note) : 0; o->start = start; o->state = state; o->dur = dur; @@ -262,7 +262,7 @@ recur_apoint_new (char *mesg, char *note, long start, long dur, char state, i = &recur_alist_p->root; for (;;) { - if (*i == 0 || (*i)->start > start) + if (*i == NULL || (*i)->start > start) { o->next = *i; *i = o; @@ -285,7 +285,7 @@ recur_event_new (char *mesg, char *note, long day, int id, int type, int freq, o = mem_malloc (sizeof (struct recur_event)); o->rpt = mem_malloc (sizeof (struct rpt)); o->mesg = mem_strdup (mesg); - o->note = (note != 0) ? mem_strdup (note) : 0; + o->note = (note != NULL) ? mem_strdup (note) : 0; o->day = day; o->id = id; o->rpt->type = type; @@ -302,7 +302,7 @@ recur_event_new (char *mesg, char *note, long day, int id, int type, int freq, i = &recur_elist; for (;;) { - if (*i == 0 || (*i)->day > day) + if (*i == NULL || (*i)->day > day) { o->next = *i; *i = o; @@ -510,7 +510,7 @@ recur_apoint_write (struct recur_apoint *o, FILE *f) o->rpt->freq, recur_def2char (o->rpt->type), lt->tm_mon + 1, lt->tm_mday, 1900 + lt->tm_year); } - if (o->exc != 0) + if (o->exc != NULL) recur_write_exc (o->exc, f); (void)fprintf (f, "} "); if (o->note != NULL) @@ -554,7 +554,7 @@ recur_event_write (struct recur_event *o, FILE *f) o->rpt->freq, recur_def2char (o->rpt->type), end_mon, end_day, end_year); } - if (o->exc != 0) + if (o->exc != NULL) recur_write_exc (o->exc, f); (void)fprintf (f, "} "); if (o->note != NULL) @@ -569,11 +569,11 @@ recur_save_data (FILE *f) struct recur_event *re; struct recur_apoint *ra; - for (re = recur_elist; re != 0; re = re->next) + for (re = recur_elist; re != NULL; re = re->next) recur_event_write (re, f); pthread_mutex_lock (&(recur_alist_p->mutex)); - for (ra = recur_alist_p->root; ra != 0; ra = ra->next) + for (ra = recur_alist_p->root; ra != NULL; ra = ra->next) recur_apoint_write (ra, f); pthread_mutex_unlock (&(recur_alist_p->mutex)); } @@ -665,7 +665,7 @@ recur_item_inday (long item_start, struct days *item_exc, int rpt_type, t = day_start; lt_day = *localtime (&t); - for (exc = item_exc; exc != 0; exc = exc->next) + for (exc = item_exc; exc != NULL; exc = exc->next) if (exc->st < day_end && exc->st >= day_start) return (0); @@ -740,7 +740,7 @@ recur_event_erase (long start, unsigned num, unsigned delete_whole, struct recur_event *i, **iptr; iptr = &recur_elist; - for (i = recur_elist; i != 0; i = i->next) + for (i = recur_elist; i != NULL; i = i->next) { if (recur_item_inday (i->day, i->exc, i->rpt->type, i->rpt->freq, i->rpt->until, start)) @@ -807,7 +807,7 @@ recur_apoint_erase (long start, unsigned num, unsigned delete_whole, pthread_mutex_lock (&(recur_alist_p->mutex)); iptr = &recur_alist_p->root; - for (i = recur_alist_p->root; i != 0; i = i->next) + for (i = recur_alist_p->root; i != NULL; i = i->next) { if (recur_item_inday (i->start, i->exc, i->rpt->type, i->rpt->freq, i->rpt->until, start)) @@ -1061,7 +1061,7 @@ recur_apoint_check_next (struct notify_app *app, long start, long day) long real_recur_start_time; pthread_mutex_lock (&(recur_alist_p->mutex)); - for (i = recur_alist_p->root; i != 0; i = i->next) + for (i = recur_alist_p->root; i != NULL; i = i->next) { if (i->start > app->time) { @@ -1095,7 +1095,7 @@ recur_get_apoint (long date, int num) int n = 0; pthread_mutex_lock (&(recur_alist_p->mutex)); - for (o = recur_alist_p->root; o != 0; o = o->next) + for (o = recur_alist_p->root; o != NULL; o = o->next) { if (recur_item_inday (o->start, o->exc, o->rpt->type, o->rpt->freq, o->rpt->until, date)) @@ -1120,7 +1120,7 @@ recur_get_event (long date, int num) struct recur_event *o; int n = 0; - for (o = recur_elist; o != 0; o = o->next) + for (o = recur_elist; o != NULL; o = o->next) { if (recur_item_inday (o->day, o->exc, o->rpt->type, o->rpt->freq, o->rpt->until, date)) @@ -1148,7 +1148,7 @@ recur_apoint_switch_notify (long date, int recur_nb) need_chk_notify = 0; pthread_mutex_lock (&(recur_alist_p->mutex)); - for (o = recur_alist_p->root; o != 0; o = o->next) + for (o = recur_alist_p->root; o != NULL; o = o->next) { if (recur_item_inday (o->start, o->exc, o->rpt->type, o->rpt->freq, o->rpt->until, date)) @@ -1187,7 +1187,7 @@ recur_event_paste_item (void) { struct days *exc; - for (exc = bkp_cut_recur_event.exc; exc != 0; exc = exc->next) + for (exc = bkp_cut_recur_event.exc; exc != NULL; exc = exc->next) exc->st += time_shift; } @@ -1217,7 +1217,7 @@ recur_apoint_paste_item (void) { struct days *exc; - for (exc = bkp_cut_recur_apoint.exc; exc != 0; exc = exc->next) + for (exc = bkp_cut_recur_apoint.exc; exc != NULL; exc = exc->next) exc->st += time_shift; } diff --git a/src/todo.c b/src/todo.c index 8d7a4d5..4076510 100644 --- a/src/todo.c +++ b/src/todo.c @@ -182,7 +182,7 @@ todo_add (char *mesg, int id, char *note) absid = abs (id); for (;;) { - if (*i == 0 || abs ((*i)->id) > absid) + if (*i == NULL || abs ((*i)->id) > absid) { o->next = *i; *i = o; @@ -201,7 +201,7 @@ todo_delete_note_bynum (unsigned num) struct todo *i; n = 0; - for (i = todolist; i != 0; i = i->next) + for (i = todolist; i != NULL; i = i->next) { if (n == num) { @@ -225,7 +225,7 @@ todo_delete_bynum (unsigned num, enum eraseflg flag) n = 0; iptr = &todolist; - for (i = todolist; i != 0; i = i->next) + for (i = todolist; i != NULL; i = i->next) { if (n == num) { @@ -451,7 +451,7 @@ todo_update_panel (int which_pan) /* Print todo item in the panel. */ erase_window_part (win[TOD].p, 1, title_lines, win[TOD].w - 2, win[TOD].h - 2); - for (i = todolist; i != 0; i = i->next) + for (i = todolist; i != NULL; i = i->next) { num_todo++; t_realpos = num_todo - first; diff --git a/src/utils.c b/src/utils.c index 8e4a447..d21debe 100644 --- a/src/utils.c +++ b/src/utils.c @@ -110,7 +110,7 @@ fatalbox (const char *errmsg) const int MSGLEN = WINCOL - 2; char msg[MSGLEN]; - if (errmsg == 0) + if (errmsg == NULL) return; (void)strncpy (msg, errmsg, MSGLEN); @@ -137,7 +137,7 @@ warnbox (const char *msg) const int MSGLEN = WINCOL - 2; char displmsg[MSGLEN]; - if (msg == 0) + if (msg == NULL) return; (void)strncpy (displmsg, msg, MSGLEN); @@ -405,7 +405,7 @@ updatestring (WINDOW *win, char **str, int x, int y) { len = strlen (buf); *str = mem_realloc (*str, len + 1, 1); - EXIT_IF (*str == 0, _("out of memory")); + EXIT_IF (*str == NULL, _("out of memory")); (void)memcpy (*str, buf, len + 1); } diff --git a/src/wins.c b/src/wins.c index ca5171f..a9e93e0 100644 --- a/src/wins.c +++ b/src/wins.c @@ -266,7 +266,7 @@ wins_init (void) void wins_scrollwin_init (struct scrollwin *sw) { - EXIT_IF (sw == 0, "null pointer"); + EXIT_IF (sw == NULL, "null pointer"); sw->win.p = newwin (sw->win.h, sw->win.w, sw->win.y, sw->win.x); sw->pad.p = newpad (sw->pad.h, sw->pad.w); sw->first_visible_line = 0; @@ -277,7 +277,7 @@ wins_scrollwin_init (struct scrollwin *sw) void wins_scrollwin_delete (struct scrollwin *sw) { - EXIT_IF (sw == 0, "null pointer"); + EXIT_IF (sw == NULL, "null pointer"); delwin(sw->win.p); delwin(sw->pad.p); } -- cgit v1.2.3-54-g00ecf