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.

> 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.

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

missing free(src) here.

Samuel


-- 
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