wok-next view module-init-tools/stuff/lzlib.u @ rev 20113
Add some bdeps
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Mon Oct 30 09:29:31 2017 +0100 (2017-10-30) |
parents | 71c7aacfbbb2 |
children |
line source
1 --- module-init-tools-3.10/zlibsupport.c
2 +++ module-init-tools-3.10/zlibsupport.c
3 @@ -18,43 +18,23 @@
4 #include "testing.h"
6 #ifdef CONFIG_USE_ZLIB
7 -#include <zlib.h>
8 -
9 -void *grab_contents(gzFile *gzfd, unsigned long *size)
10 -{
11 - unsigned int max = 16384;
12 - void *buffer = NOFAIL(malloc(max));
13 - int ret;
14 -
15 - *size = 0;
16 - while ((ret = gzread(gzfd, buffer + *size, max - *size)) > 0) {
17 - *size += ret;
18 - if (*size == max)
19 - buffer = NOFAIL(realloc(buffer, max *= 2));
20 - }
21 - if (ret < 0) {
22 - free(buffer);
23 - buffer = NULL;
24 - }
25 -
26 - return buffer;
27 -}
28 +#include <lzlib.h>
30 /* gzopen handles uncompressed files transparently. */
31 void *grab_file(const char *filename, unsigned long *size)
32 {
33 - gzFile gzfd;
34 + lzFile lzfd;
35 void *buffer;
37 errno = 0;
38 - gzfd = gzopen(filename, "rb");
39 - if (!gzfd) {
40 + lzfd = lzopen(filename, "rb");
41 + if (!lzfd) {
42 if (errno == ENOMEM)
43 fatal("Memory allocation failure in gzopen\n");
44 return NULL;
45 }
46 - buffer = grab_contents(gzfd, size);
47 - gzclose(gzfd);
48 + buffer = lzgrab(lzfd, size);
49 + lzclose(lzfd);
50 return buffer;
51 }
54 --- module-init-tools-3.9/configure
55 +++ module-init-tools-3.9/configure
56 @@ -2590,7 +2590,7 @@
57 #define CONFIG_USE_ZLIB 1
58 _ACEOF
60 - zlib_flags="-Wl,-Bstatic -lz -Wl,-Bdynamic"
61 + zlib_flags="-Wl,-Bdynamic -lz -llz"
62 fi
63 fi
65 @@ -2602,7 +2602,7 @@
66 #define CONFIG_USE_ZLIB 1
67 _ACEOF
69 - zlib_flags="-lz"
70 + zlib_flags="-lz -llz"
71 fi
72 fi