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

[PATCH v2 10/13] libdpkg: reorder internal fd_fd_filter() function arguments



Put the compression options string last so it can be replaced with
printf-style format string.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
 lib/dpkg/compression.c |   13 ++++++-------
 1 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/lib/dpkg/compression.c b/lib/dpkg/compression.c
index 914ba1d..a2fbdb3 100644
--- a/lib/dpkg/compression.c
+++ b/lib/dpkg/compression.c
@@ -20,9 +20,8 @@
 #include <dpkg/buffer.h>
 
 static void
-fd_fd_filter(int fd_in, int fd_out,
-	     const char *file, const char *cmd, const char *args,
-	     const char *desc)
+fd_fd_filter(int fd_in, int fd_out, const char *desc,
+             const char *file, const char *cmd, const char *args)
 {
   if (fd_in != 0) {
     m_dup2(fd_in, 0);
@@ -103,7 +102,7 @@ compress_cmd(int fd_in, int fd_out, const char *path,
   char combuf[6];
   strncpy(combuf, "-9c", sizeof(combuf));
   combuf[1] = compression;
-  fd_fd_filter(fd_in, fd_out, path, cmd, combuf, desc);
+  fd_fd_filter(fd_in, fd_out, desc, path, cmd, combuf);
 }
 
 void decompress_cat(enum compress_type type, int fd_in, int fd_out, char *desc, ...) {
@@ -120,7 +119,7 @@ void decompress_cat(enum compress_type type, int fd_in, int fd_out, char *desc,
       DECOMPRESS("gzip", gzFile, gzdopen, gzread, gzerror, Z_ERRNO,
                  fd_in, fd_out, v.buf);
 #else
-      fd_fd_filter(fd_in, fd_out, GZIP, "gzip", "-dc", v.buf);
+      fd_fd_filter(fd_in, fd_out, v.buf, GZIP, "gzip", "-dc");
 #endif
     case compress_type_bzip2:
 #ifdef WITH_BZ2
@@ -128,10 +127,10 @@ void decompress_cat(enum compress_type type, int fd_in, int fd_out, char *desc,
                  BZ2_bzerror, BZ_IO_ERROR,
                  fd_in, fd_out, v.buf);
 #else
-      fd_fd_filter(fd_in, fd_out, BZIP2, "bzip2", "-dc", v.buf);
+      fd_fd_filter(fd_in, fd_out, v.buf, BZIP2, "bzip2", "-dc");
 #endif
     case compress_type_lzma:
-      fd_fd_filter(fd_in, fd_out, LZMA, "lzma", "-dc", v.buf);
+      fd_fd_filter(fd_in, fd_out, v.buf, LZMA, "lzma", "-dc");
     case compress_type_cat:
       fd_fd_copy(fd_in, fd_out, -1, _("%s: decompression"), v.buf);
       exit(0);
-- 
1.6.5.rc1.199.g596ec


Reply to: