aboutsummaryrefslogtreecommitdiff
path: root/src/mkhelp.pl
diff options
context:
space:
mode:
Diffstat (limited to 'src/mkhelp.pl')
-rw-r--r--src/mkhelp.pl21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/mkhelp.pl b/src/mkhelp.pl
index 4d44a9e0f..ff4604155 100644
--- a/src/mkhelp.pl
+++ b/src/mkhelp.pl
@@ -133,16 +133,14 @@ print <<HEAD
* NEVER EVER edit this manually, fix the mkhelp.pl script instead!
* Generation time: $now
*/
-#include "setup.h"
#ifdef USE_MANUAL
#include "hugehelp.h"
-#include <stdio.h>
HEAD
;
if($c) {
print <<HEAD
-#include <stdlib.h>
#include <zlib.h>
+#include "memdebug.h" /* keep this as LAST include */
static const unsigned char hugehelpgz[] = {
/* This mumbo-jumbo is the huge help text compressed with gzip.
Thanks to this operation, the size of this data shrunk from $gzip
@@ -167,6 +165,17 @@ HEAD
print <<EOF
#define BUF_SIZE 0x10000
+static voidpf zalloc_func(voidpf opaque, unsigned int items, unsigned int size)
+{
+ (void) opaque;
+ /* not a typo, keep it calloc() */
+ return (voidpf) calloc(items, size);
+}
+static void zfree_func(voidpf opaque, voidpf ptr)
+{
+ (void) opaque;
+ free(ptr);
+}
/* Decompress and send to stdout a gzip-compressed buffer */
void hugehelp(void)
{
@@ -179,11 +188,11 @@ void hugehelp(void)
return;
headerlen = 10;
+ memset(&z, 0, sizeof(z_stream));
+ z.zalloc = (alloc_func)zalloc_func;
+ z.zfree = (free_func)zfree_func;
z.avail_in = (unsigned int)(sizeof(hugehelpgz) - headerlen);
z.next_in = (unsigned char *)hugehelpgz + headerlen;
- z.zalloc = (alloc_func)Z_NULL;
- z.zfree = (free_func)Z_NULL;
- z.opaque = 0;
if (inflateInit2(&z, -MAX_WBITS) != Z_OK)
return;