Rev 5222 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5222 | Rev 6324 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | /* compress-debug.c - compress debug sections |
1 | /* compress-debug.c - compress debug sections |
2 | Copyright 2010 Free Software Foundation, Inc. |
2 | Copyright (C) 2010-2015 Free Software Foundation, Inc. |
Line 3... | Line 3... | ||
3 | 3 | ||
Line 4... | Line 4... | ||
4 | This file is part of GAS, the GNU Assembler. |
4 | This file is part of GAS, the GNU Assembler. |
5 | 5 | ||
Line 18... | Line 18... | ||
18 | Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA |
18 | Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA |
19 | 02110-1301, USA. */ |
19 | 02110-1301, USA. */ |
Line 20... | Line 20... | ||
20 | 20 | ||
21 | #include "config.h" |
21 | #include "config.h" |
- | 22 | #include |
|
22 | #include |
23 | #include |
23 | #include "ansidecl.h" |
24 | #include "ansidecl.h" |
Line 24... | Line -... | ||
24 | #include "compress-debug.h" |
- | |
25 | - | ||
26 | #ifdef HAVE_ZLIB_H |
- | |
27 | #include |
- | |
28 | #endif |
25 | #include "compress-debug.h" |
Line 29... | Line 26... | ||
29 | 26 | ||
30 | /* Initialize the compression engine. */ |
27 | /* Initialize the compression engine. */ |
31 | 28 | ||
32 | struct z_stream_s * |
- | |
33 | compress_init (void) |
- | |
34 | { |
- | |
35 | #ifndef HAVE_ZLIB_H |
29 | struct z_stream_s * |
Line 36... | Line 30... | ||
36 | return NULL; |
30 | compress_init (void) |
37 | #else |
31 | { |
38 | static struct z_stream_s strm; |
32 | static struct z_stream_s strm; |
39 | 33 | ||
40 | strm.zalloc = NULL; |
34 | strm.zalloc = NULL; |
41 | strm.zfree = NULL; |
- | |
42 | strm.opaque = NULL; |
35 | strm.zfree = NULL; |
Line 43... | Line 36... | ||
43 | deflateInit (&strm, Z_DEFAULT_COMPRESSION); |
36 | strm.opaque = NULL; |
44 | return &strm; |
37 | deflateInit (&strm, Z_DEFAULT_COMPRESSION); |
Line 45... | Line 38... | ||
45 | #endif /* HAVE_ZLIB_H */ |
38 | return &strm; |
46 | } |
39 | } |
47 | 40 | ||
48 | /* Stream the contents of a frag to the compression engine. Output |
- | |
49 | from the engine goes into the current frag on the obstack. */ |
- | |
50 | - | ||
51 | int |
41 | /* Stream the contents of a frag to the compression engine. Output |
52 | compress_data (struct z_stream_s *strm ATTRIBUTE_UNUSED, |
- | |
53 | const char **next_in ATTRIBUTE_UNUSED, |
- | |
54 | int *avail_in ATTRIBUTE_UNUSED, |
- | |
55 | char **next_out ATTRIBUTE_UNUSED, |
42 | from the engine goes into the current frag on the obstack. */ |
56 | int *avail_out ATTRIBUTE_UNUSED) |
43 | |
Line 57... | Line 44... | ||
57 | { |
44 | int |
58 | #ifndef HAVE_ZLIB_H |
45 | compress_data (struct z_stream_s *strm, const char **next_in, |
Line 75... | Line 62... | ||
75 | *avail_in = strm->avail_in; |
62 | *avail_in = strm->avail_in; |
76 | *next_out = (char *) (strm->next_out); |
63 | *next_out = (char *) (strm->next_out); |
77 | *avail_out = strm->avail_out; |
64 | *avail_out = strm->avail_out; |
Line 78... | Line 65... | ||
78 | 65 | ||
79 | return out_size; |
- | |
80 | #endif /* HAVE_ZLIB_H */ |
66 | return out_size; |
Line 81... | Line 67... | ||
81 | } |
67 | } |
82 | 68 | ||
83 | /* Finish the compression and consume the remaining compressed output. |
69 | /* Finish the compression and consume the remaining compressed output. |
Line 84... | Line 70... | ||
84 | Returns -1 for error, 0 when done, 1 when more output buffer is |
70 | Returns -1 for error, 0 when done, 1 when more output buffer is |
85 | needed. */ |
71 | needed. */ |
86 | - | ||
87 | int |
72 | |
88 | compress_finish (struct z_stream_s *strm ATTRIBUTE_UNUSED, |
- | |
89 | char **next_out ATTRIBUTE_UNUSED, |
73 | int |
90 | int *avail_out ATTRIBUTE_UNUSED, |
- | |
91 | int *out_size ATTRIBUTE_UNUSED) |
- | |
92 | { |
- | |
93 | #ifndef HAVE_ZLIB_H |
74 | compress_finish (struct z_stream_s *strm, char **next_out, |
Line 94... | Line 75... | ||
94 | return -1; |
75 | int *avail_out, int *out_size) |
95 | #else |
76 | { |
96 | int x; |
77 | int x; |
Line 111... | Line 92... | ||
111 | return 0; |
92 | return 0; |
112 | } |
93 | } |
113 | if (strm->avail_out != 0) |
94 | if (strm->avail_out != 0) |
114 | return -1; |
95 | return -1; |
115 | return 1; |
96 | return 1; |
116 | #endif /* HAVE_ZLIB_H */ |
- | |
117 | } |
97 | } |