summaryrefslogtreecommitdiff
path: root/src/calcurse.h
diff options
context:
space:
mode:
authorLukas Fleischer <calcurse@cryptocrack.de>2012-06-25 11:51:59 +0200
committerLukas Fleischer <calcurse@cryptocrack.de>2012-06-30 14:34:33 +0200
commit52bfc54333d5795900970eeceee704fef4667873 (patch)
tree11bfdfe2968c20969e2b6f9eba8567c02be06753 /src/calcurse.h
parentcbc5d4688058a117b395707b8ae1426f08984cf8 (diff)
downloadcalcurse-52bfc54333d5795900970eeceee704fef4667873.zip
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 <calcurse@cryptocrack.de>
Diffstat (limited to 'src/calcurse.h')
-rw-r--r--src/calcurse.h28
1 files changed, 16 insertions, 12 deletions
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,