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>
This commit is contained in:
parent
1f2fe16a84
commit
244b6c927d
@ -41,7 +41,6 @@
|
|||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <regex.h>
|
|
||||||
|
|
||||||
#include "calcurse.h"
|
#include "calcurse.h"
|
||||||
|
|
||||||
|
@ -53,6 +53,7 @@
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <regex.h>
|
||||||
|
|
||||||
#include "llist.h"
|
#include "llist.h"
|
||||||
#include "htable.h"
|
#include "htable.h"
|
||||||
@ -663,6 +664,7 @@ void custom_config_main(void);
|
|||||||
|
|
||||||
/* day.c */
|
/* day.c */
|
||||||
void day_free_list(void);
|
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 *day_process_storage(struct date *, unsigned,
|
||||||
struct day_items_nb *);
|
struct day_items_nb *);
|
||||||
void day_write_pad(long, int, int, int);
|
void day_write_pad(long, int, int, int);
|
||||||
|
@ -39,7 +39,6 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <regex.h>
|
|
||||||
|
|
||||||
#include "calcurse.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.
|
* and the length of the new pad to write is returned.
|
||||||
* The number of events and appointments in the current day are also updated.
|
* 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,
|
day_store_items(long date, unsigned *pnb_events, unsigned *pnb_apoints,
|
||||||
regex_t *regex)
|
regex_t *regex)
|
||||||
{
|
{
|
||||||
@ -292,13 +291,17 @@ day_store_items(long date, unsigned *pnb_events, unsigned *pnb_apoints,
|
|||||||
day_init_list();
|
day_init_list();
|
||||||
nb_recur_events = day_store_recur_events(date, regex);
|
nb_recur_events = day_store_recur_events(date, regex);
|
||||||
nb_events = day_store_events(date, regex);
|
nb_events = day_store_events(date, regex);
|
||||||
|
if (pnb_events)
|
||||||
*pnb_events = nb_events;
|
*pnb_events = nb_events;
|
||||||
nb_recur_apoints = day_store_recur_apoints(date, regex);
|
nb_recur_apoints = day_store_recur_apoints(date, regex);
|
||||||
nb_apoints = day_store_apoints(date, regex);
|
nb_apoints = day_store_apoints(date, regex);
|
||||||
|
if (pnb_apoints)
|
||||||
*pnb_apoints = nb_apoints;
|
*pnb_apoints = nb_apoints;
|
||||||
pad_length = (nb_recur_events + nb_events + 1 +
|
pad_length = (nb_recur_events + nb_events + 1 +
|
||||||
3 * (nb_recur_apoints + nb_apoints));
|
3 * (nb_recur_apoints + nb_apoints));
|
||||||
|
if (pnb_apoints)
|
||||||
*pnb_apoints += nb_recur_apoints;
|
*pnb_apoints += nb_recur_apoints;
|
||||||
|
if (pnb_events)
|
||||||
*pnb_events += nb_recur_events;
|
*pnb_events += nb_recur_events;
|
||||||
|
|
||||||
return pad_length;
|
return pad_length;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user