aboutsummaryrefslogtreecommitdiffstats
path: root/src/day.c
diff options
context:
space:
mode:
authorLukas Fleischer <calcurse@cryptocrack.de>2012-06-25 13:40:44 +0200
committerLukas Fleischer <calcurse@cryptocrack.de>2012-06-30 14:34:34 +0200
commit244b6c927db34cea9cc83486510af60fd6ae7926 (patch)
tree70ad713c7032533112b748791c405b704432d21a /src/day.c
parent1f2fe16a845b3cdab77c59ddf3ca5ab8f8b738a7 (diff)
downloadcalcurse-244b6c927db34cea9cc83486510af60fd6ae7926.tar.gz
calcurse-244b6c927db34cea9cc83486510af60fd6ae7926.zip
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 <calcurse@cryptocrack.de>
Diffstat (limited to 'src/day.c')
-rw-r--r--src/day.c15
1 files changed, 9 insertions, 6 deletions
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 <sys/types.h>
#include <ctype.h>
#include <time.h>
-#include <regex.h>
#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;
}