Просмотр исходного кода

libdpkg: Move compression declarations to a new compress.h

Guillem Jover лет назад: 16
Родитель
Сommit
5e252222c5
7 измененных файлов с 53 добавлено и 19 удалено
  1. 1 0
      dpkg-deb/build.c
  2. 1 0
      dpkg-deb/extract.c
  3. 1 0
      dpkg-deb/main.c
  4. 1 1
      lib/dpkg/Makefile.am
  5. 1 0
      lib/dpkg/compress.c
  6. 48 0
      lib/dpkg/compress.h
  7. 0 18
      lib/dpkg/dpkg.h

+ 1 - 0
dpkg-deb/build.c

@@ -48,6 +48,7 @@
 #include <dpkg/path.h>
 #include <dpkg/buffer.h>
 #include <dpkg/subproc.h>
+#include <dpkg/compress.h>
 #include <dpkg/myopt.h>
 
 #include "dpkg-deb.h"

+ 1 - 0
dpkg-deb/extract.c

@@ -44,6 +44,7 @@
 #include <dpkg/dpkg.h>
 #include <dpkg/buffer.h>
 #include <dpkg/subproc.h>
+#include <dpkg/compress.h>
 #include <dpkg/myopt.h>
 
 #include "dpkg-deb.h"

+ 1 - 0
dpkg-deb/main.c

@@ -43,6 +43,7 @@
 #include <dpkg/i18n.h>
 #include <dpkg/dpkg.h>
 #include <dpkg/dpkg-db.h>
+#include <dpkg/compress.h>
 #include <dpkg/myopt.h>
 
 #include "dpkg-deb.h"

+ 1 - 1
lib/dpkg/Makefile.am

@@ -21,7 +21,7 @@ libdpkg_a_SOURCES = \
 	dlist.h \
 	buffer.c buffer.h \
 	cleanup.c \
-	compress.c \
+	compress.c compress.h \
 	database.c \
 	dbmodify.c \
 	dump.c \

+ 1 - 0
lib/dpkg/compress.c

@@ -39,6 +39,7 @@
 #include <dpkg/dpkg.h>
 #include <dpkg/varbuf.h>
 #include <dpkg/buffer.h>
+#include <dpkg/compress.h>
 
 static void
 fd_fd_filter(int fd_in, int fd_out,

+ 48 - 0
lib/dpkg/compress.h

@@ -0,0 +1,48 @@
+/*
+ * libdpkg - Debian packaging suite library routines
+ * compress.h - compression support functions
+ *
+ * Copyright © 2004 Scott James Remnant <scott@netsplit.com>
+ * Copyright © 2006-2009 Guillem Jover <guillem@debian.org>
+ *
+ * This is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef LIBDPKG_COMPRESS_H
+#define LIBDPKG_COMPRESS_H
+
+#include <dpkg/macros.h>
+
+DPKG_BEGIN_DECLS
+
+#define GZIP		"gzip"
+#define BZIP2		"bzip2"
+#define LZMA		"lzma"
+
+enum compress_type {
+  compress_type_cat,
+  compress_type_gzip,
+  compress_type_bzip2,
+  compress_type_lzma,
+};
+
+void decompress_cat(enum compress_type type, int fd_in, int fd_out,
+                    const char *desc, ...) DPKG_ATTR_NORET DPKG_ATTR_PRINTF(4);
+void compress_cat(enum compress_type type, int fd_in, int fd_out,
+                  const char *compression, const char *desc, ...)
+                  DPKG_ATTR_NORET DPKG_ATTR_PRINTF(5);
+
+DPKG_END_DECLS
+
+#endif /* LIBDPKG_COMPRESS_H */

+ 0 - 18
lib/dpkg/dpkg.h

@@ -106,9 +106,6 @@ DPKG_BEGIN_DECLS
 #define DEBSIGVERIFY	"/usr/bin/debsig-verify"
 
 #define TAR		"tar"
-#define GZIP		"gzip"
-#define BZIP2		"bzip2"
-#define LZMA		"lzma"
 #define RM		"rm"
 #define FIND		"find"
 #define DIFF		"diff"
@@ -211,21 +208,6 @@ int cisspace(int c);
 int fgets_checked(char *buf, size_t bufsz, FILE *f, const char *fn);
 int fgets_must(char *buf, size_t bufsz, FILE *f, const char *fn);
 
-/*** from compression.c ***/
-
-enum compress_type {
-  compress_type_cat,
-  compress_type_gzip,
-  compress_type_bzip2,
-  compress_type_lzma,
-};
-
-void decompress_cat(enum compress_type type, int fd_in, int fd_out,
-                    const char *desc, ...) DPKG_ATTR_NORET DPKG_ATTR_PRINTF(4);
-void compress_cat(enum compress_type type, int fd_in, int fd_out,
-                  const char *compression, const char *desc, ...)
-                  DPKG_ATTR_NORET DPKG_ATTR_PRINTF(5);
-
 DPKG_END_DECLS
 
 #endif /* LIBDPKG_DPKG_H */