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

libdpkg: Use new DPKG_BUFFER_SIZE macro instead of hard-coded literal

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Guillem Jover <guillem@debian.org>
Jonathan Nieder лет назад: 15
Родитель
Сommit
0e0f59a882
2 измененных файлов с 6 добавлено и 4 удалено
  1. 2 0
      lib/dpkg/buffer.h
  2. 4 4
      lib/dpkg/compress.c

+ 2 - 0
lib/dpkg/buffer.h

@@ -30,6 +30,8 @@
 
 DPKG_BEGIN_DECLS
 
+#define DPKG_BUFFER_SIZE 4096
+
 #define BUFFER_WRITE_VBUF		1
 #define BUFFER_WRITE_FD			2
 #define BUFFER_WRITE_NULL		3

+ 4 - 4
lib/dpkg/compress.c

@@ -105,7 +105,7 @@ struct compressor compressor_none = {
 static void
 decompress_gzip(int fd_in, int fd_out, const char *desc)
 {
-	char buffer[4096];
+	char buffer[DPKG_BUFFER_SIZE];
 	gzFile gzfile = gzdopen(fd_in, "r");
 
 	if (gzfile == NULL)
@@ -139,7 +139,7 @@ decompress_gzip(int fd_in, int fd_out, const char *desc)
 static void
 compress_gzip(int fd_in, int fd_out, int compress_level, const char *desc)
 {
-	char buffer[4096];
+	char buffer[DPKG_BUFFER_SIZE];
 	char combuf[6];
 	int err;
 	gzFile gzfile;
@@ -213,7 +213,7 @@ struct compressor compressor_gzip = {
 static void
 decompress_bzip2(int fd_in, int fd_out, const char *desc)
 {
-	char buffer[4096];
+	char buffer[DPKG_BUFFER_SIZE];
 	BZFILE *bzfile = BZ2_bzdopen(fd_in, "r");
 
 	if (bzfile == NULL)
@@ -247,7 +247,7 @@ decompress_bzip2(int fd_in, int fd_out, const char *desc)
 static void
 compress_bzip2(int fd_in, int fd_out, int compress_level, const char *desc)
 {
-	char buffer[4096];
+	char buffer[DPKG_BUFFER_SIZE];
 	char combuf[6];
 	int err;
 	BZFILE *bzfile;