From 244b6c927db34cea9cc83486510af60fd6ae7926 Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Mon, 25 Jun 2012 13:40:44 +0200 Subject: Make day_store_items() public Remove the "static" keyword from day_store_items(), so that it is accessible from other compilation units. Also, allow for discarding the event/appointment counters by passing NULL pointers and move the "regex.h" header inclusion to "calcurse.h". Signed-off-by: Lukas Fleischer --- src/args.c | 1 - src/calcurse.h | 2 ++ src/day.c | 15 +++++++++------ 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/args.c b/src/args.c index c87a970..4284886 100644 --- a/src/args.c +++ b/src/args.c @@ -41,7 +41,6 @@ #include #include #include -#include #include "calcurse.h" diff --git a/src/calcurse.h b/src/calcurse.h index a1208ac..407734d 100644 --- a/src/calcurse.h +++ b/src/calcurse.h @@ -53,6 +53,7 @@ #include #include #include +#include #include "llist.h" #include "htable.h" @@ -663,6 +664,7 @@ void custom_config_main(void); /* day.c */ void day_free_list(void); +int day_store_items(long, unsigned *, unsigned *, regex_t *); struct day_items_nb *day_process_storage(struct date *, unsigned, struct day_items_nb *); void day_write_pad(long, int, int, int); diff --git a/src/day.c b/src/day.c index 28fa86a..d4badae 100644 --- a/src/day.c +++ b/src/day.c @@ -39,7 +39,6 @@ #include #include #include -#include #include "calcurse.h" @@ -280,7 +279,7 @@ static int day_store_recur_apoints(long date, regex_t *regex) * and the length of the new pad to write is returned. * The number of events and appointments in the current day are also updated. */ -static int +int day_store_items(long date, unsigned *pnb_events, unsigned *pnb_apoints, regex_t *regex) { @@ -292,14 +291,18 @@ day_store_items(long date, unsigned *pnb_events, unsigned *pnb_apoints, day_init_list(); nb_recur_events = day_store_recur_events(date, regex); nb_events = day_store_events(date, regex); - *pnb_events = nb_events; + if (pnb_events) + *pnb_events = nb_events; nb_recur_apoints = day_store_recur_apoints(date, regex); nb_apoints = day_store_apoints(date, regex); - *pnb_apoints = nb_apoints; + if (pnb_apoints) + *pnb_apoints = nb_apoints; pad_length = (nb_recur_events + nb_events + 1 + 3 * (nb_recur_apoints + nb_apoints)); - *pnb_apoints += nb_recur_apoints; - *pnb_events += nb_recur_events; + if (pnb_apoints) + *pnb_apoints += nb_recur_apoints; + if (pnb_events) + *pnb_events += nb_recur_events; return pad_length; } -- cgit v1.2.3-70-g09d2