b5844f
From be0c5581e38332b2ffa8a4cf92076cfde02872b4 Mon Sep 17 00:00:00 2001
b5844f
From: Paul Eggert <eggert@cs.ucla.edu>
b5844f
Date: Tue, 2 Apr 2019 10:26:30 -0700
b5844f
Subject: Improve IBM Z patch
b5844f
b5844f
Most of this is minor changes to use GNU style and C99 constructs.
b5844f
* NEWS: Mention IBM Z.
b5844f
* bootstrap.conf (gnulib_modules): Add stdalign.
b5844f
* dfltcc.c: Include stdalign.h, stdbool.h.
b5844f
(union aligned_dfltcc_qaf_param, union aligned_dfltcc_param_v0):
b5844f
New types, used for C11-style alignment.  All uses changed.
b5844f
(init_param):
b5844f
* gzip.c (BUFFER_ALIGNED): New macro.
b5844f
(inbuf, outbuf, window): Use it, so buffers are aligned everywhere.
b5844f
* gzip.h (INBUFSIZ, OUTBUFSIZE): Use big buffers everywhere,
b5844f
unless SMALL_MEM.
b5844f
* zip.c (SLOW, FAST): Now enums since they need not be macros:
b5844f
---
b5844f
 NEWS           |   4 +
b5844f
 bootstrap.conf |   1 +
b5844f
 deflate.c      |   8 +-
b5844f
 dfltcc.c       | 632 +++++++++++++++++++++++++++++----------------------------
b5844f
 gzip.c         |  27 ++-
b5844f
 gzip.h         |  16 +-
b5844f
 lib/.gitignore |   1 +
b5844f
 m4/.gitignore  |   1 +
b5844f
 unzip.c        |   2 +-
b5844f
 util.c         |  30 ++-
b5844f
 zip.c          |  24 +--
b5844f
 11 files changed, 376 insertions(+), 370 deletions(-)
b5844f
b5844f
diff --git a/deflate.c b/deflate.c
b5844f
index 869b902..eb697af 100644
b5844f
--- a/deflate.c
b5844f
+++ b/deflate.c
b5844f
@@ -718,7 +718,8 @@ local off_t deflate_fast()
b5844f
  * evaluation for matches: a match is finally adopted only if there is
b5844f
  * no better match at the next window position.
b5844f
  */
b5844f
-off_t deflate(int pack_level)
b5844f
+off_t
b5844f
+deflate (int pack_level)
b5844f
 {
b5844f
     IPos hash_head;          /* head of hash chain */
b5844f
     IPos prev_match;         /* previous match */
b5844f
@@ -726,8 +727,9 @@ off_t deflate(int pack_level)
b5844f
     int match_available = 0; /* set if previous match exists */
b5844f
     register unsigned match_length = MIN_MATCH-1; /* length of best match */
b5844f
 
b5844f
-    lm_init(pack_level);
b5844f
-    if (pack_level <= 3) return deflate_fast(); /* optimized for speed */
b5844f
+    lm_init (pack_level);
b5844f
+    if (pack_level <= 3)
b5844f
+      return deflate_fast();
b5844f
 
b5844f
     /* Process the input block. */
b5844f
     while (lookahead != 0) {
b5844f
diff --git a/dfltcc.c b/dfltcc.c
b5844f
index 9010475..ba62968 100644
b5844f
--- a/dfltcc.c
b5844f
+++ b/dfltcc.c
b5844f
@@ -17,16 +17,20 @@
b5844f
    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
b5844f
 
b5844f
 #include <config.h>
b5844f
+
b5844f
+#include <stdalign.h>
b5844f
+#include <stdbool.h>
b5844f
 #include <stdlib.h>
b5844f
+
b5844f
 #ifdef DFLTCC_USDT
b5844f
-#include <sys/sdt.h>
b5844f
+# include <sys/sdt.h>
b5844f
 #endif
b5844f
 
b5844f
 #include "tailor.h"
b5844f
 #include "gzip.h"
b5844f
 
b5844f
 #ifdef DYN_ALLOC
b5844f
-    error: DYN_ALLOC is not supported by DFLTCC
b5844f
+# error "DYN_ALLOC is not supported by DFLTCC"
b5844f
 #endif
b5844f
 
b5844f
 /* ===========================================================================
b5844f
@@ -35,11 +39,11 @@
b5844f
 
b5844f
 typedef enum
b5844f
 {
b5844f
-    DFLTCC_CC_OK = 0,
b5844f
-    DFLTCC_CC_OP1_TOO_SHORT = 1,
b5844f
-    DFLTCC_CC_OP2_TOO_SHORT = 2,
b5844f
-    DFLTCC_CC_OP2_CORRUPT = 2,
b5844f
-    DFLTCC_CC_AGAIN = 3,
b5844f
+ DFLTCC_CC_OK = 0,
b5844f
+ DFLTCC_CC_OP1_TOO_SHORT = 1,
b5844f
+ DFLTCC_CC_OP2_TOO_SHORT = 2,
b5844f
+ DFLTCC_CC_OP2_CORRUPT = 2,
b5844f
+ DFLTCC_CC_AGAIN = 3,
b5844f
 } dfltcc_cc;
b5844f
 
b5844f
 #define DFLTCC_QAF 0
b5844f
@@ -47,383 +51,391 @@ typedef enum
b5844f
 #define DFLTCC_CMPR 2
b5844f
 #define DFLTCC_XPND 4
b5844f
 #define HBT_CIRCULAR (1 << 7)
b5844f
-//#define HB_BITS 15
b5844f
-//#define HB_SIZE (1 << HB_BITS)
b5844f
+/* #define HB_BITS 15 */
b5844f
+/* #define HB_SIZE (1 << HB_BITS) */
b5844f
 #define DFLTCC_FACILITY 151
b5844f
 #define DFLTCC_FMT0 0
b5844f
 #define CVT_CRC32 0
b5844f
 #define HTT_FIXED 0
b5844f
 #define HTT_DYNAMIC 1
b5844f
 
b5844f
+#ifndef DFLTCC_BLOCK_SIZE
b5844f
+# define DFLTCC_BLOCK_SIZE 1048576
b5844f
+#endif
b5844f
+#ifndef DFLTCC_FIRST_FHT_BLOCK_SIZE
b5844f
+# define DFLTCC_FIRST_FHT_BLOCK_SIZE 4096
b5844f
+#endif
b5844f
+#ifndef DFLTCC_LEVEL_MASK
b5844f
+# define DFLTCC_LEVEL_MASK 0x2
b5844f
+#endif
b5844f
+#ifndef DFLTCC_RIBM
b5844f
+# define DFLTCC_RIBM 0
b5844f
+#endif
b5844f
+
b5844f
+#define MAX(a, b) ((a) > (b) ? (a) : (b))
b5844f
+
b5844f
 struct dfltcc_qaf_param
b5844f
 {
b5844f
-    char fns[16];
b5844f
-    char reserved1[8];
b5844f
-    char fmts[2];
b5844f
-    char reserved2[6];
b5844f
+  char fns[16];
b5844f
+  char reserved1[8];
b5844f
+  char fmts[2];
b5844f
+  char reserved2[6];
b5844f
+};
b5844f
+
b5844f
+union aligned_dfltcc_qaf_param
b5844f
+{
b5844f
+  struct dfltcc_qaf_param af;
b5844f
+  char alignas (8) aligned;
b5844f
 };
b5844f
 
b5844f
 struct dfltcc_param_v0
b5844f
 {
b5844f
-    unsigned short pbvn;               /* Parameter-Block-Version Number */
b5844f
-    unsigned char mvn;                 /* Model-Version Number */
b5844f
-    unsigned char ribm;                /* Reserved for IBM use */
b5844f
-    unsigned reserved32 : 31;
b5844f
-    unsigned cf : 1;                   /* Continuation Flag */
b5844f
-    unsigned char reserved64[8];
b5844f
-    unsigned nt : 1;                   /* New Task */
b5844f
-    unsigned reserved129 : 1;
b5844f
-    unsigned cvt : 1;                  /* Check Value Type */
b5844f
-    unsigned reserved131 : 1;
b5844f
-    unsigned htt : 1;                  /* Huffman-Table Type */
b5844f
-    unsigned bcf : 1;                  /* Block-Continuation Flag */
b5844f
-    unsigned bcc : 1;                  /* Block Closing Control */
b5844f
-    unsigned bhf : 1;                  /* Block Header Final */
b5844f
-    unsigned reserved136 : 1;
b5844f
-    unsigned reserved137 : 1;
b5844f
-    unsigned dhtgc : 1;                /* DHT Generation Control */
b5844f
-    unsigned reserved139 : 5;
b5844f
-    unsigned reserved144 : 5;
b5844f
-    unsigned sbb : 3;                  /* Sub-Byte Boundary */
b5844f
-    unsigned char oesc;                /* Operation-Ending-Supplemental Code */
b5844f
-    unsigned reserved160 : 12;
b5844f
-    unsigned ifs : 4;                  /* Incomplete-Function Status */
b5844f
-    unsigned short ifl;                /* Incomplete-Function Length */
b5844f
-    unsigned char reserved192[8];
b5844f
-    unsigned char reserved256[8];
b5844f
-    unsigned char reserved320[4];
b5844f
-    unsigned short hl;                 /* History Length */
b5844f
-    unsigned reserved368 : 1;
b5844f
-    unsigned short ho : 15;            /* History Offset */
b5844f
-    unsigned int cv;                   /* Check Value */
b5844f
-    unsigned eobs : 15;                /* End-of-block Symbol */
b5844f
-    unsigned reserved431 : 1;
b5844f
-    unsigned char eobl : 4;            /* End-of-block Length */
b5844f
-    unsigned reserved436 : 12;
b5844f
-    unsigned reserved448 : 4;
b5844f
-    unsigned short cdhtl : 12;         /* Compressed-Dynamic-Huffman Table
b5844f
-                                          Length */
b5844f
-    unsigned char reserved464[6];
b5844f
-    unsigned char cdht[288];
b5844f
-    unsigned char reserved[32];
b5844f
-    unsigned char csb[1152];
b5844f
+  unsigned short pbvn;               /* Parameter-Block-Version Number */
b5844f
+  unsigned char mvn;                 /* Model-Version Number */
b5844f
+  unsigned char ribm;                /* Reserved for IBM use */
b5844f
+  unsigned reserved32 : 31;
b5844f
+  unsigned cf : 1;                   /* Continuation Flag */
b5844f
+  unsigned char reserved64[8];
b5844f
+  unsigned nt : 1;                   /* New Task */
b5844f
+  unsigned reserved129 : 1;
b5844f
+  unsigned cvt : 1;                  /* Check Value Type */
b5844f
+  unsigned reserved131 : 1;
b5844f
+  unsigned htt : 1;                  /* Huffman-Table Type */
b5844f
+  unsigned bcf : 1;                  /* Block-Continuation Flag */
b5844f
+  unsigned bcc : 1;                  /* Block Closing Control */
b5844f
+  unsigned bhf : 1;                  /* Block Header Final */
b5844f
+  unsigned reserved136 : 1;
b5844f
+  unsigned reserved137 : 1;
b5844f
+  unsigned dhtgc : 1;                /* DHT Generation Control */
b5844f
+  unsigned reserved139 : 5;
b5844f
+  unsigned reserved144 : 5;
b5844f
+  unsigned sbb : 3;                  /* Sub-Byte Boundary */
b5844f
+  unsigned char oesc;                /* Operation-Ending-Supplemental Code */
b5844f
+  unsigned reserved160 : 12;
b5844f
+  unsigned ifs : 4;                  /* Incomplete-Function Status */
b5844f
+  unsigned short ifl;                /* Incomplete-Function Length */
b5844f
+  unsigned char reserved192[8];
b5844f
+  unsigned char reserved256[8];
b5844f
+  unsigned char reserved320[4];
b5844f
+  unsigned short hl;                 /* History Length */
b5844f
+  unsigned reserved368 : 1;
b5844f
+  unsigned short ho : 15;            /* History Offset */
b5844f
+  unsigned int cv;                   /* Check Value */
b5844f
+  unsigned eobs : 15;                /* End-of-block Symbol */
b5844f
+  unsigned reserved431 : 1;
b5844f
+  unsigned char eobl : 4;            /* End-of-block Length */
b5844f
+  unsigned reserved436 : 12;
b5844f
+  unsigned reserved448 : 4;
b5844f
+  unsigned short cdhtl : 12;         /* Compressed-Dynamic-Huffman Table
b5844f
+                                        Length */
b5844f
+  unsigned char reserved464[6];
b5844f
+  unsigned char cdht[288];
b5844f
+  unsigned char reserved[32];
b5844f
+  unsigned char csb[1152];
b5844f
 };
b5844f
 
b5844f
-static int is_bit_set(const char *bits, int n)
b5844f
+union aligned_dfltcc_param_v0
b5844f
 {
b5844f
-    return bits[n / 8] & (1 << (7 - (n % 8)));
b5844f
+  struct dfltcc_param_v0 param;
b5844f
+  char alignas (8) aligned;
b5844f
+};
b5844f
+
b5844f
+static int
b5844f
+is_bit_set (const char *bits, int n)
b5844f
+{
b5844f
+  return bits[n / 8] & (1 << (7 - (n % 8)));
b5844f
 }
b5844f
 
b5844f
-static int is_dfltcc_enabled(void)
b5844f
+static int
b5844f
+is_dfltcc_enabled (void)
b5844f
 {
b5844f
-    const char *env;
b5844f
-    char facilities[((DFLTCC_FACILITY / 64) + 1) * 8];
b5844f
-    register int r0 __asm__("r0");
b5844f
+  char facilities[(DFLTCC_FACILITY / 64 + 1) * 8];
b5844f
 
b5844f
-    env = getenv("DFLTCC");
b5844f
-    if (env && !strcmp(env, "0")) {
b5844f
-        return 0;
b5844f
-    }
b5844f
+  char const *env = getenv ("DFLTCC");
b5844f
+  if (env && !strcmp (env, "0"))
b5844f
+    return 0;
b5844f
 
b5844f
-    r0 = sizeof(facilities) / 8;
b5844f
-    __asm__("stfle %[facilities]\n"
b5844f
-            : [facilities] "=Q"(facilities) : [r0] "r"(r0) : "cc", "memory");
b5844f
-    return is_bit_set((const char *) facilities, DFLTCC_FACILITY);
b5844f
+  register int r0 __asm__ ("r0") = sizeof facilities / 8;
b5844f
+  __asm__ ("stfle %[facilities]\n"
b5844f
+           : [facilities] "=Q"(facilities) : [r0] "r"(r0) : "cc", "memory");
b5844f
+  return is_bit_set (facilities, DFLTCC_FACILITY);
b5844f
 }
b5844f
 
b5844f
-static dfltcc_cc dfltcc(int fn, void *param,
b5844f
-                        uch **op1, size_t *len1,
b5844f
-                        const uch **op2, size_t *len2,
b5844f
-                        void *hist)
b5844f
+static dfltcc_cc
b5844f
+dfltcc (int fn, void *param,
b5844f
+        uch **op1, size_t *len1,
b5844f
+        uch const **op2, size_t *len2,
b5844f
+        void *hist)
b5844f
 {
b5844f
-    uch *t2 = op1 ? *op1 : NULL;
b5844f
-    size_t t3 = len1 ? *len1 : 0;
b5844f
-    const uch *t4 = op2 ? *op2 : NULL;
b5844f
-    size_t t5 = len2 ? *len2 : 0;
b5844f
-    register int r0 __asm__("r0") = fn;
b5844f
-    register void *r1 __asm__("r1") = param;
b5844f
-    register uch *r2 __asm__("r2") = t2;
b5844f
-    register size_t r3 __asm__("r3") = t3;
b5844f
-    register const uch *r4 __asm__("r4") = t4;
b5844f
-    register size_t r5 __asm__("r5") = t5;
b5844f
-    int cc;
b5844f
-
b5844f
-    __asm__ volatile(
b5844f
+  uch *t2 = op1 ? *op1 : NULL;
b5844f
+  size_t t3 = len1 ? *len1 : 0;
b5844f
+  const uch *t4 = op2 ? *op2 : NULL;
b5844f
+  size_t t5 = len2 ? *len2 : 0;
b5844f
+  register int r0 __asm__ ("r0") = fn;
b5844f
+  register void *r1 __asm__ ("r1") = param;
b5844f
+  register uch *r2 __asm__ ("r2") = t2;
b5844f
+  register size_t r3 __asm__ ("r3") = t3;
b5844f
+  register const uch *r4 __asm__ ("r4") = t4;
b5844f
+  register size_t r5 __asm__ ("r5") = t5;
b5844f
+  int cc;
b5844f
+
b5844f
+  __asm__ volatile (
b5844f
 #ifdef DFLTCC_USDT
b5844f
-                     STAP_PROBE_ASM(zlib, dfltcc_entry,
b5844f
-                                    STAP_PROBE_ASM_TEMPLATE(5))
b5844f
+                    STAP_PROBE_ASM (zlib, dfltcc_entry,
b5844f
+                                    STAP_PROBE_ASM_TEMPLATE (5))
b5844f
 #endif
b5844f
-                     ".insn rrf,0xb9390000,%[r2],%[r4],%[hist],0\n"
b5844f
+                    ".insn rrf,0xb9390000,%[r2],%[r4],%[hist],0\n"
b5844f
 #ifdef DFLTCC_USDT
b5844f
-                     STAP_PROBE_ASM(zlib, dfltcc_exit,
b5844f
-                                    STAP_PROBE_ASM_TEMPLATE(5))
b5844f
+                    STAP_PROBE_ASM (zlib, dfltcc_exit,
b5844f
+                                    STAP_PROBE_ASM_TEMPLATE (5))
b5844f
 #endif
b5844f
-                     "ipm %[cc]\n"
b5844f
-                     : [r2] "+r" (r2)
b5844f
-                     , [r3] "+r" (r3)
b5844f
-                     , [r4] "+r" (r4)
b5844f
-                     , [r5] "+r" (r5)
b5844f
-                     , [cc] "=r" (cc)
b5844f
-                     : [r0] "r" (r0)
b5844f
-                     , [r1] "r" (r1)
b5844f
-                     , [hist] "r" (hist)
b5844f
+                    "ipm %[cc]\n"
b5844f
+                    : [r2] "+r" (r2)
b5844f
+                      , [r3] "+r" (r3)
b5844f
+                      , [r4] "+r" (r4)
b5844f
+                      , [r5] "+r" (r5)
b5844f
+                      , [cc] "=r" (cc)
b5844f
+                    : [r0] "r" (r0)
b5844f
+                      , [r1] "r" (r1)
b5844f
+                      , [hist] "r" (hist)
b5844f
 #ifdef DFLTCC_USDT
b5844f
-                     , STAP_PROBE_ASM_OPERANDS(5, r2, r3, r4, r5, hist)
b5844f
+                      , STAP_PROBE_ASM_OPERANDS (5, r2, r3, r4, r5, hist)
b5844f
 #endif
b5844f
-                     : "cc", "memory");
b5844f
-    t2 = r2; t3 = r3; t4 = r4; t5 = r5;
b5844f
-
b5844f
-    if (op1)
b5844f
-        *op1 = t2;
b5844f
-    if (len1)
b5844f
-        *len1 = t3;
b5844f
-    if (op2)
b5844f
-        *op2 = t4;
b5844f
-    if (len2)
b5844f
-        *len2 = t5;
b5844f
-    return (cc >> 28) & 3;
b5844f
+                    : "cc", "memory");
b5844f
+  t2 = r2; t3 = r3; t4 = r4; t5 = r5;
b5844f
+
b5844f
+  if (op1)
b5844f
+    *op1 = t2;
b5844f
+  if (len1)
b5844f
+    *len1 = t3;
b5844f
+  if (op2)
b5844f
+    *op2 = t4;
b5844f
+  if (len2)
b5844f
+    *len2 = t5;
b5844f
+  return (cc >> 28) & 3;
b5844f
 }
b5844f
 
b5844f
-static void dfltcc_qaf(struct dfltcc_qaf_param *param)
b5844f
+static void
b5844f
+dfltcc_qaf (struct dfltcc_qaf_param *param)
b5844f
 {
b5844f
-    dfltcc(DFLTCC_QAF, param, NULL, NULL, NULL, NULL, NULL);
b5844f
+  dfltcc (DFLTCC_QAF, param, NULL, NULL, NULL, NULL, NULL);
b5844f
 }
b5844f
 
b5844f
-static void dfltcc_gdht(struct dfltcc_param_v0 *param)
b5844f
+static void
b5844f
+dfltcc_gdht (struct dfltcc_param_v0 *param)
b5844f
 {
b5844f
-    const uch *next_in = inbuf + inptr;
b5844f
-    size_t avail_in = insize - inptr;
b5844f
+  const uch *next_in = inbuf + inptr;
b5844f
+  size_t avail_in = insize - inptr;
b5844f
 
b5844f
-    dfltcc(DFLTCC_GDHT, param, NULL, NULL, &next_in, &avail_in, NULL);
b5844f
+  dfltcc (DFLTCC_GDHT, param, NULL, NULL, &next_in, &avail_in, NULL);
b5844f
 }
b5844f
 
b5844f
 static off_t total_in;
b5844f
 
b5844f
-static dfltcc_cc dfltcc_cmpr_xpnd(struct dfltcc_param_v0 *param, int fn)
b5844f
+static dfltcc_cc
b5844f
+dfltcc_cmpr_xpnd (struct dfltcc_param_v0 *param, int fn)
b5844f
 {
b5844f
-    uch *next_out = outbuf + outcnt;
b5844f
-    size_t avail_out = OUTBUFSIZ - outcnt;
b5844f
-    const uch *next_in = inbuf + inptr;
b5844f
-    size_t avail_in = insize - inptr;
b5844f
-    off_t consumed_in;
b5844f
-    dfltcc_cc cc;
b5844f
-
b5844f
-    cc = dfltcc(fn | HBT_CIRCULAR, param,
b5844f
-                &next_out, &avail_out,
b5844f
-                &next_in, &avail_in,
b5844f
-                window);
b5844f
-    consumed_in = next_in - (inbuf + inptr);
b5844f
-    inptr += consumed_in;
b5844f
-    total_in += consumed_in;
b5844f
-    outcnt += ((OUTBUFSIZ - outcnt) - avail_out);
b5844f
-    return cc;
b5844f
+  uch *next_out = outbuf + outcnt;
b5844f
+  size_t avail_out = OUTBUFSIZ - outcnt;
b5844f
+  const uch *next_in = inbuf + inptr;
b5844f
+  size_t avail_in = insize - inptr;
b5844f
+  dfltcc_cc cc = dfltcc (fn | HBT_CIRCULAR, param,
b5844f
+                         &next_out, &avail_out,
b5844f
+                         &next_in, &avail_in,
b5844f
+                         window);
b5844f
+  off_t consumed_in = next_in - (inbuf + inptr);
b5844f
+  inptr += consumed_in;
b5844f
+  total_in += consumed_in;
b5844f
+  outcnt += ((OUTBUFSIZ - outcnt) - avail_out);
b5844f
+  return cc;
b5844f
 }
b5844f
 
b5844f
-__attribute__((aligned(8)))
b5844f
-static struct context
b5844f
+static struct dfltcc_param_v0 *
b5844f
+init_param (union aligned_dfltcc_param_v0 *ctx)
b5844f
 {
b5844f
-    union
b5844f
-    {
b5844f
-        struct dfltcc_qaf_param af;
b5844f
-        struct dfltcc_param_v0 param;
b5844f
-    };
b5844f
-} ctx;
b5844f
-
b5844f
-static struct dfltcc_param_v0 *init_param(struct dfltcc_param_v0 *param)
b5844f
-{
b5844f
-    const char *s;
b5844f
-
b5844f
-    memset(param, 0, sizeof(*param));
b5844f
-#ifndef DFLTCC_RIBM
b5844f
-#define DFLTCC_RIBM 0
b5844f
-#endif
b5844f
-    s = getenv("DFLTCC_RIBM");
b5844f
-    param->ribm = (s && *s) ? strtoul(s, NULL, 0) : DFLTCC_RIBM;
b5844f
-    param->nt = 1;
b5844f
-    param->cvt = CVT_CRC32;
b5844f
-    param->cv = __builtin_bswap32(getcrc());
b5844f
-    return param;
b5844f
+  char const *s = getenv ("DFLTCC_RIBM");
b5844f
+  struct dfltcc_param_v0 *param = &ctx->param;
b5844f
+  memset (param, 0, sizeof *param);
b5844f
+  param->ribm = s && *s ? strtoul (s, NULL, 0) : DFLTCC_RIBM;
b5844f
+  param->nt = 1;
b5844f
+  param->cvt = CVT_CRC32;
b5844f
+  param->cv = __builtin_bswap32 (getcrc ());
b5844f
+  return param;
b5844f
 }
b5844f
 
b5844f
-static void bi_close_block(struct dfltcc_param_v0 *param)
b5844f
+static void
b5844f
+bi_close_block (struct dfltcc_param_v0 *param)
b5844f
 {
b5844f
-    bi_valid = param->sbb;
b5844f
-    bi_buf = bi_valid == 0 ? 0 : outbuf[outcnt] & ((1 << bi_valid) - 1);
b5844f
-    send_bits(
b5844f
-        bi_reverse(param->eobs >> (15 - param->eobl), param->eobl),
b5844f
-        param->eobl);
b5844f
-    param->bcf = 0;
b5844f
+  bi_valid = param->sbb;
b5844f
+  bi_buf = bi_valid == 0 ? 0 : outbuf[outcnt] & ((1 << bi_valid) - 1);
b5844f
+  send_bits (bi_reverse (param->eobs >> (15 - param->eobl), param->eobl),
b5844f
+             param->eobl);
b5844f
+  param->bcf = 0;
b5844f
 }
b5844f
 
b5844f
-static void close_block(struct dfltcc_param_v0 *param)
b5844f
+static void
b5844f
+close_block (struct dfltcc_param_v0 *param)
b5844f
 {
b5844f
-    bi_close_block(param);
b5844f
-    bi_windup();
b5844f
-    param->sbb = (param->sbb + param->eobl) % 8;
b5844f
-    if (param->sbb != 0) {
b5844f
-        Assert(outcnt > 0, "outbuf must have enough space for EOBS");
b5844f
-        outcnt--;
b5844f
+  bi_close_block (param);
b5844f
+  bi_windup ();
b5844f
+  param->sbb = (param->sbb + param->eobl) % 8;
b5844f
+  if (param->sbb != 0)
b5844f
+    {
b5844f
+      Assert (outcnt > 0, "outbuf must have enough space for EOBS");
b5844f
+      outcnt--;
b5844f
     }
b5844f
 }
b5844f
 
b5844f
-static void close_stream(struct dfltcc_param_v0 *param)
b5844f
+static void
b5844f
+close_stream (struct dfltcc_param_v0 *param)
b5844f
 {
b5844f
-    if (param->bcf) {
b5844f
-        bi_close_block(param);
b5844f
-    }
b5844f
-    send_bits(1, 3); /* BFINAL=1, BTYPE=00 */
b5844f
-    bi_windup();
b5844f
-    put_short(0x0000);
b5844f
-    put_short(0xFFFF);
b5844f
+  if (param->bcf)
b5844f
+    bi_close_block (param);
b5844f
+  send_bits (1, 3); /* BFINAL=1, BTYPE=00 */
b5844f
+  bi_windup ();
b5844f
+  put_short (0x0000);
b5844f
+  put_short (0xFFFF);
b5844f
 }
b5844f
 
b5844f
-#define MAX(a, b) ((a) > (b) ? (a) : (b))
b5844f
+/* Compress ifd into ofd in hardware or fall back to software.  */
b5844f
 
b5844f
-/* ===========================================================================
b5844f
- * Compress ifd into ofd in hardware or fall back to software.
b5844f
- */
b5844f
-int dfltcc_deflate(int pack_level)
b5844f
+int
b5844f
+dfltcc_deflate (int pack_level)
b5844f
 {
b5844f
-    const char *s;
b5844f
-    unsigned long level_mask;
b5844f
-    unsigned long block_size;
b5844f
-    off_t block_threshold;
b5844f
-    struct dfltcc_param_v0 *param;
b5844f
-    int extra;
b5844f
-
b5844f
-    /* Check whether we can use hardware compression */
b5844f
-    if (!is_dfltcc_enabled() || getenv("SOURCE_DATE_EPOCH")) {
b5844f
-        return deflate(pack_level);
b5844f
-    }
b5844f
-#ifndef DFLTCC_LEVEL_MASK
b5844f
-#define DFLTCC_LEVEL_MASK 0x2
b5844f
-#endif
b5844f
-    s = getenv("DFLTCC_LEVEL_MASK");
b5844f
-    level_mask = (s && *s) ? strtoul(s, NULL, 0) : DFLTCC_LEVEL_MASK;
b5844f
-    if ((level_mask & (1 << pack_level)) == 0) {
b5844f
-        return deflate(pack_level);
b5844f
-    }
b5844f
-    dfltcc_qaf(&ctx.af);
b5844f
-    if (!is_bit_set(ctx.af.fns, DFLTCC_CMPR) ||
b5844f
-        !is_bit_set(ctx.af.fns, DFLTCC_GDHT) ||
b5844f
-        !is_bit_set(ctx.af.fmts, DFLTCC_FMT0)) {
b5844f
-        return deflate(pack_level);
b5844f
-    }
b5844f
-
b5844f
-    /* Initialize tuning parameters */
b5844f
-#ifndef DFLTCC_BLOCK_SIZE
b5844f
-#define DFLTCC_BLOCK_SIZE 1048576
b5844f
-#endif
b5844f
-    s = getenv("DFLTCC_BLOCK_SIZE");
b5844f
-    block_size = (s && *s) ? strtoul(s, NULL, 0) : DFLTCC_BLOCK_SIZE;
b5844f
-    (void)block_size;
b5844f
-#ifndef DFLTCC_FIRST_FHT_BLOCK_SIZE
b5844f
-#define DFLTCC_FIRST_FHT_BLOCK_SIZE 4096
b5844f
-#endif
b5844f
-    s = getenv("DFLTCC_FIRST_FHT_BLOCK_SIZE");
b5844f
-    block_threshold = (s && *s) ? strtoul(s, NULL, 0) :
b5844f
-                                  DFLTCC_FIRST_FHT_BLOCK_SIZE;
b5844f
-
b5844f
-    /* Compress ifd into ofd in a loop */
b5844f
-    param = init_param(&ctx.param);
b5844f
-    while (1) {
b5844f
-        /* Flush the output data */
b5844f
-        if (outcnt > OUTBUFSIZ - 8) {
b5844f
-            flush_outbuf();
b5844f
-        }
b5844f
-
b5844f
-        /* Close the block */
b5844f
-        if (param->bcf && total_in == block_threshold && !param->cf) {
b5844f
-            close_block(param);
b5844f
-            block_threshold += block_size;
b5844f
+  /* Check whether we can use hardware compression.  */
b5844f
+  if (!is_dfltcc_enabled () || getenv ("SOURCE_DATE_EPOCH"))
b5844f
+    return deflate (pack_level);
b5844f
+  char const *s = getenv ("DFLTCC_LEVEL_MASK");
b5844f
+  unsigned long level_mask
b5844f
+    = s && *s ? strtoul (s, NULL, 0) : DFLTCC_LEVEL_MASK;
b5844f
+  if ((level_mask & (1 << pack_level)) == 0)
b5844f
+    return deflate (pack_level);
b5844f
+  union aligned_dfltcc_qaf_param ctx;
b5844f
+  dfltcc_qaf (&ctx.af);
b5844f
+  if (!is_bit_set (ctx.af.fns, DFLTCC_CMPR)
b5844f
+      || !is_bit_set (ctx.af.fns, DFLTCC_GDHT)
b5844f
+      || !is_bit_set (ctx.af.fmts, DFLTCC_FMT0))
b5844f
+    return deflate (pack_level);
b5844f
+
b5844f
+  /* Initialize tuning parameters.  */
b5844f
+  s = getenv ("DFLTCC_BLOCK_SIZE");
b5844f
+  unsigned long block_size
b5844f
+    = s && *s ? strtoul (s, NULL, 0) : DFLTCC_BLOCK_SIZE;
b5844f
+
b5844f
+  s = getenv ("DFLTCC_FIRST_FHT_BLOCK_SIZE");
b5844f
+  off_t block_threshold
b5844f
+    = s && *s ? strtoul (s, NULL, 0) : DFLTCC_FIRST_FHT_BLOCK_SIZE;
b5844f
+
b5844f
+  union aligned_dfltcc_param_v0 ctx_v0;
b5844f
+  struct dfltcc_param_v0 *param = init_param (&ctx_v0);
b5844f
+
b5844f
+  /* Compress ifd into ofd in a loop.  */
b5844f
+  while (true)
b5844f
+    {
b5844f
+      /* Flush the output data.  */
b5844f
+      if (outcnt > OUTBUFSIZ - 8)
b5844f
+        flush_outbuf ();
b5844f
+
b5844f
+      /* Close the block.  */
b5844f
+      if (param->bcf && total_in == block_threshold && !param->cf)
b5844f
+        {
b5844f
+          close_block (param);
b5844f
+          block_threshold += block_size;
b5844f
         }
b5844f
 
b5844f
-        /* Read the input data */
b5844f
-        if (inptr == insize) {
b5844f
-            if (fill_inbuf(1) == EOF && !param->cf) {
b5844f
-                break;
b5844f
-            }
b5844f
-            inptr = 0;
b5844f
+      /* Read the input data.  */
b5844f
+      if (inptr == insize)
b5844f
+        {
b5844f
+          if (fill_inbuf (1) == EOF && !param->cf)
b5844f
+            break;
b5844f
+          inptr = 0;
b5844f
         }
b5844f
 
b5844f
-        /* Temporarily mask some input data */
b5844f
-        extra = MAX(0, total_in + (insize - inptr) - block_threshold);
b5844f
-        insize -= extra;
b5844f
-
b5844f
-        /* Start a new block */
b5844f
-        if (!param->bcf) {
b5844f
-            if (total_in == 0 && block_threshold > 0) {
b5844f
-                param->htt = HTT_FIXED;
b5844f
-            } else {
b5844f
-                param->htt = HTT_DYNAMIC;
b5844f
-                dfltcc_gdht(param);
b5844f
-            }
b5844f
+      /* Temporarily mask some input data.  */
b5844f
+      int extra = MAX (0, total_in + (insize - inptr) - block_threshold);
b5844f
+      insize -= extra;
b5844f
+
b5844f
+      /* Start a new block.  */
b5844f
+      if (!param->bcf)
b5844f
+        {
b5844f
+          if (total_in == 0 && block_threshold > 0)
b5844f
+            param->htt = HTT_FIXED;
b5844f
+          else {
b5844f
+            param->htt = HTT_DYNAMIC;
b5844f
+            dfltcc_gdht (param);
b5844f
+          }
b5844f
         }
b5844f
 
b5844f
-        /* Compress inbuf into outbuf */
b5844f
-        dfltcc_cmpr_xpnd(param, DFLTCC_CMPR);
b5844f
+      /* Compress inbuf into outbuf.  */
b5844f
+      dfltcc_cmpr_xpnd (param, DFLTCC_CMPR);
b5844f
 
b5844f
-        /* Unmask the input data */
b5844f
-        insize += extra;
b5844f
+      /* Unmask the input data.  */
b5844f
+      insize += extra;
b5844f
 
b5844f
-        /* Continue the block */
b5844f
-        param->bcf = 1;
b5844f
+      /* Continue the block */
b5844f
+      param->bcf = 1;
b5844f
     }
b5844f
-    close_stream(param);
b5844f
-    setcrc(__builtin_bswap32(param->cv));
b5844f
-    return 0;
b5844f
+
b5844f
+  close_stream (param);
b5844f
+  setcrc (__builtin_bswap32 (param->cv));
b5844f
+  return 0;
b5844f
 }
b5844f
 
b5844f
-/* ===========================================================================
b5844f
- * Decompress ifd into ofd in hardware or fall back to software.
b5844f
- */
b5844f
-int dfltcc_inflate(void)
b5844f
+/* Decompress ifd into ofd in hardware or fall back to software.  */
b5844f
+int
b5844f
+dfltcc_inflate (void)
b5844f
 {
b5844f
-    struct dfltcc_param_v0 *param;
b5844f
-    dfltcc_cc cc;
b5844f
-
b5844f
-    /* Check whether we can use hardware decompression */
b5844f
-    if (!is_dfltcc_enabled()) {
b5844f
-        return inflate();
b5844f
-    }
b5844f
-    dfltcc_qaf(&ctx.af);
b5844f
-    if (!is_bit_set(ctx.af.fns, DFLTCC_XPND)) {
b5844f
-        return inflate();
b5844f
-    }
b5844f
-
b5844f
-    /* Decompress ifd into ofd in a loop */
b5844f
-    param = init_param(&ctx.param);
b5844f
-    while (1) {
b5844f
-        /* Perform I/O */
b5844f
-        if (outcnt == OUTBUFSIZ) {
b5844f
-            flush_outbuf();
b5844f
-        }
b5844f
-        if (inptr == insize) {
b5844f
-            if (fill_inbuf(1) == EOF) {
b5844f
-                /* Premature EOF */
b5844f
-                return 2;
b5844f
+  /* Check whether we can use hardware decompression.  */
b5844f
+  if (!is_dfltcc_enabled ())
b5844f
+    return inflate ();
b5844f
+  union aligned_dfltcc_qaf_param ctx;
b5844f
+  dfltcc_qaf (&ctx.af);
b5844f
+  if (!is_bit_set (ctx.af.fns, DFLTCC_XPND))
b5844f
+    return inflate ();
b5844f
+
b5844f
+  union aligned_dfltcc_param_v0 ctx_v0;
b5844f
+  struct dfltcc_param_v0 *param = init_param (&ctx_v0);
b5844f
+
b5844f
+  /* Decompress ifd into ofd in a loop.  */
b5844f
+  while (true)
b5844f
+    {
b5844f
+      /* Perform I/O.  */
b5844f
+      if (outcnt == OUTBUFSIZ)
b5844f
+        flush_outbuf ();
b5844f
+      if (inptr == insize)
b5844f
+        {
b5844f
+          if (fill_inbuf (1) == EOF)
b5844f
+            {
b5844f
+              /* Premature EOF.  */
b5844f
+              return 2;
b5844f
             }
b5844f
-            inptr = 0;
b5844f
+          inptr = 0;
b5844f
         }
b5844f
-        /* Decompress inbuf into outbuf */
b5844f
-        cc = dfltcc_cmpr_xpnd(param, DFLTCC_XPND);
b5844f
-        if (cc == DFLTCC_CC_OK) {
b5844f
-            /* The entire deflate stream has been successfully decompressed */
b5844f
+
b5844f
+        /* Decompress inbuf into outbuf.  */
b5844f
+        dfltcc_cc cc = dfltcc_cmpr_xpnd (param, DFLTCC_XPND);
b5844f
+        if (cc == DFLTCC_CC_OK)
b5844f
+          {
b5844f
+            /* The entire deflate stream has been successfully decompressed.  */
b5844f
             break;
b5844f
-        }
b5844f
-        if (cc == DFLTCC_CC_OP2_CORRUPT && param->oesc != 0) {
b5844f
-            /* The deflate stream is corrupted */
b5844f
+          }
b5844f
+        if (cc == DFLTCC_CC_OP2_CORRUPT && param->oesc != 0)
b5844f
+          {
b5844f
+            /* The deflate stream is corrupted.  */
b5844f
             return 2;
b5844f
-        }
b5844f
-        /* There must be more data to decompress */
b5844f
+          }
b5844f
+        /* There must be more data to decompress.  */
b5844f
     }
b5844f
-    if (param->sbb != 0) {
b5844f
-        /* The deflate stream has ended in the middle of a byte - go to the next
b5844f
-         * byte boundary, so that unzip() can read CRC and length.
b5844f
-         */
b5844f
-        inptr++;
b5844f
+
b5844f
+  if (param->sbb != 0)
b5844f
+    {
b5844f
+      /* The deflate stream has ended in the middle of a byte.  Go to
b5844f
+        the next byte boundary, so that unzip can read CRC and length.  */
b5844f
+      inptr++;
b5844f
     }
b5844f
-    setcrc(__builtin_bswap32(param->cv)); /* set CRC value for unzip() */
b5844f
-    flush_outbuf(); /* update bytes_out for unzip() */
b5844f
-    return 0;
b5844f
+
b5844f
+  /* Set CRC value and update bytes_out for unzip.  */
b5844f
+  setcrc (__builtin_bswap32 (param->cv));
b5844f
+  flush_outbuf ();
b5844f
+  return 0;
b5844f
 }
b5844f
diff --git a/gzip.c b/gzip.c
b5844f
index 4fffc4f..f29edaf 100644
b5844f
--- a/gzip.c
b5844f
+++ b/gzip.c
b5844f
@@ -58,6 +58,7 @@ static char const *const license_msg[] = {
b5844f
 #include <ctype.h>
b5844f
 #include <sys/types.h>
b5844f
 #include <signal.h>
b5844f
+#include <stdalign.h>
b5844f
 #include <stdbool.h>
b5844f
 #include <stddef.h>
b5844f
 #include <sys/stat.h>
b5844f
@@ -128,22 +129,20 @@ static char const *const license_msg[] = {
b5844f
 
b5844f
                 /* global buffers */
b5844f
 
b5844f
-#ifdef IBM_Z_DFLTCC
b5844f
-/* DEFLATE COMPRESSION CALL works faster with page-aligned input buffers */
b5844f
-__attribute__((aligned(4096)))
b5844f
-#endif
b5844f
-DECLARE(uch, inbuf,  INBUFSIZ +INBUF_EXTRA);
b5844f
-#ifdef IBM_Z_DFLTCC
b5844f
-/* DEFLATE COMPRESSION CALL works faster with page-aligned output buffers */
b5844f
-__attribute__((aligned(4096)))
b5844f
+/* With IBM_Z_DFLTCC, DEFLATE COMPRESSION works faster with
b5844f
+   page-aligned input and output buffers, and requires page-aligned
b5844f
+   windows; the alignment requirement is 4096.  On other platforms
b5844f
+   alignment doesn't hurt, and alignment up to 8192 is portable so
b5844f
+   let's do that.  */
b5844f
+#ifdef __alignas_is_defined
b5844f
+# define BUFFER_ALIGNED alignas (8192)
b5844f
+#else
b5844f
+# define BUFFER_ALIGNED /**/
b5844f
 #endif
b5844f
-DECLARE(uch, outbuf, OUTBUFSIZ+OUTBUF_EXTRA);
b5844f
+DECLARE(uch BUFFER_ALIGNED, inbuf,  INBUFSIZ +INBUF_EXTRA);
b5844f
+DECLARE(uch BUFFER_ALIGNED, outbuf, OUTBUFSIZ+OUTBUF_EXTRA);
b5844f
 DECLARE(ush, d_buf,  DIST_BUFSIZE);
b5844f
-#ifdef IBM_Z_DFLTCC
b5844f
-/* DEFLATE COMPRESSION CALL works only with page-aligned windows */
b5844f
-__attribute__((aligned(4096)))
b5844f
-#endif
b5844f
-DECLARE(uch, window, 2L*WSIZE);
b5844f
+DECLARE(uch BUFFER_ALIGNED, window, 2L*WSIZE);
b5844f
 #ifndef MAXSEG_64K
b5844f
     DECLARE(ush, tab_prefix, 1L<
b5844f
 #else
b5844f
diff --git a/gzip.h b/gzip.h
b5844f
index 0c59cc2..9a2babd 100644
b5844f
--- a/gzip.h
b5844f
+++ b/gzip.h
b5844f
@@ -74,25 +74,19 @@ extern int method;         /* compression method */
b5844f
  */
b5844f
 
b5844f
 #ifndef	INBUFSIZ
b5844f
-#  ifdef IBM_Z_DFLTCC
b5844f
-/* DEFLATE COMPRESSION CALL works faster with larger input buffers */
b5844f
-#    define INBUFSIZ  0x40000
b5844f
-#  elif defined SMALL_MEM
b5844f
+#  ifdef SMALL_MEM
b5844f
 #    define INBUFSIZ  0x2000  /* input buffer size */
b5844f
 #  else
b5844f
-#    define INBUFSIZ  0x8000  /* input buffer size */
b5844f
+#    define INBUFSIZ  0x40000 /* input buffer size */
b5844f
 #  endif
b5844f
 #endif
b5844f
 #define INBUF_EXTRA  64     /* required by unlzw() */
b5844f
 
b5844f
 #ifndef	OUTBUFSIZ
b5844f
-#  ifdef IBM_Z_DFLTCC
b5844f
-/* DEFLATE COMPRESSION CALL works faster with larger output buffers */
b5844f
-#    define OUTBUFSIZ   0x40000
b5844f
-#  elif defined SMALL_MEM
b5844f
+#  ifdef SMALL_MEM
b5844f
 #    define OUTBUFSIZ   8192  /* output buffer size */
b5844f
 #  else
b5844f
-#    define OUTBUFSIZ  16384  /* output buffer size */
b5844f
+#    define OUTBUFSIZ 0x40000 /* output buffer size */
b5844f
 #  endif
b5844f
 #endif
b5844f
 #define OUTBUF_EXTRA 2048   /* required by unlzw() */
b5844f
@@ -291,7 +285,7 @@ extern off_t flush_block (char *buf, ulg stored_len, int pad, int eof);
b5844f
 
b5844f
         /* in bits.c */
b5844f
 extern unsigned short bi_buf;
b5844f
-extern int            bi_valid;
b5844f
+extern int bi_valid;
b5844f
 extern void     bi_init    (file_t zipfile);
b5844f
 extern void     send_bits  (int value, int length);
b5844f
 extern unsigned bi_reverse (unsigned value, int length) _GL_ATTRIBUTE_CONST;
b5844f
diff --git a/unzip.c b/unzip.c
b5844f
index 86ef664..6d9bf68 100644
b5844f
--- a/unzip.c
b5844f
+++ b/unzip.c
b5844f
@@ -130,7 +130,7 @@ int unzip(in, out)
b5844f
     if (method == DEFLATED)  {
b5844f
 
b5844f
 #ifdef IBM_Z_DFLTCC
b5844f
-        int res = dfltcc_inflate();
b5844f
+        int res = dfltcc_inflate ();
b5844f
 #else
b5844f
         int res = inflate();
b5844f
 #endif
b5844f
diff --git a/util.c b/util.c
b5844f
index dc00f4a..dc66b20 100644
b5844f
--- a/util.c
b5844f
+++ b/util.c
b5844f
@@ -96,10 +96,8 @@ static const ulg crc_32_tab[] = {
b5844f
   0x2d02ef8dL
b5844f
 };
b5844f
 
b5844f
-/* ========================================================================
b5844f
- * Shift register contents
b5844f
- */
b5844f
-static ulg crc = (ulg)0xffffffffL;
b5844f
+/* Shift register contents.  */
b5844f
+static ulg crc = 0xffffffffL;
b5844f
 
b5844f
 /* ===========================================================================
b5844f
  * Copy input to output unchanged: zcat == cat with --force.
b5844f
@@ -148,21 +146,18 @@ ulg updcrc(s, n)
b5844f
     return c ^ 0xffffffffL;       /* (instead of ~c for 64-bit machines) */
b5844f
 }
b5844f
 
b5844f
-/* ===========================================================================
b5844f
- * Return a current CRC value.
b5844f
- */
b5844f
-ulg getcrc()
b5844f
+/* Return a current CRC value.  */
b5844f
+ulg
b5844f
+getcrc (void)
b5844f
 {
b5844f
-    return crc ^ 0xffffffffL;
b5844f
+  return crc ^ 0xffffffffL;
b5844f
 }
b5844f
 
b5844f
-/* ===========================================================================
b5844f
- * Set a new CRC value.
b5844f
- */
b5844f
-void setcrc(c)
b5844f
-    ulg c;
b5844f
+/* Set a new CRC value.  */
b5844f
+void
b5844f
+setcrc (ulg c)
b5844f
 {
b5844f
-    crc = c ^ 0xffffffffL;
b5844f
+  crc = c ^ 0xffffffffL;
b5844f
 }
b5844f
 
b5844f
 /* ===========================================================================
b5844f
@@ -258,9 +253,8 @@ void flush_outbuf()
b5844f
 {
b5844f
     if (outcnt == 0) return;
b5844f
 
b5844f
-    if (!test) {
b5844f
-        write_buf(ofd, (char *)outbuf, outcnt);
b5844f
-    }
b5844f
+    if (!test)
b5844f
+      write_buf (ofd, outbuf, outcnt);
b5844f
     bytes_out += (off_t)outcnt;
b5844f
     outcnt = 0;
b5844f
 }
b5844f
diff --git a/zip.c b/zip.c
b5844f
index ace7e5e..0f12d5e 100644
b5844f
--- a/zip.c
b5844f
+++ b/zip.c
b5844f
@@ -25,9 +25,8 @@
b5844f
 
b5844f
 off_t header_bytes;   /* number of bytes in gzip header */
b5844f
 
b5844f
-#define FAST 4
b5844f
-#define SLOW 2
b5844f
-/* speed options for the general purpose bit flag */
b5844f
+/* Speed options for the general purpose bit flag.  */
b5844f
+enum { SLOW = 2, FAST = 4 };
b5844f
 
b5844f
 /* ===========================================================================
b5844f
  * Deflate in to out.
b5844f
@@ -71,15 +70,14 @@ int zip(in, out)
b5844f
     put_long (stamp);
b5844f
 
b5844f
     /* Write deflated file to zip file */
b5844f
-    updcrc(NULL, 0);
b5844f
+    updcrc (NULL, 0);
b5844f
 
b5844f
     bi_init(out);
b5844f
     ct_init(&attr, &method);
b5844f
-    if (level == 1) {
b5844f
-        deflate_flags |= FAST;
b5844f
-    } else if (level == 9) {
b5844f
-        deflate_flags |= SLOW;
b5844f
-    }
b5844f
+    if (level == 1)
b5844f
+      deflate_flags |= FAST;
b5844f
+    else if (level == 9)
b5844f
+      deflate_flags |= SLOW;
b5844f
 
b5844f
     put_byte((uch)deflate_flags); /* extra flags */
b5844f
     put_byte(OS_CODE);            /* OS identifier */
b5844f
@@ -93,9 +91,9 @@ int zip(in, out)
b5844f
     header_bytes = (off_t)outcnt;
b5844f
 
b5844f
 #ifdef IBM_Z_DFLTCC
b5844f
-    (void)dfltcc_deflate(level);
b5844f
+    dfltcc_deflate (level);
b5844f
 #else
b5844f
-    (void)deflate(level);
b5844f
+    deflate (level);
b5844f
 #endif
b5844f
 
b5844f
 #ifndef NO_SIZE_CHECK
b5844f
@@ -109,7 +107,7 @@ int zip(in, out)
b5844f
 #endif
b5844f
 
b5844f
     /* Write the crc and uncompressed size */
b5844f
-    put_long(getcrc());
b5844f
+    put_long (getcrc ());
b5844f
     put_long((ulg)bytes_in);
b5844f
     header_bytes += 2*4;
b5844f
 
b5844f
@@ -137,7 +135,7 @@ int file_read(buf, size)
b5844f
         return EOF;
b5844f
     }
b5844f
 
b5844f
-    updcrc((uch*)buf, len);
b5844f
+    updcrc ((uch *) buf, len);
b5844f
     bytes_in += (off_t)len;
b5844f
     return (int)len;
b5844f
 }