From 6f01c7af972dbf4698c63b707b225469b9405e47 Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Wed, 2 Nov 2011 19:30:54 +0100 Subject: Remove parentheses from return statements No reason to use "return (x);" here. Refer to the GNU coding guidelines for details. Created using following semantic patch: @@ expression expr; @@ - return (expr); + return expr; Signed-off-by: Lukas Fleischer --- src/apoint.c | 16 ++++++++-------- src/args.c | 4 ++-- src/calendar.c | 24 ++++++++++++------------ src/custom.c | 2 +- src/day.c | 18 +++++++++--------- src/event.c | 6 +++--- src/getstring.c | 4 ++-- src/help.c | 2 +- src/io.c | 4 ++-- src/notify.c | 2 +- src/recur.c | 48 ++++++++++++++++++++++++------------------------ src/todo.c | 10 +++++----- src/utils.c | 18 +++++++++--------- src/wins.c | 2 +- 14 files changed, 80 insertions(+), 80 deletions(-) diff --git a/src/apoint.c b/src/apoint.c index 979f192..1ca6639 100644 --- a/src/apoint.c +++ b/src/apoint.c @@ -118,13 +118,13 @@ apoint_hilt_increase (int n) int apoint_hilt (void) { - return (hilt); + return hilt; } static int apoint_cmp_start (struct apoint *a, struct apoint *b) { - return (a->start < b->start ? -1 : (a->start == b->start ? 0 : 1)); + return a->start < b->start ? -1 : (a->start == b->start ? 0 : 1); } struct apoint * @@ -383,9 +383,9 @@ apoint_inday (struct apoint *i, long start) { if (i->start <= start + DAYINSEC && i->start + i->dur > start) { - return (1); + return 1; } - return (0); + return 0; } void @@ -465,7 +465,7 @@ apoint_scan (FILE *f, struct tm start, struct tm end, char state, char *note) tend = mktime (&end); EXIT_IF (tstart == -1 || tend == -1 || tstart > tend, _("date error in appointment")); - return (apoint_new (buf, note, tstart, tend - tstart, state)); + return apoint_new (buf, note, tstart, tend - tstart, state); } /* Retrieve an appointment from the list, given the day and item position. */ @@ -576,7 +576,7 @@ apoint_scroll_pad_up (int nb_events_inday) static int apoint_starts_after (struct apoint *apt, long time) { - return (apt->start > time); + return apt->start > time; } /* @@ -606,7 +606,7 @@ apoint_check_next (struct notify_app *app, long start) LLIST_TS_UNLOCK (&alist_p); - return (app); + return app; } /* @@ -622,7 +622,7 @@ apoint_recur_s2apoint_s (struct recur_apoint *p) a->mesg = mem_strdup (p->mesg); a->start = p->start; a->dur = p->dur; - return (a); + return a; } /* diff --git a/src/args.c b/src/args.c index be85fbe..c4e4d5c 100644 --- a/src/args.c +++ b/src/args.c @@ -515,7 +515,7 @@ app_arg (int add_line, struct date *day, long date, int print_note, LLIST_TS_UNLOCK (&recur_alist_p); LLIST_TS_UNLOCK (&alist_p); - return (app_found); + return app_found; } static void @@ -815,7 +815,7 @@ parse_args (int argc, char **argv, struct conf *conf) { usage (); usage_try (); - return (EXIT_FAILURE); + return EXIT_FAILURE; } } else diff --git a/src/calendar.c b/src/calendar.c index 7d54d10..160630e 100644 --- a/src/calendar.c +++ b/src/calendar.c @@ -195,7 +195,7 @@ calendar_change_first_day_of_week (void) unsigned calendar_week_begins_on_monday (void) { - return (week_begins_on_monday); + return week_begins_on_monday; } /* Fill in the given variable with the current date. */ @@ -218,14 +218,14 @@ calendar_init_slctd_day (void) struct date * calendar_get_slctd_day (void) { - return (&slctd_day); + return &slctd_day; } /* Returned value represents the selected day in calendar (in seconds) */ long calendar_get_slctd_day_sec (void) { - return (date2sec (slctd_day, 0, 0)); + return date2sec (slctd_day, 0, 0); } static int @@ -246,14 +246,14 @@ calendar_get_wday (struct date *date) static unsigned months_to_days (unsigned month) { - return ((month * 3057 - 3007) / 100); + return (month * 3057 - 3007) / 100; } static long years_to_days (unsigned year) { - return (year * 365L + year / 4 - year / 100 + year / 400); + return year * 365L + year / 4 - year / 100 + year / 400; } static long @@ -267,7 +267,7 @@ ymd_to_scalar (unsigned year, unsigned month, unsigned day) year--; scalar += years_to_days (year); - return (scalar); + return scalar; } /* @@ -284,11 +284,11 @@ date_change (struct tm *date, int delta_month, int delta_day) t.tm_mday += delta_day; if (mktime (&t) == -1) - return (1); + return 1; else { *date = t; - return (0); + return 0; } } @@ -815,7 +815,7 @@ calendar_end_of_year (void) static double dtor (double deg) { - return (deg * M_PI / 180); + return deg * M_PI / 180; } /* @@ -867,7 +867,7 @@ potm (double days) V = 0.6583 * sin (dtor (2 * (lprime - LambdaSol))); /* sec 65 #13 */ ldprime = lprime + V; /* sec 65 #14 */ D = ldprime - LambdaSol; /* sec 67 #2 */ - return (50.0 * (1 - cos (dtor (D)))); /* sec 67 #3 */ + return 50.0 * (1 - cos (dtor (D))); /* sec 67 #3 */ } /* @@ -897,7 +897,7 @@ pom (time_t tmpt) for (cnt = GMT->tm_year; cnt < EPOCH; ++cnt) days -= ISLEAP (cnt + TM_YEAR_BASE) ? 366 : 365; - return (potm (days)); + return potm (days); } /* @@ -925,5 +925,5 @@ calendar_get_pom (time_t date) && relative_pom < abs (pom_tomorrow - half)) phase = (pom_tomorrow > pom_today) ? FIRST_QUARTER : LAST_QUARTER; - return (pom_pict[phase]); + return pom_pict[phase]; } diff --git a/src/custom.c b/src/custom.c index 5aae821..5700640 100644 --- a/src/custom.c +++ b/src/custom.c @@ -346,7 +346,7 @@ custom_set_conf (struct conf *conf, enum conf_var var, char *val) strncpy (nbar.cmd, val, strlen (val) + 1); break; case CUSTOM_CONF_NOTIFYALL: - return conf_parse_bool (&nbar.notify_all, val); + return conf_parse_bool(&nbar.notify_all, val); break; case CUSTOM_CONF_OUTPUTDATEFMT: if (val[0] != '\0') diff --git a/src/day.c b/src/day.c index 066af8c..2464653 100644 --- a/src/day.c +++ b/src/day.c @@ -110,7 +110,7 @@ day_cmp_start (struct day_item *a, struct day_item *b) else if (b->type <= EVNT) return 1; else - return (a->start < b->start ? -1 : (a->start == b->start ? 0 : 1)); + return a->start < b->start ? -1 : (a->start == b->start ? 0 : 1); } /* Add an appointment in the current day list. */ @@ -477,28 +477,28 @@ day_check_if_item (struct date day) const long date = date2sec (day, 0, 0); if (LLIST_FIND_FIRST (&recur_elist, date, recur_event_inday)) - return (1); + return 1; LLIST_TS_LOCK (&recur_alist_p); if (LLIST_TS_FIND_FIRST (&recur_alist_p, date, recur_apoint_inday)) { LLIST_TS_UNLOCK (&recur_alist_p); - return (1); + return 1; } LLIST_TS_UNLOCK (&recur_alist_p); if (LLIST_FIND_FIRST (&eventlist, date, event_inday)) - return (1); + return 1; LLIST_TS_LOCK (&alist_p); if (LLIST_TS_FIND_FIRST (&alist_p, date, apoint_inday)) { LLIST_TS_UNLOCK (&alist_p); - return (1); + return 1; } LLIST_TS_UNLOCK (&alist_p); - return (0); + return 0; } static unsigned @@ -976,7 +976,7 @@ day_erase_item (long date, int item_number, enum eraseflg flag) } else { - return (0); + return 0; } if (p->type == RECUR_EVNT) { @@ -991,7 +991,7 @@ day_erase_item (long date, int item_number, enum eraseflg flag) if (flag == ERASE_FORCE_ONLY_NOTE) return 0; else - return (p->type); + return p->type; } /* Cut an item so it can be pasted somewhere else later. */ @@ -1083,7 +1083,7 @@ day_item_nb (long date, int day_num, int type) j = LLIST_TS_NEXT (j); } - return (nb_item[type - 1]); + return nb_item[type - 1]; } /* Attach a note to an appointment or event. */ diff --git a/src/event.c b/src/event.c index f0435e9..64bc3eb 100644 --- a/src/event.c +++ b/src/event.c @@ -91,7 +91,7 @@ event_llist_free (void) static int event_cmp_day (struct event *a, struct event *b) { - return (a->day < b->day ? -1 : (a->day == b->day ? 0 : 1)); + return a->day < b->day ? -1 : (a->day == b->day ? 0 : 1); } /* Create a new event */ @@ -117,9 +117,9 @@ event_inday (struct event *i, long start) { if (i->day < start + DAYINSEC && i->day >= start) { - return (1); + return 1; } - return (0); + return 0; } /* Write to file the event in user-friendly format */ diff --git a/src/getstring.c b/src/getstring.c index 37d6fdc..29ca82b 100644 --- a/src/getstring.c +++ b/src/getstring.c @@ -252,7 +252,7 @@ getstring (WINDOW *win, char *str, int l, int x, int y) if (st.pos < st.len) st.pos++; break; case ESCAPE: /* cancel editing */ - return (GETSTRING_ESC); + return GETSTRING_ESC; break; default: /* insert one character */ c[0] = ch; @@ -268,7 +268,7 @@ getstring (WINDOW *win, char *str, int l, int x, int y) custom_remove_attr (win, ATTR_HIGHEST); - return (st.len == 0 ? GETSTRING_RET : GETSTRING_VALID); + return st.len == 0 ? GETSTRING_RET : GETSTRING_VALID; } /* Update an already existing string. */ diff --git a/src/help.c b/src/help.c index 2b84e9e..eaca14b 100644 --- a/src/help.c +++ b/src/help.c @@ -319,7 +319,7 @@ wanted_page (int ch) break; } - return (page); + return page; } /* Draws the help screen */ diff --git a/src/io.c b/src/io.c index b96d452..6e3bf38 100644 --- a/src/io.c +++ b/src/io.c @@ -227,7 +227,7 @@ get_export_stream (enum export_type type) if (cancel) { mem_free (stream_name); - return (NULL); + return NULL; } stream = fopen (stream_name, "w"); if (stream == NULL) @@ -238,7 +238,7 @@ get_export_stream (enum export_type type) } mem_free (stream_name); - return (stream); + return stream; } /* diff --git a/src/notify.c b/src/notify.c index eaf9805..ae9bcbe 100644 --- a/src/notify.c +++ b/src/notify.c @@ -112,7 +112,7 @@ notify_bar (void) display_bar = (nbar.show) ? 1 : 0; pthread_mutex_unlock (&nbar.mutex); - return (display_bar); + return display_bar; } /* Initialize the nbar variable used to store notification options. */ diff --git a/src/recur.c b/src/recur.c index b91ce26..f8f04e0 100644 --- a/src/recur.c +++ b/src/recur.c @@ -63,7 +63,7 @@ free_exc_list (llist_t *exc) static int exc_cmp_day (struct excp *a, struct excp *b) { - return (a->st < b->st ? -1 : (a->st == b->st ? 0 : 1)); + return a->st < b->st ? -1 : (a->st == b->st ? 0 : 1); } static void @@ -214,13 +214,13 @@ recur_event_llist_free (void) static int recur_apoint_cmp_start (struct recur_apoint *a, struct recur_apoint *b) { - return (a->start < b->start ? -1 : (a->start == b->start ? 0 : 1)); + return a->start < b->start ? -1 : (a->start == b->start ? 0 : 1); } static int recur_event_cmp_day (struct recur_event *a, struct recur_event *b) { - return (a->day < b->day ? -1 : (a->day == b->day ? 0 : 1)); + return a->day < b->day ? -1 : (a->day == b->day ? 0 : 1); } /* Insert a new recursive appointment in the general linked list */ @@ -310,7 +310,7 @@ recur_def2char (enum recur_type define) return 0; } - return (recur_char); + return recur_char; } /* @@ -340,7 +340,7 @@ recur_char2def (char type) EXIT (_("unknown character")); return 0; } - return (recur_def); + return recur_def; } /* Write days for which recurrent items should not be repeated. */ @@ -406,8 +406,8 @@ recur_apoint_scan (FILE *f, struct tm start, struct tm end, char type, EXIT_IF (tstart == -1 || tend == -1 || tstart > tend || tuntil == -1, _("date error in appointment")); - return (recur_apoint_new (buf, note, tstart, tend - tstart, state, - recur_char2def (type), freq, tuntil, exc)); + return recur_apoint_new (buf, note, tstart, tend - tstart, state, + recur_char2def(type), freq, tuntil, exc); } /* Load the recursive events from file */ @@ -445,8 +445,8 @@ recur_event_scan (FILE *f, struct tm start, int id, char type, int freq, EXIT_IF (tstart == -1 || tuntil == -1, _("date error in event")); - return recur_event_new (buf, note, tstart, id, recur_char2def (type), - freq, tuntil, exc); + return recur_event_new (buf, note, tstart, id, recur_char2def(type), freq, + tuntil, exc); } /* Writting of a recursive appointment into file. */ @@ -607,7 +607,7 @@ diff_years (struct tm lt_start, struct tm lt_end) static int exc_inday (struct excp *exc, long day_start) { - return (exc->st >= day_start && exc->st < day_start + DAYINSEC); + return exc->st >= day_start && exc->st < day_start + DAYINSEC; } /* @@ -712,18 +712,18 @@ unsigned recur_apoint_find_occurrence (struct recur_apoint *rapt, long day_start, unsigned *occurrence) { - return recur_item_find_occurrence (rapt->start, rapt->dur, &rapt->exc, - rapt->rpt->type, rapt->rpt->freq, - rapt->rpt->until, day_start, occurrence); + return recur_item_find_occurrence(rapt->start, rapt->dur, &rapt->exc, + rapt->rpt->type, rapt->rpt->freq, + rapt->rpt->until, day_start, occurrence); } unsigned recur_event_find_occurrence (struct recur_event *rev, long day_start, unsigned *occurrence) { - return recur_item_find_occurrence (rev->day, DAYINSEC, &rev->exc, - rev->rpt->type, rev->rpt->freq, - rev->rpt->until, day_start, occurrence); + return recur_item_find_occurrence(rev->day, DAYINSEC, &rev->exc, + rev->rpt->type, rev->rpt->freq, + rev->rpt->until, day_start, occurrence); } /* Check if a recurrent item belongs to the selected day. */ @@ -733,22 +733,22 @@ recur_item_inday (long item_start, long item_dur, llist_t *item_exc, { /* We do not need the (real) start time of the occurrence here, so just * ignore the buffer. */ - return recur_item_find_occurrence (item_start, item_dur, item_exc, rpt_type, - rpt_freq, rpt_until, day_start, NULL); + return recur_item_find_occurrence(item_start, item_dur, item_exc, rpt_type, + rpt_freq, rpt_until, day_start, NULL); } unsigned recur_apoint_inday(struct recur_apoint *rapt, long day_start) { - return recur_item_inday (rapt->start, rapt->dur, &rapt->exc, rapt->rpt->type, - rapt->rpt->freq, rapt->rpt->until, day_start); + return recur_item_inday(rapt->start, rapt->dur, &rapt->exc, rapt->rpt->type, + rapt->rpt->freq, rapt->rpt->until, day_start); } unsigned recur_event_inday(struct recur_event *rev, long day_start) { - return recur_item_inday (rev->day, DAYINSEC, &rev->exc, rev->rpt->type, - rev->rpt->freq, rev->rpt->until, day_start); + return recur_item_inday(rev->day, DAYINSEC, &rev->exc, rev->rpt->type, + rev->rpt->freq, rev->rpt->until, day_start); } /* @@ -1034,7 +1034,7 @@ recur_exc_scan (llist_t *lexc, FILE *data_file) static int recur_apoint_starts_before (struct recur_apoint *rapt, long time) { - return (rapt->start < time); + return rapt->start < time; } /* @@ -1063,7 +1063,7 @@ recur_apoint_check_next (struct notify_app *app, long start, long day) } LLIST_TS_UNLOCK (&recur_alist_p); - return (app); + return app; } /* Returns a structure containing the selected recurrent appointment. */ diff --git a/src/todo.c b/src/todo.c index bb72cc0..b89d595 100644 --- a/src/todo.c +++ b/src/todo.c @@ -76,14 +76,14 @@ todo_hilt_increase (int n) int todo_hilt (void) { - return (hilt); + return hilt; } /* Return the number of todos. */ int todo_nb (void) { - return (todos); + return todos; } /* Set the number of todos. */ @@ -119,14 +119,14 @@ todo_first_decrease (int n) int todo_hilt_pos (void) { - return (hilt - first); + return hilt - first; } /* Return the last visited todo. */ char * todo_saved_mesg (void) { - return (msgsav); + return msgsav; } /* Request user to enter a new todo item. */ @@ -162,7 +162,7 @@ todo_cmp_id (struct todo *a, struct todo *b) int abs_a = abs (a->id); int abs_b = abs (b->id); - return (abs_a < abs_b ? -1 : (abs_a == abs_b ? 0 : 1)); + return abs_a < abs_b ? -1 : (abs_a == abs_b ? 0 : 1); } /* diff --git a/src/utils.c b/src/utils.c index d4390cd..3c7f595 100644 --- a/src/utils.c +++ b/src/utils.c @@ -249,8 +249,8 @@ is_all_digit (char *string) long get_item_time (long date) { - return (long)(get_item_hour (date) * HOURINSEC + - get_item_min (date) * MININSEC); + return (long)(get_item_hour(date) * HOURINSEC + + get_item_min(date) * MININSEC); } int @@ -348,7 +348,7 @@ update_time_in_date (long date, unsigned hr, unsigned mn) new_date = mktime (lt); EXIT_IF (new_date == -1, _("error in mktime")); - return (new_date); + return new_date; } /* @@ -377,13 +377,13 @@ get_sec_date (struct date date) date.yyyy = atoi (current_year); } long_date = date2sec (date, 0, 0); - return (long_date); + return long_date; } long min2sec (unsigned minutes) { - return (minutes * MININSEC); + return minutes * MININSEC; } /* @@ -450,7 +450,7 @@ get_today (void) day.yyyy = lt->tm_year + 1900; current_day = date2sec (day, 0, 0); - return (current_day); + return current_day; } /* Returns the current time in seconds. */ @@ -484,7 +484,7 @@ mystrtol (const char *str) if (errno == ERANGE && (lval == LONG_MAX || lval == LONG_MIN)) EXIT (_("out of range")); - return (lval); + return lval; } /* Print the given option value with appropriate color. */ @@ -541,11 +541,11 @@ new_tempfile (const char *prefix, int trailing_len) FILE *file; if (prefix == NULL) - return (NULL); + return NULL; prefix_len = strlen (prefix); if (prefix_len + trailing_len >= BUFSIZ) - return (NULL); + return NULL; memcpy (fullname, prefix, prefix_len); memset (fullname + prefix_len, 'X', trailing_len); fullname[prefix_len + trailing_len] = '\0'; diff --git a/src/wins.c b/src/wins.c index a3ce763..0cbe95a 100644 --- a/src/wins.c +++ b/src/wins.c @@ -201,7 +201,7 @@ wins_slctd_init (void) enum win wins_slctd (void) { - return (slctd_win); + return slctd_win; } /* Sets the selected window. */ -- cgit v1.2.3-70-g09d2