On Mon, 2012-01-16 at 21:29 +0100, Samuel Thibault wrote:
> Svante Signell, le Mon 16 Jan 2012 14:57:25 +0100, a écrit :
> > Never mind: Attached is a dynamic-allocation version of mkdirhier.c
> 
> It loops good to me, except a few things.

Good!

> > Is it possible to simplify the code somewhat, especially for the
> > first version?
> 
> The pointers don't really need to be initialized to NULL, as they are
> overwritten anyway. srcp is not needed either, as the src pointer is
> never changed.

Of course, srcp removed.

> >     if ((src = strdup(path)) == NULL)
> >     {
> >             errno = ENOMEM;
> >             return -1;
> >     }
> >     if ((dst = malloc(len + 1)) == NULL)
> >     {
> 
> missing free(src) here.

Missed that one, thanks!




-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]
Archive: http://lists.debian.org/[email protected]

Reply via email to