Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct event * create_event(struct eventlist * list_ev, float time, void(* func)(void *), int arg_count, ...)
- {
- va_list ptr;
- int i;
- struct event_arg_list * list_eva = malloc(sizeof(struct event_arg_list));
- struct event_arg_list * list_eva_next;
- struct event * ev_new = malloc(sizeof(struct event));
- va_start(ptr, arg_count);
- for (i = 0; i < arg_count; i++)
- {
- /* ??? */
- }
- va_end(ptr);
- ev_new->start = clock();
- ev_new->time = (clock_t) time * CLOCKS_PER_SEC;
- ev_new->func = func;
- ev_new->arg = /* ??? */
- if (list_ev->tail != NULL)
- {
- list_ev->tail->next = ev_new;
- }
- if (list_ev->count == 0)
- {
- assert(list_ev->head == NULL && list_ev->tail == NULL);
- list_ev->head = ev_new;
- }
- list_ev->tail = ev_new;
- list_ev->count++;
- while (list_eva != NULL)
- {
- list_eva_next = list_eva->next;
- free(list_eva);
- list_eva = list_eva_next;
- }
- /* Debug */
- fprintf(debuglog, "create_event()\n\tCreated event %p\n", (void *) ev_new);
- fflush(debuglog);
- return ev_new;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement