svn commit: trunk/busybox: archival archival/libunarchive include
vda at busybox.net
vda at busybox.net
Sun Nov 11 18:13:14 PST 2007
Author: vda
Date: 2007-11-11 18:13:12 -0800 (Sun, 11 Nov 2007)
New Revision: 20409
Log:
open_transformer: do not duplicate "<program> -cf -"
text data bss dec hex filename
677858 738 7236 685832 a7708 busybox_old
677804 738 7236 685778 a76d2 busybox_unstripped
Modified:
trunk/busybox/archival/libunarchive/get_header_tar_bz2.c
trunk/busybox/archival/libunarchive/get_header_tar_gz.c
trunk/busybox/archival/libunarchive/get_header_tar_lzma.c
trunk/busybox/archival/libunarchive/open_transformer.c
trunk/busybox/archival/rpm.c
trunk/busybox/archival/tar.c
trunk/busybox/include/unarchive.h
Changeset:
Modified: trunk/busybox/archival/libunarchive/get_header_tar_bz2.c
===================================================================
--- trunk/busybox/archival/libunarchive/get_header_tar_bz2.c 2007-11-12 01:44:49 UTC (rev 20408)
+++ trunk/busybox/archival/libunarchive/get_header_tar_bz2.c 2007-11-12 02:13:12 UTC (rev 20409)
@@ -11,7 +11,7 @@
/* Can't lseek over pipes */
archive_handle->seek = seek_by_read;
- archive_handle->src_fd = open_transformer(archive_handle->src_fd, unpack_bz2_stream, "bunzip2", "bunzip2", "-cf", "-", NULL);
+ archive_handle->src_fd = open_transformer(archive_handle->src_fd, unpack_bz2_stream, "bunzip2");
archive_handle->offset = 0;
while (get_header_tar(archive_handle) == EXIT_SUCCESS)
continue;
Modified: trunk/busybox/archival/libunarchive/get_header_tar_gz.c
===================================================================
--- trunk/busybox/archival/libunarchive/get_header_tar_gz.c 2007-11-12 01:44:49 UTC (rev 20408)
+++ trunk/busybox/archival/libunarchive/get_header_tar_gz.c 2007-11-12 02:13:12 UTC (rev 20409)
@@ -25,7 +25,7 @@
}
#endif
- archive_handle->src_fd = open_transformer(archive_handle->src_fd, unpack_gz_stream, "gunzip", "gunzip", "-cf", "-", NULL);
+ archive_handle->src_fd = open_transformer(archive_handle->src_fd, unpack_gz_stream, "gunzip");
archive_handle->offset = 0;
while (get_header_tar(archive_handle) == EXIT_SUCCESS)
continue;
Modified: trunk/busybox/archival/libunarchive/get_header_tar_lzma.c
===================================================================
--- trunk/busybox/archival/libunarchive/get_header_tar_lzma.c 2007-11-12 01:44:49 UTC (rev 20408)
+++ trunk/busybox/archival/libunarchive/get_header_tar_lzma.c 2007-11-12 02:13:12 UTC (rev 20409)
@@ -14,7 +14,7 @@
/* Can't lseek over pipes */
archive_handle->seek = seek_by_read;
- archive_handle->src_fd = open_transformer(archive_handle->src_fd, unpack_lzma_stream, "unlzma", "unlzma", "-cf", "-", NULL);
+ archive_handle->src_fd = open_transformer(archive_handle->src_fd, unpack_lzma_stream, "unlzma");
archive_handle->offset = 0;
while (get_header_tar(archive_handle) == EXIT_SUCCESS)
continue;
Modified: trunk/busybox/archival/libunarchive/open_transformer.c
===================================================================
--- trunk/busybox/archival/libunarchive/open_transformer.c 2007-11-12 01:44:49 UTC (rev 20408)
+++ trunk/busybox/archival/libunarchive/open_transformer.c 2007-11-12 02:13:12 UTC (rev 20409)
@@ -8,12 +8,12 @@
/* transformer(), more than meets the eye */
/*
- * On MMU machine, the transform_prog and ... are stripped
- * by a macro in include/unarchive.h. On NOMMU, transformer is stripped.
+ * On MMU machine, the transform_prog is removed by macro magic
+ * in include/unarchive.h. On NOMMU, transformer is removed.
*/
int open_transformer(int src_fd,
USE_DESKTOP(long long) int (*transformer)(int src_fd, int dst_fd),
- const char *transform_prog, ...)
+ const char *transform_prog)
{
int fd_pipe[2];
int pid;
@@ -29,9 +29,6 @@
bb_perror_msg_and_die("fork failed");
if (pid == 0) {
-#if !BB_MMU
- va_list ap;
-#endif
/* child process */
close(fd_pipe[0]); /* We don't wan't to read from the parent */
// FIXME: error check?
@@ -43,12 +40,17 @@
}
exit(0);
#else
- xmove_fd(src_fd, 0);
- xmove_fd(fd_pipe[1], 1);
- va_start(ap, transform_prog);
- /* hoping that va_list -> char** on our CPU is working... */
- BB_EXECVP(transform_prog, (void*)ap);
- bb_perror_msg_and_die("exec failed");
+ {
+ char *argv[4];
+ xmove_fd(src_fd, 0);
+ xmove_fd(fd_pipe[1], 1);
+ argv[0] = (char*)transform_prog;
+ argv[1] = (char*)"-cf";
+ argv[2] = (char*)"-";
+ argv[3] = NULL;
+ BB_EXECVP(transform_prog, argv);
+ bb_perror_msg_and_die("exec failed");
+ }
#endif
/* notreached */
}
Modified: trunk/busybox/archival/rpm.c
===================================================================
--- trunk/busybox/archival/rpm.c 2007-11-12 01:44:49 UTC (rev 20408)
+++ trunk/busybox/archival/rpm.c 2007-11-12 02:13:12 UTC (rev 20409)
@@ -237,7 +237,7 @@
}
xchdir("/"); /* Install RPM's to root */
- archive_handle->src_fd = open_transformer(archive_handle->src_fd, xformer, xformer_prog, xformer_prog, "-cf", "-", NULL);
+ archive_handle->src_fd = open_transformer(archive_handle->src_fd, xformer, xformer_prog);
archive_handle->offset = 0;
while (get_header_cpio(archive_handle) == EXIT_SUCCESS)
continue;
Modified: trunk/busybox/archival/tar.c
===================================================================
--- trunk/busybox/archival/tar.c 2007-11-12 01:44:49 UTC (rev 20408)
+++ trunk/busybox/archival/tar.c 2007-11-12 02:13:12 UTC (rev 20409)
@@ -662,7 +662,7 @@
bb_error_msg_and_die("invalid magic");
}
- archive_handle->src_fd = open_transformer(archive_handle->src_fd, uncompress, "uncompress", "uncompress", "-cf", "-", NULL);
+ archive_handle->src_fd = open_transformer(archive_handle->src_fd, uncompress, "uncompress");
archive_handle->offset = 0;
while (get_header_tar(archive_handle) == EXIT_SUCCESS)
continue;
Modified: trunk/busybox/include/unarchive.h
===================================================================
--- trunk/busybox/include/unarchive.h 2007-11-12 01:44:49 UTC (rev 20408)
+++ trunk/busybox/include/unarchive.h 2007-11-12 02:13:12 UTC (rev 20409)
@@ -116,10 +116,10 @@
#if BB_MMU
extern int open_transformer(int src_fd,
USE_DESKTOP(long long) int (*transformer)(int src_fd, int dst_fd));
-#define open_transformer(src_fd, transformer, transform_prog, ...) open_transformer(src_fd, transformer)
+#define open_transformer(src_fd, transformer, transform_prog) open_transformer(src_fd, transformer)
#else
-extern int open_transformer(int src_fd, const char *transform_prog, ...);
-#define open_transformer(src_fd, transformer, transform_prog, ...) open_transformer(src_fd, transform_prog, __VA_ARGS__)
+extern int open_transformer(int src_fd, const char *transform_prog);
+#define open_transformer(src_fd, transformer, transform_prog) open_transformer(src_fd, transform_prog)
#endif
#endif
More information about the busybox-cvs
mailing list