Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
f7bb70ab
Commit
f7bb70ab
authored
Jun 07, 2003
by
Jörn Engel
Committed by
Linus Torvalds
Jun 07, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] zlib cleanup: Z_NULL removal
s/Z_NULL/NULL/g.
parent
74030092
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
52 additions
and
54 deletions
+52
-54
include/linux/zlib.h
include/linux/zlib.h
+4
-6
include/linux/zutil.h
include/linux/zutil.h
+2
-2
lib/zlib_deflate/deflate.c
lib/zlib_deflate/deflate.c
+14
-14
lib/zlib_inflate/infblock.c
lib/zlib_inflate/infblock.c
+9
-9
lib/zlib_inflate/inflate.c
lib/zlib_inflate/inflate.c
+17
-17
lib/zlib_inflate/inftrees.c
lib/zlib_inflate/inftrees.c
+4
-4
lib/zlib_inflate/infutil.c
lib/zlib_inflate/infutil.c
+2
-2
No files found.
include/linux/zlib.h
View file @
f7bb70ab
...
...
@@ -91,7 +91,7 @@ typedef z_stream *z_streamp;
memory management. The compression library attaches no meaning to the
opaque value.
zalloc must return
Z_
NULL if there is not enough memory for the object.
zalloc must return NULL if there is not enough memory for the object.
If zlib is used in a multi-threaded application, zalloc and zfree must be
thread safe.
...
...
@@ -153,8 +153,6 @@ typedef z_stream *z_streamp;
#define Z_DEFLATED 8
/* The deflate compression method (the only one supported in this version) */
#define Z_NULL 0
/* for initializing zalloc, zfree, opaque */
/* basic functions */
extern
const
char
*
zlib_zlibVersion
(
void
);
...
...
@@ -176,7 +174,7 @@ extern int deflateInit (z_streamp strm, int level);
Initializes the internal stream state for compression. The fields
zalloc, zfree and opaque must be initialized before by the caller.
If zalloc and zfree are set to
Z_
NULL, deflateInit updates them to
If zalloc and zfree are set to NULL, deflateInit updates them to
use default allocation functions.
The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9:
...
...
@@ -298,11 +296,11 @@ extern int zlib_inflateInit (z_streamp strm);
Initializes the internal stream state for decompression. The fields
next_in, avail_in, and workspace must be initialized before by
the caller. If next_in is not
Z_
NULL and avail_in is large enough (the exact
the caller. If next_in is not NULL and avail_in is large enough (the exact
value depends on the compression method), inflateInit determines the
compression method from the zlib header and allocates all data structures
accordingly; otherwise the allocation will be deferred to the first call of
inflate. If zalloc and zfree are set to
Z_
NULL, inflateInit updates them to
inflate. If zalloc and zfree are set to NULL, inflateInit updates them to
use default allocation functions.
inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough
...
...
include/linux/zutil.h
View file @
f7bb70ab
...
...
@@ -81,7 +81,7 @@ typedef uLong (*check_func) (uLong check, const Byte *buf,
An Adler-32 checksum is almost as reliable as a CRC32 but can be computed
much faster. Usage example:
uLong adler = adler32(0L,
Z_
NULL, 0);
uLong adler = adler32(0L, NULL, 0);
while (read_buffer(buffer, length) != EOF) {
adler = adler32(adler, buffer, length);
...
...
@@ -96,7 +96,7 @@ static inline uLong zlib_adler32(uLong adler,
unsigned
long
s2
=
(
adler
>>
16
)
&
0xffff
;
int
k
;
if
(
buf
==
Z_
NULL
)
return
1L
;
if
(
buf
==
NULL
)
return
1L
;
while
(
len
>
0
)
{
k
=
len
<
NMAX
?
len
:
NMAX
;
...
...
lib/zlib_deflate/deflate.c
View file @
f7bb70ab
...
...
@@ -199,13 +199,13 @@ int zlib_deflateInit2_(
* output size for (length,distance) codes is <= 24 bits.
*/
if
(
version
==
Z_
NULL
||
version
[
0
]
!=
my_version
[
0
]
||
if
(
version
==
NULL
||
version
[
0
]
!=
my_version
[
0
]
||
stream_size
!=
sizeof
(
z_stream
))
{
return
Z_VERSION_ERROR
;
}
if
(
strm
==
Z_
NULL
)
return
Z_STREAM_ERROR
;
if
(
strm
==
NULL
)
return
Z_STREAM_ERROR
;
strm
->
msg
=
Z_
NULL
;
strm
->
msg
=
NULL
;
if
(
level
==
Z_DEFAULT_COMPRESSION
)
level
=
6
;
...
...
@@ -266,7 +266,7 @@ int zlib_deflateSetDictionary(
uInt
n
;
IPos
hash_head
=
0
;
if
(
strm
==
Z_NULL
||
strm
->
state
==
Z_NULL
||
dictionary
==
Z_
NULL
)
if
(
strm
==
NULL
||
strm
->
state
==
NULL
||
dictionary
==
NULL
)
return
Z_STREAM_ERROR
;
s
=
(
deflate_state
*
)
strm
->
state
;
...
...
@@ -305,11 +305,11 @@ int zlib_deflateReset(
{
deflate_state
*
s
;
if
(
strm
==
Z_NULL
||
strm
->
state
==
Z_
NULL
)
if
(
strm
==
NULL
||
strm
->
state
==
NULL
)
return
Z_STREAM_ERROR
;
strm
->
total_in
=
strm
->
total_out
=
0
;
strm
->
msg
=
Z_
NULL
;
strm
->
msg
=
NULL
;
strm
->
data_type
=
Z_UNKNOWN
;
s
=
(
deflate_state
*
)
strm
->
state
;
...
...
@@ -340,7 +340,7 @@ int zlib_deflateParams(
compress_func
func
;
int
err
=
Z_OK
;
if
(
strm
==
Z_NULL
||
strm
->
state
==
Z_
NULL
)
return
Z_STREAM_ERROR
;
if
(
strm
==
NULL
||
strm
->
state
==
NULL
)
return
Z_STREAM_ERROR
;
s
=
(
deflate_state
*
)
strm
->
state
;
if
(
level
==
Z_DEFAULT_COMPRESSION
)
{
...
...
@@ -396,7 +396,7 @@ static void flush_pending(
if
(
len
>
strm
->
avail_out
)
len
=
strm
->
avail_out
;
if
(
len
==
0
)
return
;
if
(
strm
->
next_out
!=
Z_
NULL
)
{
if
(
strm
->
next_out
!=
NULL
)
{
memcpy
(
strm
->
next_out
,
s
->
pending_out
,
len
);
strm
->
next_out
+=
len
;
}
...
...
@@ -418,13 +418,13 @@ int zlib_deflate(
int
old_flush
;
/* value of flush param for previous deflate call */
deflate_state
*
s
;
if
(
strm
==
Z_NULL
||
strm
->
state
==
Z_
NULL
||
if
(
strm
==
NULL
||
strm
->
state
==
NULL
||
flush
>
Z_FINISH
||
flush
<
0
)
{
return
Z_STREAM_ERROR
;
}
s
=
(
deflate_state
*
)
strm
->
state
;
if
((
strm
->
next_in
==
Z_
NULL
&&
strm
->
avail_in
!=
0
)
||
if
((
strm
->
next_in
==
NULL
&&
strm
->
avail_in
!=
0
)
||
(
s
->
status
==
FINISH_STATE
&&
flush
!=
Z_FINISH
))
{
return
Z_STREAM_ERROR
;
}
...
...
@@ -555,7 +555,7 @@ int zlib_deflateEnd(
int
status
;
deflate_state
*
s
;
if
(
strm
==
Z_NULL
||
strm
->
state
==
Z_
NULL
)
return
Z_STREAM_ERROR
;
if
(
strm
==
NULL
||
strm
->
state
==
NULL
)
return
Z_STREAM_ERROR
;
s
=
(
deflate_state
*
)
strm
->
state
;
status
=
s
->
status
;
...
...
@@ -564,7 +564,7 @@ int zlib_deflateEnd(
return
Z_STREAM_ERROR
;
}
strm
->
state
=
Z_
NULL
;
strm
->
state
=
NULL
;
return
status
==
BUSY_STATE
?
Z_DATA_ERROR
:
Z_OK
;
}
...
...
@@ -586,7 +586,7 @@ int zlib_deflateCopy (
deflate_workspace
*
mem
;
if
(
source
==
Z_NULL
||
dest
==
Z_NULL
||
source
->
state
==
Z_
NULL
)
{
if
(
source
==
NULL
||
dest
==
NULL
||
source
->
state
==
NULL
)
{
return
Z_STREAM_ERROR
;
}
...
...
@@ -968,7 +968,7 @@ static void fill_window(s)
#define FLUSH_BLOCK_ONLY(s, eof) { \
zlib_tr_flush_block(s, (s->block_start >= 0L ? \
(char *)&s->window[(unsigned)s->block_start] : \
(char *)
Z_
NULL), \
(char *)NULL), \
(ulg)((long)s->strstart - s->block_start), \
(eof)); \
s->block_start = s->strstart; \
...
...
lib/zlib_inflate/infblock.c
View file @
f7bb70ab
...
...
@@ -71,7 +71,7 @@ void zlib_inflate_blocks_reset(
uLong
*
c
)
{
if
(
c
!=
Z_
NULL
)
if
(
c
!=
NULL
)
*
c
=
s
->
check
;
if
(
s
->
mode
==
CODES
)
zlib_inflate_codes_free
(
s
->
sub
.
decode
.
codes
,
z
);
...
...
@@ -79,8 +79,8 @@ void zlib_inflate_blocks_reset(
s
->
bitk
=
0
;
s
->
bitb
=
0
;
s
->
read
=
s
->
write
=
s
->
window
;
if
(
s
->
checkfn
!=
Z_
NULL
)
z
->
adler
=
s
->
check
=
(
*
s
->
checkfn
)(
0L
,
(
const
Byte
*
)
Z_
NULL
,
0
);
if
(
s
->
checkfn
!=
NULL
)
z
->
adler
=
s
->
check
=
(
*
s
->
checkfn
)(
0L
,
(
const
Byte
*
)
NULL
,
0
);
}
inflate_blocks_statef
*
zlib_inflate_blocks_new
(
...
...
@@ -97,7 +97,7 @@ inflate_blocks_statef *zlib_inflate_blocks_new(
s
->
end
=
s
->
window
+
w
;
s
->
checkfn
=
c
;
s
->
mode
=
TYPE
;
zlib_inflate_blocks_reset
(
s
,
z
,
Z_
NULL
);
zlib_inflate_blocks_reset
(
s
,
z
,
NULL
);
return
s
;
}
...
...
@@ -141,7 +141,7 @@ int zlib_inflate_blocks(
zlib_inflate_trees_fixed
(
&
bl
,
&
bd
,
&
tl
,
&
td
,
z
);
s
->
sub
.
decode
.
codes
=
zlib_inflate_codes_new
(
bl
,
bd
,
tl
,
td
,
z
);
if
(
s
->
sub
.
decode
.
codes
==
Z_
NULL
)
if
(
s
->
sub
.
decode
.
codes
==
NULL
)
{
r
=
Z_MEM_ERROR
;
LEAVE
...
...
@@ -270,7 +270,7 @@ int zlib_inflate_blocks(
s
->
sub
.
trees
.
index
=
i
;
}
}
s
->
sub
.
trees
.
tb
=
Z_
NULL
;
s
->
sub
.
trees
.
tb
=
NULL
;
{
uInt
bl
,
bd
;
inflate_huft
*
tl
,
*
td
;
...
...
@@ -289,7 +289,7 @@ int zlib_inflate_blocks(
r
=
t
;
LEAVE
}
if
((
c
=
zlib_inflate_codes_new
(
bl
,
bd
,
tl
,
td
,
z
))
==
Z_
NULL
)
if
((
c
=
zlib_inflate_codes_new
(
bl
,
bd
,
tl
,
td
,
z
))
==
NULL
)
{
r
=
Z_MEM_ERROR
;
LEAVE
...
...
@@ -333,7 +333,7 @@ int zlib_inflate_blocks_free(
z_streamp
z
)
{
zlib_inflate_blocks_reset
(
s
,
z
,
Z_
NULL
);
zlib_inflate_blocks_reset
(
s
,
z
,
NULL
);
return
Z_OK
;
}
...
...
@@ -351,7 +351,7 @@ void zlib_inflate_set_dictionary(
/* Returns true if inflate is currently at the end of a block generated
* by Z_SYNC_FLUSH or Z_FULL_FLUSH.
* IN assertion: s !=
Z_
NULL
* IN assertion: s != NULL
*/
int
zlib_inflate_blocks_sync_point
(
inflate_blocks_statef
*
s
...
...
lib/zlib_inflate/inflate.c
View file @
f7bb70ab
...
...
@@ -18,12 +18,12 @@ int zlib_inflateReset(
z_streamp
z
)
{
if
(
z
==
Z_NULL
||
z
->
state
==
Z_NULL
||
z
->
workspace
==
Z_
NULL
)
if
(
z
==
NULL
||
z
->
state
==
NULL
||
z
->
workspace
==
NULL
)
return
Z_STREAM_ERROR
;
z
->
total_in
=
z
->
total_out
=
0
;
z
->
msg
=
Z_
NULL
;
z
->
msg
=
NULL
;
z
->
state
->
mode
=
z
->
state
->
nowrap
?
BLOCKS
:
METHOD
;
zlib_inflate_blocks_reset
(
z
->
state
->
blocks
,
z
,
Z_
NULL
);
zlib_inflate_blocks_reset
(
z
->
state
->
blocks
,
z
,
NULL
);
return
Z_OK
;
}
...
...
@@ -32,11 +32,11 @@ int zlib_inflateEnd(
z_streamp
z
)
{
if
(
z
==
Z_NULL
||
z
->
state
==
Z_NULL
||
z
->
workspace
==
Z_
NULL
)
if
(
z
==
NULL
||
z
->
state
==
NULL
||
z
->
workspace
==
NULL
)
return
Z_STREAM_ERROR
;
if
(
z
->
state
->
blocks
!=
Z_
NULL
)
if
(
z
->
state
->
blocks
!=
NULL
)
zlib_inflate_blocks_free
(
z
->
state
->
blocks
,
z
);
z
->
state
=
Z_
NULL
;
z
->
state
=
NULL
;
return
Z_OK
;
}
...
...
@@ -48,16 +48,16 @@ int zlib_inflateInit2_(
int
stream_size
)
{
if
(
version
==
Z_
NULL
||
version
[
0
]
!=
ZLIB_VERSION
[
0
]
||
stream_size
!=
sizeof
(
z_stream
)
||
z
->
workspace
==
Z_
NULL
)
if
(
version
==
NULL
||
version
[
0
]
!=
ZLIB_VERSION
[
0
]
||
stream_size
!=
sizeof
(
z_stream
)
||
z
->
workspace
==
NULL
)
return
Z_VERSION_ERROR
;
/* initialize state */
if
(
z
==
Z_
NULL
)
if
(
z
==
NULL
)
return
Z_STREAM_ERROR
;
z
->
msg
=
Z_
NULL
;
z
->
msg
=
NULL
;
z
->
state
=
&
WS
(
z
)
->
internal_state
;
z
->
state
->
blocks
=
Z_
NULL
;
z
->
state
->
blocks
=
NULL
;
/* handle undocumented nowrap option (no zlib header or check) */
z
->
state
->
nowrap
=
0
;
...
...
@@ -77,8 +77,8 @@ int zlib_inflateInit2_(
/* create inflate_blocks state */
if
((
z
->
state
->
blocks
=
zlib_inflate_blocks_new
(
z
,
z
->
state
->
nowrap
?
Z_
NULL
:
zlib_adler32
,
(
uInt
)
1
<<
w
))
==
Z_
NULL
)
zlib_inflate_blocks_new
(
z
,
z
->
state
->
nowrap
?
NULL
:
zlib_adler32
,
(
uInt
)
1
<<
w
))
==
NULL
)
{
zlib_inflateEnd
(
z
);
return
Z_MEM_ERROR
;
...
...
@@ -125,7 +125,7 @@ int zlib_inflate(
int
r
,
trv
;
uInt
b
;
if
(
z
==
Z_NULL
||
z
->
state
==
Z_NULL
||
z
->
next_in
==
Z_
NULL
)
if
(
z
==
NULL
||
z
->
state
==
NULL
||
z
->
next_in
==
NULL
)
return
Z_STREAM_ERROR
;
trv
=
f
==
Z_FINISH
?
Z_BUF_ERROR
:
Z_OK
;
r
=
Z_BUF_ERROR
;
...
...
@@ -260,7 +260,7 @@ int zlib_inflateSync(
uLong
r
,
w
;
/* temporaries to save total_in and total_out */
/* set up */
if
(
z
==
Z_NULL
||
z
->
state
==
Z_
NULL
)
if
(
z
==
NULL
||
z
->
state
==
NULL
)
return
Z_STREAM_ERROR
;
if
(
z
->
state
->
mode
!=
I_BAD
)
{
...
...
@@ -313,7 +313,7 @@ int zlib_inflateSyncPoint(
z_streamp
z
)
{
if
(
z
==
Z_NULL
||
z
->
state
==
Z_NULL
||
z
->
state
->
blocks
==
Z_
NULL
)
if
(
z
==
NULL
||
z
->
state
==
NULL
||
z
->
state
->
blocks
==
NULL
)
return
Z_STREAM_ERROR
;
return
zlib_inflate_blocks_sync_point
(
z
->
state
->
blocks
);
}
...
...
@@ -352,7 +352,7 @@ static int zlib_inflate_addhistory(inflate_blocks_statef *s,
/* is there room until end of buffer? */
if
(
t
>
m
)
t
=
m
;
/* update check information */
if
(
s
->
checkfn
!=
Z_
NULL
)
if
(
s
->
checkfn
!=
NULL
)
s
->
check
=
(
*
s
->
checkfn
)(
s
->
check
,
q
,
t
);
memcpy
(
q
,
p
,
t
);
q
+=
t
;
...
...
lib/zlib_inflate/inftrees.c
View file @
f7bb70ab
...
...
@@ -139,7 +139,7 @@ static int huft_build(
}
while
(
--
i
);
if
(
c
[
0
]
==
n
)
/* null input--all zero length codes */
{
*
t
=
(
inflate_huft
*
)
Z_
NULL
;
*
t
=
(
inflate_huft
*
)
NULL
;
*
m
=
0
;
return
Z_OK
;
}
...
...
@@ -193,8 +193,8 @@ static int huft_build(
p
=
v
;
/* grab values in bit order */
h
=
-
1
;
/* no tables yet--level -1 */
w
=
-
l
;
/* bits decoded == (l * h) */
u
[
0
]
=
(
inflate_huft
*
)
Z_
NULL
;
/* just to keep compilers happy */
q
=
(
inflate_huft
*
)
Z_NULL
;
/* ditto */
u
[
0
]
=
(
inflate_huft
*
)
NULL
;
/* just to keep compilers happy */
q
=
(
inflate_huft
*
)
NULL
;
/* ditto */
z
=
0
;
/* ditto */
/* go through the bit lengths (k already is bits in shortest code) */
...
...
@@ -302,7 +302,7 @@ int zlib_inflate_trees_bits(
uInt
*
v
;
/* work area for huft_build */
v
=
WS
(
z
)
->
tree_work_area_1
;
r
=
huft_build
(
c
,
19
,
19
,
(
uInt
*
)
Z_NULL
,
(
uInt
*
)
Z_
NULL
,
r
=
huft_build
(
c
,
19
,
19
,
(
uInt
*
)
NULL
,
(
uInt
*
)
NULL
,
tb
,
bb
,
hp
,
&
hn
,
v
);
if
(
r
==
Z_DATA_ERROR
)
z
->
msg
=
(
char
*
)
"oversubscribed dynamic bit lengths tree"
;
...
...
lib/zlib_inflate/infutil.c
View file @
f7bb70ab
...
...
@@ -44,7 +44,7 @@ int zlib_inflate_flush(
z
->
total_out
+=
n
;
/* update check information */
if
(
s
->
checkfn
!=
Z_
NULL
)
if
(
s
->
checkfn
!=
NULL
)
z
->
adler
=
s
->
check
=
(
*
s
->
checkfn
)(
s
->
check
,
q
,
n
);
/* copy as far as end of window */
...
...
@@ -70,7 +70,7 @@ int zlib_inflate_flush(
z
->
total_out
+=
n
;
/* update check information */
if
(
s
->
checkfn
!=
Z_
NULL
)
if
(
s
->
checkfn
!=
NULL
)
z
->
adler
=
s
->
check
=
(
*
s
->
checkfn
)(
s
->
check
,
q
,
n
);
/* copy */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment