[syslinux] Patch sensible callback framework

H. Peter Anvin hpa at zytor.com
Wed May 5 10:25:05 PDT 2010


On 05/05/2010 08:40 AM, Ayvaz, James wrote:
> Resubmit based on hpa feedback
> 	+ double linked circular linked list
> 	+ code cleanup
>
> Hopefully I didn't miss anything
> +
> +callback_record* register_callback(callback_record **type, callback_t callback, void *rarg) {
> +    callback_record *new;
> +    new = malloc(sizeof(callback_record));
> +    if (!new) {
> +        return NULL;
> +    }
> +    new->function = callback;
> +    new->rarg = rarg;
> +
> +    if (*type == NULL) { /* first and only node */
> +        new->next = new;
> +        new->prev = new;
> +        *type = new;
> +        return new;
> +    }
> +

This is a circularly linked list without head node, but it's a lot 
cleaner to use a head node...

	-hpa




More information about the Syslinux mailing list