From 52bfc54333d5795900970eeceee704fef4667873 Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Mon, 25 Jun 2012 11:51:59 +0200 Subject: Rework generic item container Instead of copying all members of the individual item structures to a generic structure containing all fields, create compulsory fields only and set up a pointer to the actual item. This results in lower memory footprint and lets us clean up some code. Signed-off-by: Lukas Fleischer --- src/calcurse.h | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'src/calcurse.h') diff --git a/src/calcurse.h b/src/calcurse.h index 7259dd1..23d57ce 100644 --- a/src/calcurse.h +++ b/src/calcurse.h @@ -308,18 +308,6 @@ struct day_items_nb { unsigned nb_apoints; }; -/* Generic item description (to hold appointments, events...). */ -struct day_item { - long start; /* seconds since 1 jan 1970 */ - long appt_dur; /* appointment duration in seconds */ - int type; /* (recursive or normal) event or appointment */ - int evnt_id; /* event identifier */ - int appt_pos; /* real position in recurrent list */ - char state; /* appointment state */ - char *mesg; /* item description */ - char *note; /* note attached to item */ -}; - struct excp { long st; /* beggining of the considered day, in seconds */ }; @@ -361,6 +349,22 @@ struct recur_event { char *note; /* note attached to event */ }; +/* Generic pointer data type for appointments and events. */ +union aptev_ptr { + struct apoint *apt; + struct event *ev; + struct recur_apoint *rapt; + struct recur_event *rev; +}; + +/* Generic item description (to hold appointments, events...). */ +struct day_item { + int type; /* (recursive or normal) event or appointment */ + long start; /* start time of the repetition occurrence */ + union aptev_ptr item; /* pointer to the actual item */ + int appt_pos; /* real position in recurrent list */ +}; + /* Available view for the calendar panel. */ enum { CAL_MONTH_VIEW, -- cgit v1.2.3-54-g00ecf