summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorJoel Sing <jsing@cvs.openbsd.org>2011-07-16 07:25:30 +0000
committerJoel Sing <jsing@cvs.openbsd.org>2011-07-16 07:25:30 +0000
commitbf8e562346a9a40fcde8334aaf547489a8ecc3ad (patch)
tree1ceffae7763c6f1b9da4469f05f6f586bb52682c /sys
parentbf0b2cfe4905f7164986cdaf0cde67364b95f464 (diff)
Make the updated zlib compile with a debug kernel.
ok deraadt@
Diffstat (limited to 'sys')
-rw-r--r--sys/lib/libz/deflate.c8
-rw-r--r--sys/lib/libz/deflate.h6
-rw-r--r--sys/lib/libz/trees.c36
-rw-r--r--sys/lib/libz/zutil.c6
4 files changed, 28 insertions, 28 deletions
diff --git a/sys/lib/libz/deflate.c b/sys/lib/libz/deflate.c
index b4f3d9dc79e..299daf4d63d 100644
--- a/sys/lib/libz/deflate.c
+++ b/sys/lib/libz/deflate.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: deflate.c,v 1.1 2011/07/07 02:57:24 deraadt Exp $ */
+/* $OpenBSD: deflate.c,v 1.2 2011/07/16 07:25:29 jsing Exp $ */
/* deflate.c -- compress data using the deflation algorithm
* Copyright (C) 1995-2005 Jean-loup Gailly.
* For conditions of distribution and use, see copyright notice in zlib.h
@@ -91,7 +91,7 @@ local uInt longest_match OF((deflate_state *s, IPos cur_match));
#endif
local uInt longest_match_fast OF((deflate_state *s, IPos cur_match));
-#ifdef DEBUG
+#ifdef DEBUG_LIBZ
local void check_match OF((deflate_state *s, IPos start, IPos match,
int length));
#endif
@@ -1223,7 +1223,7 @@ local uInt longest_match_fast(s, cur_match)
return (uInt)len <= s->lookahead ? (uInt)len : s->lookahead;
}
-#ifdef DEBUG
+#ifdef DEBUG_LIBZ
/* ===========================================================================
* Check that the match at match_start is indeed a match.
*/
@@ -1249,7 +1249,7 @@ local void check_match(s, start, match, length)
}
#else
# define check_match(s, start, match, length)
-#endif /* DEBUG */
+#endif /* DEBUG_LIBZ */
/* ===========================================================================
* Fill the window when the lookahead becomes insufficient.
diff --git a/sys/lib/libz/deflate.h b/sys/lib/libz/deflate.h
index 26fe440ed30..bb22284f477 100644
--- a/sys/lib/libz/deflate.h
+++ b/sys/lib/libz/deflate.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: deflate.h,v 1.1 2011/07/07 02:57:24 deraadt Exp $ */
+/* $OpenBSD: deflate.h,v 1.2 2011/07/16 07:25:29 jsing Exp $ */
/* deflate.h -- internal compression state
* Copyright (C) 1995-2004 Jean-loup Gailly
* For conditions of distribution and use, see copyright notice in zlib.h
@@ -246,7 +246,7 @@ typedef struct internal_state {
uInt matches; /* number of string matches in current block */
int last_eob_len; /* bit length of EOB code for last block */
-#ifdef DEBUG
+#ifdef DEBUG_LIBZ
ulg compressed_len; /* total bit length of compressed file mod 2^32 */
ulg bits_sent; /* bit length of compressed data sent mod 2^32 */
#endif
@@ -294,7 +294,7 @@ void _tr_stored_block OF((deflate_state *s, charf *buf, ulg stored_len,
* used.
*/
-#ifndef DEBUG
+#ifndef DEBUG_LIBZ
/* Inline versions of _tr_tally for speed: */
#if defined(GEN_TREES_H) || !defined(STDC)
diff --git a/sys/lib/libz/trees.c b/sys/lib/libz/trees.c
index d0ff5e34620..9ca7baf2750 100644
--- a/sys/lib/libz/trees.c
+++ b/sys/lib/libz/trees.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trees.c,v 1.1 2011/07/07 02:57:24 deraadt Exp $ */
+/* $OpenBSD: trees.c,v 1.2 2011/07/16 07:25:29 jsing Exp $ */
/* trees.c -- output deflated data using Huffman coding
* Copyright (C) 1995-2005 Jean-loup Gailly
* For conditions of distribution and use, see copyright notice in zlib.h
@@ -35,7 +35,7 @@
#include "deflate.h"
-#ifdef DEBUG
+#ifdef DEBUG_LIBZ
# include <ctype.h>
#endif
@@ -163,11 +163,11 @@ local void copy_block OF((deflate_state *s, charf *buf, unsigned len,
local void gen_trees_header OF((void));
#endif
-#ifndef DEBUG
+#ifndef DEBUG_LIBZ
# define send_code(s, c, tree) send_bits(s, tree[c].Code, tree[c].Len)
/* Send a code of the given tree. c and tree must not have side effects */
-#else /* DEBUG */
+#else /* DEBUG_LIBZ */
# define send_code(s, c, tree) \
{ if (z_verbose>2) fprintf(stderr,"\ncd %3d ",(c)); \
send_bits(s, tree[c].Code, tree[c].Len); }
@@ -186,7 +186,7 @@ local void gen_trees_header OF((void));
* Send a value on a given number of bits.
* IN assertion: length <= 16 and value fits in length bits.
*/
-#ifdef DEBUG
+#ifdef DEBUG_LIBZ
local void send_bits OF((deflate_state *s, int value, int length));
local void send_bits(s, value, length)
@@ -212,7 +212,7 @@ local void send_bits(s, value, length)
s->bi_valid += length;
}
}
-#else /* !DEBUG */
+#else /* !DEBUG_LIBZ */
#define send_bits(s, value, length) \
{ int len = length;\
@@ -227,7 +227,7 @@ local void send_bits(s, value, length)
s->bi_valid += len;\
}\
}
-#endif /* DEBUG */
+#endif /* DEBUG_LIBZ */
/* the arguments must not have side effects */
@@ -319,7 +319,7 @@ local void tr_static_init()
* Genererate the file trees.h describing the static trees.
*/
#ifdef GEN_TREES_H
-# ifndef DEBUG
+# ifndef DEBUG_LIBZ
# include <stdio.h>
# endif
@@ -396,7 +396,7 @@ void _tr_init(s)
s->bi_buf = 0;
s->bi_valid = 0;
s->last_eob_len = 8; /* enough lookahead for inflate */
-#ifdef DEBUG
+#ifdef DEBUG_LIBZ
s->compressed_len = 0L;
s->bits_sent = 0L;
#endif
@@ -871,7 +871,7 @@ void _tr_stored_block(s, buf, stored_len, eof)
int eof; /* true if this is the last block for a file */
{
send_bits(s, (STORED_BLOCK<<1)+eof, 3); /* send block type */
-#ifdef DEBUG
+#ifdef DEBUG_LIBZ
s->compressed_len = (s->compressed_len + 3 + 7) & (ulg)~7L;
s->compressed_len += (stored_len + 4) << 3;
#endif
@@ -894,7 +894,7 @@ void _tr_align(s)
{
send_bits(s, STATIC_TREES<<1, 3);
send_code(s, END_BLOCK, static_ltree);
-#ifdef DEBUG
+#ifdef DEBUG_LIBZ
s->compressed_len += 10L; /* 3 for block type, 7 for EOB */
#endif
bi_flush(s);
@@ -906,7 +906,7 @@ void _tr_align(s)
if (1 + s->last_eob_len + 10 - s->bi_valid < 9) {
send_bits(s, STATIC_TREES<<1, 3);
send_code(s, END_BLOCK, static_ltree);
-#ifdef DEBUG
+#ifdef DEBUG_LIBZ
s->compressed_len += 10L;
#endif
bi_flush(s);
@@ -987,7 +987,7 @@ void _tr_flush_block(s, buf, stored_len, eof)
#endif
send_bits(s, (STATIC_TREES<<1)+eof, 3);
compress_block(s, (ct_data *)static_ltree, (ct_data *)static_dtree);
-#ifdef DEBUG
+#ifdef DEBUG_LIBZ
s->compressed_len += 3 + s->static_len;
#endif
} else {
@@ -995,7 +995,7 @@ void _tr_flush_block(s, buf, stored_len, eof)
send_all_trees(s, s->l_desc.max_code+1, s->d_desc.max_code+1,
max_blindex+1);
compress_block(s, (ct_data *)s->dyn_ltree, (ct_data *)s->dyn_dtree);
-#ifdef DEBUG
+#ifdef DEBUG_LIBZ
s->compressed_len += 3 + s->opt_len;
#endif
}
@@ -1007,7 +1007,7 @@ void _tr_flush_block(s, buf, stored_len, eof)
if (eof) {
bi_windup(s);
-#ifdef DEBUG
+#ifdef DEBUG_LIBZ
s->compressed_len += 7; /* align on byte boundary */
#endif
}
@@ -1185,7 +1185,7 @@ local void bi_windup(s)
}
s->bi_buf = 0;
s->bi_valid = 0;
-#ifdef DEBUG
+#ifdef DEBUG_LIBZ
s->bits_sent = (s->bits_sent+7) & ~7;
#endif
}
@@ -1206,11 +1206,11 @@ local void copy_block(s, buf, len, header)
if (header) {
put_short(s, (ush)len);
put_short(s, (ush)~len);
-#ifdef DEBUG
+#ifdef DEBUG_LIBZ
s->bits_sent += 2*16;
#endif
}
-#ifdef DEBUG
+#ifdef DEBUG_LIBZ
s->bits_sent += (ulg)len<<3;
#endif
while (len--) {
diff --git a/sys/lib/libz/zutil.c b/sys/lib/libz/zutil.c
index 2e5ae3d62d8..ab68c4df9ca 100644
--- a/sys/lib/libz/zutil.c
+++ b/sys/lib/libz/zutil.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: zutil.c,v 1.1 2011/07/07 02:57:24 deraadt Exp $ */
+/* $OpenBSD: zutil.c,v 1.2 2011/07/16 07:25:29 jsing Exp $ */
/* zutil.c -- target dependent utility functions for the compression library
* Copyright (C) 1995-2005 Jean-loup Gailly.
* For conditions of distribution and use, see copyright notice in zlib.h
@@ -58,7 +58,7 @@ uLong ZEXPORT zlibCompileFlags()
case 8: flags += 2 << 6; break;
default: flags += 3 << 6;
}
-#ifdef DEBUG
+#ifdef DEBUG_LIBZ
flags += 1 << 8;
#endif
#if defined(ASMV) || defined(ASMINF)
@@ -112,7 +112,7 @@ uLong ZEXPORT zlibCompileFlags()
return flags;
}
-#ifdef DEBUG
+#ifdef DEBUG_LIBZ
# ifndef verbose
# define verbose 0