wok diff module-init-tools/stuff/lzlib.u @ rev 3375

Add: python-cheetah
author Christophe Lincoln <pankso@slitaz.org>
date Fri Jun 12 02:23:53 2009 +0200 (2009-06-12)
parents cf7f6d5ad5ca
children 71c7aacfbbb2
line diff
     1.1 --- a/module-init-tools/stuff/lzlib.u	Thu Jun 12 11:53:31 2008 +0000
     1.2 +++ b/module-init-tools/stuff/lzlib.u	Fri Jun 12 02:23:53 2009 +0200
     1.3 @@ -1,47 +1,45 @@
     1.4 ---- module-init-tools-3.2/zlibsupport.c
     1.5 -+++ module-init-tools-3.2/zlibsupport.c
     1.6 -@@ -16,58 +16,33 @@
     1.7 +--- module-init-tools-3.9/zlibsupport.c
     1.8 ++++ module-init-tools-3.9/zlibsupport.c
     1.9 +@@ -18,60 +18,40 @@
    1.10   #include "testing.h"
    1.11   
    1.12   #ifdef CONFIG_USE_ZLIB
    1.13  -#include <zlib.h>
    1.14 -+#include <lzlib.h>
    1.15 - 
    1.16 +-
    1.17  -void *grab_contents(gzFile *gzfd, unsigned long *size)
    1.18  -{
    1.19  -	unsigned int max = 16384;
    1.20 --	void *buffer = malloc(max);
    1.21 +-	void *buffer = NOFAIL(malloc(max));
    1.22  -	int ret;
    1.23  -
    1.24 --	if (!buffer)
    1.25 --		return NULL;
    1.26 --
    1.27  -	*size = 0;
    1.28  -	while ((ret = gzread(gzfd, buffer + *size, max - *size)) > 0) {
    1.29  -		*size += ret;
    1.30 --		if (*size == max) {
    1.31 --			buffer = realloc(buffer, max *= 2);
    1.32 --			if (!buffer)
    1.33 --				return NULL;
    1.34 --		}
    1.35 +-		if (*size == max)
    1.36 +-			buffer = NOFAIL(realloc(buffer, max *= 2));
    1.37  -	}
    1.38  -	if (ret < 0) {
    1.39  -		free(buffer);
    1.40  -		buffer = NULL;
    1.41  -	}
    1.42 +-
    1.43  -	return buffer;
    1.44  -}
    1.45 --
    1.46 ++#include <lzlib.h>
    1.47 + 
    1.48   void *grab_fd(int fd, unsigned long *size)
    1.49   {
    1.50  -	gzFile gzfd;
    1.51  +	lzFile lzfd;
    1.52   
    1.53  -	gzfd = gzdopen(fd, "rb");
    1.54 --	if (!gzfd)
    1.55 +-	if (!gzfd) {
    1.56  +	lzfd = lzdopen(fd, "rb");
    1.57 -+	if (!lzfd)
    1.58 ++	if (!lzfd) {
    1.59 + 		if (errno == ENOMEM)
    1.60 + 			fatal("Memory allocation failure in gzdopen\n");
    1.61   		return NULL;
    1.62 + 	}
    1.63   
    1.64  -	/* gzclose(gzfd) would close fd, which would drop locks.
    1.65  +	/* lzclose(lzfd) would close fd, which would drop locks.
    1.66 @@ -58,11 +56,15 @@
    1.67  +	lzFile lzfd;
    1.68   	void *buffer;
    1.69   
    1.70 + 	errno = 0;
    1.71  -	gzfd = gzopen(filename, "rb");
    1.72 --	if (!gzfd)
    1.73 +-	if (!gzfd) {
    1.74  +	lzfd = lzopen(filename, "rb");
    1.75 -+	if (!lzfd)
    1.76 ++	if (!lzfd) {
    1.77 + 		if (errno == ENOMEM)
    1.78 + 			fatal("Memory allocation failure in gzopen\n");
    1.79   		return NULL;
    1.80 + 	}
    1.81  -	buffer = grab_contents(gzfd, size);
    1.82  -	gzclose(gzfd);
    1.83  +	buffer = lzgrab(lzfd, size);
    1.84 @@ -70,14 +72,24 @@
    1.85   	return buffer;
    1.86   }
    1.87   
    1.88 ---- module-init-tools-3.2/configure
    1.89 -+++ module-init-tools-3.2/configure
    1.90 -@@ -1741,7 +1741,7 @@
    1.91 +
    1.92 +--- module-init-tools-3.9/configure
    1.93 ++++ module-init-tools-3.9/configure
    1.94 +@@ -2590,7 +2590,7 @@
    1.95   #define CONFIG_USE_ZLIB 1
    1.96   _ACEOF
    1.97   
    1.98  -  zlib_flags="-Wl,-Bstatic -lz -Wl,-Bdynamic"
    1.99  +  zlib_flags="-Wl,-Bdynamic -lz -llz"
   1.100   fi
   1.101 - fi;
   1.102 + fi
   1.103   
   1.104 +@@ -2602,7 +2602,7 @@
   1.105 + #define CONFIG_USE_ZLIB 1
   1.106 + _ACEOF
   1.107 + 
   1.108 +-  zlib_flags="-lz"
   1.109 ++  zlib_flags="-lz -llz"
   1.110 + fi
   1.111 + fi
   1.112 +