On Sat, Feb 18, 2012 at 12:20 PM, Arto Jonsson <[email protected]> wrote:
> Use queue(3) macros instead of own internal queue implementation. No
> functional change.
...
> -typedef struct queue {
> -       struct queue   *next;
> -       str_t           data;
> -} queue_t;

So, the current queue puts the link in the same allocated block as the
str_t data.

> -static queue_t *q_head, *q_tail;
> -static int      count;
> +struct q_entry {
> +       str_t* data;
> +       SIMPLEQ_ENTRY(q_entry) q_entries;
> +};
> +SIMPLEQ_HEAD(, q_entry) q_head = SIMPLEQ_HEAD_INITIALIZER(q_head);

Why do you switch to putting the links in separate blocks from the
str_t data?  I.e., why the "*" in "str_t* data" and thus the extra
mallocs and frees in the code to create and destroy them?


Philip Guenther

Reply via email to