[zeromq-dev] [ZFL] list class

Pieter Hintjens ph at imatix.com
Thu Oct 14 17:00:08 CEST 2010


On Thu, Oct 14, 2010 at 2:59 PM, Martin Hurton <hurtonm at gmail.com> wrote:

>    zfl_list_destroy (zfl_list_t *self);

ZFL passes **self to destructors and nullifies the pointer after.

> //  Insert the element at the end of the list.
> void
>    zfl_list_append (zfl_list_t *self, void *val);

Doesn't return new element?  I'd use zfl_list_item_t, it's shorter.
Also, maybe simple 'after' and 'before' for insertion.

> //  Insert the element after a given element. Returns new element.
> zfl_list_element_t *
>    zfl_list_insert_after (zfl_list_element_t *el, void *val);

So:

>    zfl_list_insert (zfl_list_item_t *item, void *value);

> //  Return the value of the element.
> void *
>    zfl_list_value (zfl_list_t *self);

This is mixing the APIs for zfl_list and zfl_list_item IMO.  Either
make one class where the list items are hidden, or make two classes
each with their respective methods.

> size_t
>    zfl_list_len (zfl_list_t *self);

In general, don't use abbreviations for methods, just find short
names.  So 'size' rather than 'len'.

So this is the first step towards making a zfl_queue class for
messages?  That'll be nice to use in devices...

-
Pieter



More information about the zeromq-dev mailing list