[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [PATCH v2 11/13] libdpkg: simplify code to calculate compression options



Hi!

On Sat, 2009-10-24 at 17:48:18 -0500, Jonathan Nieder wrote:
> Rather than making the reader track down the meaning of indices
> into a fixed-size buffer as it is modified, calculate the
> compression options all at once.

> diff --git a/lib/dpkg/compression.c b/lib/dpkg/compression.c
> index a2fbdb3..33b0922 100644
> --- a/lib/dpkg/compression.c
> +++ b/lib/dpkg/compression.c
> @@ -21,8 +21,16 @@
>  
>  static void
>  fd_fd_filter(int fd_in, int fd_out, const char *desc,
> -             const char *file, const char *cmd, const char *args)
> +             const char *file, const char *cmd,
> +             const char *argfmt, ...)

As said on the other mail, made the callers generate the correct
argument instead.

> @@ -31,8 +39,11 @@ fd_fd_filter(int fd_in, int fd_out, const char *desc,
>      m_dup2(fd_out, 1);
>      close(fd_out);
>    }
> -  execlp(file, cmd, args, NULL);
> -  ohshite(_("%s: failed to exec '%s %s'"), desc, cmd, args);
> +
> +  execlp(file, cmd, argbuf.buf, NULL);
> +  ohshite(_("%s: failed to exec '%s %s'"), desc, cmd, argbuf.buf);
> +
> +  varbuffree(&argbuf);

There's no point in calling this as exec + ohshite should never
return.

regards,
guillem


Reply to: