summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2019-04-02 10:26:30 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2019-04-02 10:30:11 -0700
commitbe0c5581e38332b2ffa8a4cf92076cfde02872b4 (patch)
treef8bc0ca02f36ff9ba82871d45cc92913c903ca11 /util.c
parent7a6f9c9c3267185a299ad178607ac5e3716ab4a5 (diff)
downloadgzip-be0c5581e38332b2ffa8a4cf92076cfde02872b4.tar.gz
Improve IBM Z patch
Most of this is minor changes to use GNU style and C99 constructs. * NEWS: Mention IBM Z. * bootstrap.conf (gnulib_modules): Add stdalign. * dfltcc.c: Include stdalign.h, stdbool.h. (union aligned_dfltcc_qaf_param, union aligned_dfltcc_param_v0): New types, used for C11-style alignment. All uses changed. (init_param): * gzip.c (BUFFER_ALIGNED): New macro. (inbuf, outbuf, window): Use it, so buffers are aligned everywhere. * gzip.h (INBUFSIZ, OUTBUFSIZE): Use big buffers everywhere, unless SMALL_MEM. * zip.c (SLOW, FAST): Now enums since they need not be macros:
Diffstat (limited to 'util.c')
-rw-r--r--util.c30
1 files changed, 12 insertions, 18 deletions
diff --git a/util.c b/util.c
index dc00f4a..dc66b20 100644
--- a/util.c
+++ b/util.c
@@ -96,10 +96,8 @@ static const ulg crc_32_tab[] = {
0x2d02ef8dL
};
-/* ========================================================================
- * Shift register contents
- */
-static ulg crc = (ulg)0xffffffffL;
+/* Shift register contents. */
+static ulg crc = 0xffffffffL;
/* ===========================================================================
* Copy input to output unchanged: zcat == cat with --force.
@@ -148,21 +146,18 @@ ulg updcrc(s, n)
return c ^ 0xffffffffL; /* (instead of ~c for 64-bit machines) */
}
-/* ===========================================================================
- * Return a current CRC value.
- */
-ulg getcrc()
+/* Return a current CRC value. */
+ulg
+getcrc (void)
{
- return crc ^ 0xffffffffL;
+ return crc ^ 0xffffffffL;
}
-/* ===========================================================================
- * Set a new CRC value.
- */
-void setcrc(c)
- ulg c;
+/* Set a new CRC value. */
+void
+setcrc (ulg c)
{
- crc = c ^ 0xffffffffL;
+ crc = c ^ 0xffffffffL;
}
/* ===========================================================================
@@ -258,9 +253,8 @@ void flush_outbuf()
{
if (outcnt == 0) return;
- if (!test) {
- write_buf(ofd, (char *)outbuf, outcnt);
- }
+ if (!test)
+ write_buf (ofd, outbuf, outcnt);
bytes_out += (off_t)outcnt;
outcnt = 0;
}