--- Jeremy Hill <[EMAIL PROTECTED]> wrote:
[SNIP]
> I have a couple of questions, however:
> The new_event() and free_event() functions for your methods--what would they
> look like? Here my
> ignorance is showing. I am assuming that it's typical linked list node
> adding/remove, such as:
>
> void free_event(struct event *ev)
> {
> if (!IS_VALID(ev))
> return;
>
> INVALIDATE(ev);
> int i = 0;
>
> ev->next = ev_free;
> ev_free = ev;
> }
>
> And with new_event,
>
> struct event *new_event(void)
> {
> static event ev_zero;
> struct event *ev;
>
> if (ev_free == NULL)
> ev = alloc_perm(sizeof(*ev));
> else
> {
> ev = ev_free;
> ev_free = ev_free->next;
> }
>
> *ev = ev_zero;
> VALIDATE(ev);
> return ev;
> }
>
> Right?
>
> Only other thing I can think of is to typedef the event struct for my own
> laziness. :)
Yes, that's it exactly. Also, not all the events will need their own destroy
function as many of them won't allocate memory for their arguements. You can
probably just make one empty function, and assign the event's destroy function
to be that in the creation function.. (Let me know if that was too vague)
Good luck, and glad I could help,
~Kender
=====
-----BEGIN GEEK CODE BLOCK-----
Version 3.1
GCS/L/C/O d-(+) s++: a-- C+++$>++++ UBLS++++$
P+++(--)$ L+++>++++ E--- W+>++$ N !o K? w(--) !O
M- !V PS+ PE(++) Y+ PGP->+ t+ 5 X+() R(+) tv+@
b++(+++) !DI+++ D G(-) e>+++$ h---() r+++ y+++
------END GEEK CODE BLOCK------
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com