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 <calcurse@cryptocrack.de>
This commit is contained in:
parent
ce3f0ce76f
commit
6f01c7af97
16
src/apoint.c
16
src/apoint.c
@ -118,13 +118,13 @@ apoint_hilt_increase (int n)
|
|||||||
int
|
int
|
||||||
apoint_hilt (void)
|
apoint_hilt (void)
|
||||||
{
|
{
|
||||||
return (hilt);
|
return hilt;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
apoint_cmp_start (struct apoint *a, struct apoint *b)
|
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 *
|
struct apoint *
|
||||||
@ -383,9 +383,9 @@ apoint_inday (struct apoint *i, long start)
|
|||||||
{
|
{
|
||||||
if (i->start <= start + DAYINSEC && i->start + i->dur > start)
|
if (i->start <= start + DAYINSEC && i->start + i->dur > start)
|
||||||
{
|
{
|
||||||
return (1);
|
return 1;
|
||||||
}
|
}
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -465,7 +465,7 @@ apoint_scan (FILE *f, struct tm start, struct tm end, char state, char *note)
|
|||||||
tend = mktime (&end);
|
tend = mktime (&end);
|
||||||
EXIT_IF (tstart == -1 || tend == -1 || tstart > tend,
|
EXIT_IF (tstart == -1 || tend == -1 || tstart > tend,
|
||||||
_("date error in appointment"));
|
_("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. */
|
/* 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
|
static int
|
||||||
apoint_starts_after (struct apoint *apt, long time)
|
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);
|
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->mesg = mem_strdup (p->mesg);
|
||||||
a->start = p->start;
|
a->start = p->start;
|
||||||
a->dur = p->dur;
|
a->dur = p->dur;
|
||||||
return (a);
|
return a;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -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 (&recur_alist_p);
|
||||||
LLIST_TS_UNLOCK (&alist_p);
|
LLIST_TS_UNLOCK (&alist_p);
|
||||||
|
|
||||||
return (app_found);
|
return app_found;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -815,7 +815,7 @@ parse_args (int argc, char **argv, struct conf *conf)
|
|||||||
{
|
{
|
||||||
usage ();
|
usage ();
|
||||||
usage_try ();
|
usage_try ();
|
||||||
return (EXIT_FAILURE);
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -195,7 +195,7 @@ calendar_change_first_day_of_week (void)
|
|||||||
unsigned
|
unsigned
|
||||||
calendar_week_begins_on_monday (void)
|
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. */
|
/* Fill in the given variable with the current date. */
|
||||||
@ -218,14 +218,14 @@ calendar_init_slctd_day (void)
|
|||||||
struct date *
|
struct date *
|
||||||
calendar_get_slctd_day (void)
|
calendar_get_slctd_day (void)
|
||||||
{
|
{
|
||||||
return (&slctd_day);
|
return &slctd_day;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Returned value represents the selected day in calendar (in seconds) */
|
/* Returned value represents the selected day in calendar (in seconds) */
|
||||||
long
|
long
|
||||||
calendar_get_slctd_day_sec (void)
|
calendar_get_slctd_day_sec (void)
|
||||||
{
|
{
|
||||||
return (date2sec (slctd_day, 0, 0));
|
return date2sec (slctd_day, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -246,14 +246,14 @@ calendar_get_wday (struct date *date)
|
|||||||
static unsigned
|
static unsigned
|
||||||
months_to_days (unsigned month)
|
months_to_days (unsigned month)
|
||||||
{
|
{
|
||||||
return ((month * 3057 - 3007) / 100);
|
return (month * 3057 - 3007) / 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static long
|
static long
|
||||||
years_to_days (unsigned year)
|
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
|
static long
|
||||||
@ -267,7 +267,7 @@ ymd_to_scalar (unsigned year, unsigned month, unsigned day)
|
|||||||
year--;
|
year--;
|
||||||
scalar += years_to_days (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;
|
t.tm_mday += delta_day;
|
||||||
|
|
||||||
if (mktime (&t) == -1)
|
if (mktime (&t) == -1)
|
||||||
return (1);
|
return 1;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*date = t;
|
*date = t;
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -815,7 +815,7 @@ calendar_end_of_year (void)
|
|||||||
static double
|
static double
|
||||||
dtor (double deg)
|
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 */
|
V = 0.6583 * sin (dtor (2 * (lprime - LambdaSol))); /* sec 65 #13 */
|
||||||
ldprime = lprime + V; /* sec 65 #14 */
|
ldprime = lprime + V; /* sec 65 #14 */
|
||||||
D = ldprime - LambdaSol; /* sec 67 #2 */
|
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)
|
for (cnt = GMT->tm_year; cnt < EPOCH; ++cnt)
|
||||||
days -= ISLEAP (cnt + TM_YEAR_BASE) ? 366 : 365;
|
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))
|
&& relative_pom < abs (pom_tomorrow - half))
|
||||||
phase = (pom_tomorrow > pom_today) ? FIRST_QUARTER : LAST_QUARTER;
|
phase = (pom_tomorrow > pom_today) ? FIRST_QUARTER : LAST_QUARTER;
|
||||||
|
|
||||||
return (pom_pict[phase]);
|
return pom_pict[phase];
|
||||||
}
|
}
|
||||||
|
18
src/day.c
18
src/day.c
@ -110,7 +110,7 @@ day_cmp_start (struct day_item *a, struct day_item *b)
|
|||||||
else if (b->type <= EVNT)
|
else if (b->type <= EVNT)
|
||||||
return 1;
|
return 1;
|
||||||
else
|
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. */
|
/* 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);
|
const long date = date2sec (day, 0, 0);
|
||||||
|
|
||||||
if (LLIST_FIND_FIRST (&recur_elist, date, recur_event_inday))
|
if (LLIST_FIND_FIRST (&recur_elist, date, recur_event_inday))
|
||||||
return (1);
|
return 1;
|
||||||
|
|
||||||
LLIST_TS_LOCK (&recur_alist_p);
|
LLIST_TS_LOCK (&recur_alist_p);
|
||||||
if (LLIST_TS_FIND_FIRST (&recur_alist_p, date, recur_apoint_inday))
|
if (LLIST_TS_FIND_FIRST (&recur_alist_p, date, recur_apoint_inday))
|
||||||
{
|
{
|
||||||
LLIST_TS_UNLOCK (&recur_alist_p);
|
LLIST_TS_UNLOCK (&recur_alist_p);
|
||||||
return (1);
|
return 1;
|
||||||
}
|
}
|
||||||
LLIST_TS_UNLOCK (&recur_alist_p);
|
LLIST_TS_UNLOCK (&recur_alist_p);
|
||||||
|
|
||||||
if (LLIST_FIND_FIRST (&eventlist, date, event_inday))
|
if (LLIST_FIND_FIRST (&eventlist, date, event_inday))
|
||||||
return (1);
|
return 1;
|
||||||
|
|
||||||
LLIST_TS_LOCK (&alist_p);
|
LLIST_TS_LOCK (&alist_p);
|
||||||
if (LLIST_TS_FIND_FIRST (&alist_p, date, apoint_inday))
|
if (LLIST_TS_FIND_FIRST (&alist_p, date, apoint_inday))
|
||||||
{
|
{
|
||||||
LLIST_TS_UNLOCK (&alist_p);
|
LLIST_TS_UNLOCK (&alist_p);
|
||||||
return (1);
|
return 1;
|
||||||
}
|
}
|
||||||
LLIST_TS_UNLOCK (&alist_p);
|
LLIST_TS_UNLOCK (&alist_p);
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned
|
static unsigned
|
||||||
@ -976,7 +976,7 @@ day_erase_item (long date, int item_number, enum eraseflg flag)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
if (p->type == RECUR_EVNT)
|
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)
|
if (flag == ERASE_FORCE_ONLY_NOTE)
|
||||||
return 0;
|
return 0;
|
||||||
else
|
else
|
||||||
return (p->type);
|
return p->type;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Cut an item so it can be pasted somewhere else later. */
|
/* 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);
|
j = LLIST_TS_NEXT (j);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (nb_item[type - 1]);
|
return nb_item[type - 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Attach a note to an appointment or event. */
|
/* Attach a note to an appointment or event. */
|
||||||
|
@ -91,7 +91,7 @@ event_llist_free (void)
|
|||||||
static int
|
static int
|
||||||
event_cmp_day (struct event *a, struct event *b)
|
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 */
|
/* Create a new event */
|
||||||
@ -117,9 +117,9 @@ event_inday (struct event *i, long start)
|
|||||||
{
|
{
|
||||||
if (i->day < start + DAYINSEC && i->day >= 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 */
|
/* Write to file the event in user-friendly format */
|
||||||
|
@ -252,7 +252,7 @@ getstring (WINDOW *win, char *str, int l, int x, int y)
|
|||||||
if (st.pos < st.len) st.pos++;
|
if (st.pos < st.len) st.pos++;
|
||||||
break;
|
break;
|
||||||
case ESCAPE: /* cancel editing */
|
case ESCAPE: /* cancel editing */
|
||||||
return (GETSTRING_ESC);
|
return GETSTRING_ESC;
|
||||||
break;
|
break;
|
||||||
default: /* insert one character */
|
default: /* insert one character */
|
||||||
c[0] = ch;
|
c[0] = ch;
|
||||||
@ -268,7 +268,7 @@ getstring (WINDOW *win, char *str, int l, int x, int y)
|
|||||||
|
|
||||||
custom_remove_attr (win, ATTR_HIGHEST);
|
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. */
|
/* Update an already existing string. */
|
||||||
|
@ -319,7 +319,7 @@ wanted_page (int ch)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (page);
|
return page;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Draws the help screen */
|
/* Draws the help screen */
|
||||||
|
4
src/io.c
4
src/io.c
@ -227,7 +227,7 @@ get_export_stream (enum export_type type)
|
|||||||
if (cancel)
|
if (cancel)
|
||||||
{
|
{
|
||||||
mem_free (stream_name);
|
mem_free (stream_name);
|
||||||
return (NULL);
|
return NULL;
|
||||||
}
|
}
|
||||||
stream = fopen (stream_name, "w");
|
stream = fopen (stream_name, "w");
|
||||||
if (stream == NULL)
|
if (stream == NULL)
|
||||||
@ -238,7 +238,7 @@ get_export_stream (enum export_type type)
|
|||||||
}
|
}
|
||||||
mem_free (stream_name);
|
mem_free (stream_name);
|
||||||
|
|
||||||
return (stream);
|
return stream;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -112,7 +112,7 @@ notify_bar (void)
|
|||||||
display_bar = (nbar.show) ? 1 : 0;
|
display_bar = (nbar.show) ? 1 : 0;
|
||||||
pthread_mutex_unlock (&nbar.mutex);
|
pthread_mutex_unlock (&nbar.mutex);
|
||||||
|
|
||||||
return (display_bar);
|
return display_bar;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize the nbar variable used to store notification options. */
|
/* Initialize the nbar variable used to store notification options. */
|
||||||
|
24
src/recur.c
24
src/recur.c
@ -63,7 +63,7 @@ free_exc_list (llist_t *exc)
|
|||||||
static int
|
static int
|
||||||
exc_cmp_day (struct excp *a, struct excp *b)
|
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
|
static void
|
||||||
@ -214,13 +214,13 @@ recur_event_llist_free (void)
|
|||||||
static int
|
static int
|
||||||
recur_apoint_cmp_start (struct recur_apoint *a, struct recur_apoint *b)
|
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
|
static int
|
||||||
recur_event_cmp_day (struct recur_event *a, struct recur_event *b)
|
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 */
|
/* Insert a new recursive appointment in the general linked list */
|
||||||
@ -310,7 +310,7 @@ recur_def2char (enum recur_type define)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (recur_char);
|
return recur_char;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -340,7 +340,7 @@ recur_char2def (char type)
|
|||||||
EXIT (_("unknown character"));
|
EXIT (_("unknown character"));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return (recur_def);
|
return recur_def;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Write days for which recurrent items should not be repeated. */
|
/* 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,
|
EXIT_IF (tstart == -1 || tend == -1 || tstart > tend || tuntil == -1,
|
||||||
_("date error in appointment"));
|
_("date error in appointment"));
|
||||||
|
|
||||||
return (recur_apoint_new (buf, note, tstart, tend - tstart, state,
|
return recur_apoint_new (buf, note, tstart, tend - tstart, state,
|
||||||
recur_char2def (type), freq, tuntil, exc));
|
recur_char2def(type), freq, tuntil, exc);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Load the recursive events from file */
|
/* 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,
|
EXIT_IF (tstart == -1 || tuntil == -1,
|
||||||
_("date error in event"));
|
_("date error in event"));
|
||||||
|
|
||||||
return recur_event_new (buf, note, tstart, id, recur_char2def (type),
|
return recur_event_new (buf, note, tstart, id, recur_char2def(type), freq,
|
||||||
freq, tuntil, exc);
|
tuntil, exc);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Writting of a recursive appointment into file. */
|
/* Writting of a recursive appointment into file. */
|
||||||
@ -607,7 +607,7 @@ diff_years (struct tm lt_start, struct tm lt_end)
|
|||||||
static int
|
static int
|
||||||
exc_inday (struct excp *exc, long day_start)
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1034,7 +1034,7 @@ recur_exc_scan (llist_t *lexc, FILE *data_file)
|
|||||||
static int
|
static int
|
||||||
recur_apoint_starts_before (struct recur_apoint *rapt, long time)
|
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);
|
LLIST_TS_UNLOCK (&recur_alist_p);
|
||||||
|
|
||||||
return (app);
|
return app;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Returns a structure containing the selected recurrent appointment. */
|
/* Returns a structure containing the selected recurrent appointment. */
|
||||||
|
10
src/todo.c
10
src/todo.c
@ -76,14 +76,14 @@ todo_hilt_increase (int n)
|
|||||||
int
|
int
|
||||||
todo_hilt (void)
|
todo_hilt (void)
|
||||||
{
|
{
|
||||||
return (hilt);
|
return hilt;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return the number of todos. */
|
/* Return the number of todos. */
|
||||||
int
|
int
|
||||||
todo_nb (void)
|
todo_nb (void)
|
||||||
{
|
{
|
||||||
return (todos);
|
return todos;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set the number of todos. */
|
/* Set the number of todos. */
|
||||||
@ -119,14 +119,14 @@ todo_first_decrease (int n)
|
|||||||
int
|
int
|
||||||
todo_hilt_pos (void)
|
todo_hilt_pos (void)
|
||||||
{
|
{
|
||||||
return (hilt - first);
|
return hilt - first;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return the last visited todo. */
|
/* Return the last visited todo. */
|
||||||
char *
|
char *
|
||||||
todo_saved_mesg (void)
|
todo_saved_mesg (void)
|
||||||
{
|
{
|
||||||
return (msgsav);
|
return msgsav;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Request user to enter a new todo item. */
|
/* 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_a = abs (a->id);
|
||||||
int abs_b = abs (b->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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
14
src/utils.c
14
src/utils.c
@ -348,7 +348,7 @@ update_time_in_date (long date, unsigned hr, unsigned mn)
|
|||||||
new_date = mktime (lt);
|
new_date = mktime (lt);
|
||||||
EXIT_IF (new_date == -1, _("error in mktime"));
|
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);
|
date.yyyy = atoi (current_year);
|
||||||
}
|
}
|
||||||
long_date = date2sec (date, 0, 0);
|
long_date = date2sec (date, 0, 0);
|
||||||
return (long_date);
|
return long_date;
|
||||||
}
|
}
|
||||||
|
|
||||||
long
|
long
|
||||||
min2sec (unsigned minutes)
|
min2sec (unsigned minutes)
|
||||||
{
|
{
|
||||||
return (minutes * MININSEC);
|
return minutes * MININSEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -450,7 +450,7 @@ get_today (void)
|
|||||||
day.yyyy = lt->tm_year + 1900;
|
day.yyyy = lt->tm_year + 1900;
|
||||||
current_day = date2sec (day, 0, 0);
|
current_day = date2sec (day, 0, 0);
|
||||||
|
|
||||||
return (current_day);
|
return current_day;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Returns the current time in seconds. */
|
/* Returns the current time in seconds. */
|
||||||
@ -484,7 +484,7 @@ mystrtol (const char *str)
|
|||||||
if (errno == ERANGE && (lval == LONG_MAX || lval == LONG_MIN))
|
if (errno == ERANGE && (lval == LONG_MAX || lval == LONG_MIN))
|
||||||
EXIT (_("out of range"));
|
EXIT (_("out of range"));
|
||||||
|
|
||||||
return (lval);
|
return lval;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Print the given option value with appropriate color. */
|
/* Print the given option value with appropriate color. */
|
||||||
@ -541,11 +541,11 @@ new_tempfile (const char *prefix, int trailing_len)
|
|||||||
FILE *file;
|
FILE *file;
|
||||||
|
|
||||||
if (prefix == NULL)
|
if (prefix == NULL)
|
||||||
return (NULL);
|
return NULL;
|
||||||
|
|
||||||
prefix_len = strlen (prefix);
|
prefix_len = strlen (prefix);
|
||||||
if (prefix_len + trailing_len >= BUFSIZ)
|
if (prefix_len + trailing_len >= BUFSIZ)
|
||||||
return (NULL);
|
return NULL;
|
||||||
memcpy (fullname, prefix, prefix_len);
|
memcpy (fullname, prefix, prefix_len);
|
||||||
memset (fullname + prefix_len, 'X', trailing_len);
|
memset (fullname + prefix_len, 'X', trailing_len);
|
||||||
fullname[prefix_len + trailing_len] = '\0';
|
fullname[prefix_len + trailing_len] = '\0';
|
||||||
|
@ -201,7 +201,7 @@ wins_slctd_init (void)
|
|||||||
enum win
|
enum win
|
||||||
wins_slctd (void)
|
wins_slctd (void)
|
||||||
{
|
{
|
||||||
return (slctd_win);
|
return slctd_win;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Sets the selected window. */
|
/* Sets the selected window. */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user