New version of tac.c

Jean-Christophe Dubois jcd at tribudubois.net
Wed Jan 9 06:09:29 PST 2008


Hello Tito,

just a few comments:

On Tuesday 08 January 2008 22:42:23 Tito wrote:
>                         if (ch == '\n' || ch == EOF) {
>  line_end:
>                                 /* Save the size of the line to the list */
>                                 size = xmalloc(sizeof(int *));

Shouldn't this be xmalloc(sizeof(int))?

>                                 llist_add_to(&list, memcpy(size, &i, 
sizeof(int))); 
>                                 llist_add_to(&list, line); 

More generally would it make sense to define a structure holding both the 
string size and the string pointer? This would allow to call llist_add_to() 
only once per line instead of twice (same for llist_pop) ...

JC





More information about the busybox mailing list