All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
	George Dunlap <george.dunlap@citrix.com>,
	Ian Jackson <iwj@xenproject.org>, Julien Grall <julien@xen.org>,
	Stefano Stabellini <sstabellini@kernel.org>, Wei Liu <wl@xen.org>
Subject: [PATCH v3 01/15] gunzip: drop INIT{,DATA} and STATIC
Date: Tue, 26 Jan 2021 10:50:43 +0100	[thread overview]
Message-ID: <b33f4fd3-e81a-a703-9fb5-a01880c2db9a@suse.com> (raw)
In-Reply-To: <2db91183-a7de-0c43-2fef-feb3523ed19b@suse.com>

There's no need for the extra abstraction.

Requested-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
v3: New.

--- a/xen/common/gunzip.c
+++ b/xen/common/gunzip.c
@@ -22,7 +22,6 @@ static unsigned __initdata inptr;
 static unsigned __initdata outcnt;
 
 #define OF(args)        args
-#define STATIC          static
 
 #define memzero(s, n)   memset((s), 0, (n))
 
@@ -30,9 +29,6 @@ typedef unsigned char   uch;
 typedef unsigned short  ush;
 typedef unsigned long   ulg;
 
-#define INIT            __init
-#define INITDATA        __initdata
-
 #define get_byte()      (inptr < insize ? inbuf[inptr++] : fill_inbuf())
 
 /* Diagnostic functions */
--- a/xen/common/inflate.c
+++ b/xen/common/inflate.c
@@ -107,7 +107,7 @@
 static char rcsid[] = "#Id: inflate.c,v 0.14 1993/06/10 13:27:04 jloup Exp #";
 #endif
 
-#ifndef STATIC
+#ifndef __XEN__
 
 #if defined(STDC_HEADERS) || defined(HAVE_STDLIB_H)
 #  include <sys/types.h>
@@ -115,14 +115,9 @@ static char rcsid[] = "#Id: inflate.c,v
 #endif
 
 #include "gzip.h"
-#define STATIC
-#endif /* !STATIC */
 
-#ifndef INIT
-#define INIT
-#define INITDATA
-#endif
- 
+#endif /* !__XEN__ */
+
 #define slide window
 
 /* Huffman code lookup table entry--this entry is four bytes for machines
@@ -143,15 +138,15 @@ struct huft {
 
 
 /* Function prototypes */
-STATIC int INIT huft_build OF((unsigned *, unsigned, unsigned, 
-                               const ush *, const ush *, struct huft **, int *));
-STATIC int INIT huft_free OF((struct huft *));
-STATIC int INIT inflate_codes OF((struct huft *, struct huft *, int, int));
-STATIC int INIT inflate_stored OF((void));
-STATIC int INIT inflate_fixed OF((void));
-STATIC int INIT inflate_dynamic OF((void));
-STATIC int INIT inflate_block OF((int *));
-STATIC int INIT inflate OF((void));
+static int huft_build OF((unsigned *, unsigned, unsigned,
+                          const ush *, const ush *, struct huft **, int *));
+static int huft_free OF((struct huft *));
+static int inflate_codes OF((struct huft *, struct huft *, int, int));
+static int inflate_stored OF((void));
+static int inflate_fixed OF((void));
+static int inflate_dynamic OF((void));
+static int inflate_block OF((int *));
+static int inflate OF((void));
 
 
 /* The inflate algorithm uses a sliding 32 K byte window on the uncompressed
@@ -217,10 +212,10 @@ static const ush cpdext[] = {         /*
    the stream.
  */
 
-STATIC ulg INITDATA bb;                /* bit buffer */
-STATIC unsigned INITDATA bk;           /* bits in bit buffer */
+static ulg __initdata bb;                /* bit buffer */
+static unsigned __initdata bk;           /* bits in bit buffer */
 
-STATIC const ush mask_bits[] = {
+static const ush mask_bits[] = {
     0x0000,
     0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff,
     0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff
@@ -235,10 +230,10 @@ STATIC const ush mask_bits[] = {
  *  malloc by Hannu Savolainen 1993 and Matthias Urlichs 1994
  */
 
-static unsigned long INITDATA malloc_ptr;
-static int INITDATA malloc_count;
+static unsigned long __initdata malloc_ptr;
+static int __initdata malloc_count;
 
-static void *INIT malloc(int size)
+static void *__init malloc(int size)
 {
     void *p;
 
@@ -259,7 +254,7 @@ static void *INIT malloc(int size)
     return p;
 }
 
-static void INIT free(void *where)
+static void __init free(void *where)
 {
     malloc_count--;
     if (!malloc_count)
@@ -303,8 +298,8 @@ static void INIT free(void *where)
  */
 
 
-STATIC const int lbits = 9;          /* bits in base literal/length lookup table */
-STATIC const int dbits = 6;          /* bits in base distance lookup table */
+static const int lbits = 9;          /* bits in base literal/length lookup table */
+static const int dbits = 6;          /* bits in base distance lookup table */
 
 
 /* If BMAX needs to be larger than 16, then h and x[] should be ulg. */
@@ -312,10 +307,10 @@ STATIC const int dbits = 6;          /*
 #define N_MAX 288       /* maximum number of codes in any set */
 
 
-STATIC unsigned INITDATA hufts;      /* track memory usage */
+static unsigned __initdata hufts;      /* track memory usage */
 
 
-STATIC int INIT huft_build(
+static int __init huft_build(
     unsigned *b,            /* code lengths in bits (all assumed <= BMAX) */
     unsigned n,             /* number of codes (assumed <= N_MAX) */
     unsigned s,             /* number of simple-valued codes (0..s-1) */
@@ -560,7 +555,7 @@ STATIC int INIT huft_build(
 
 
 
-STATIC int INIT huft_free(
+static int __init huft_free(
     struct huft *t         /* table to free */
     )
 /* Free the malloc'ed tables built by huft_build(), which makes a linked
@@ -582,7 +577,7 @@ STATIC int INIT huft_free(
 }
 
 
-STATIC int INIT inflate_codes(
+static int __init inflate_codes(
     struct huft *tl,    /* literal/length decoder tables */
     struct huft *td,    /* distance decoder tables */
     int bl,             /* number of bits decoded by tl[] */
@@ -697,7 +692,7 @@ STATIC int INIT inflate_codes(
 
 
 
-STATIC int INIT inflate_stored(void)
+static int __init inflate_stored(void)
 /* "decompress" an inflated type 0 (stored) block. */
 {
     unsigned n;           /* number of bytes in block */
@@ -758,7 +753,7 @@ STATIC int INIT inflate_stored(void)
 /*
  * We use `noinline' here to prevent gcc-3.5 from using too much stack space
  */
-STATIC int noinline INIT inflate_fixed(void)
+static int noinline __init inflate_fixed(void)
 /* decompress an inflated type 1 (fixed Huffman codes) block.  We should
    either replace this with a custom decoder, or at least precompute the
    Huffman tables. */
@@ -822,7 +817,7 @@ STATIC int noinline INIT inflate_fixed(v
 /*
  * We use `noinline' here to prevent gcc-3.5 from using too much stack space
  */
-STATIC int noinline INIT inflate_dynamic(void)
+static int noinline __init inflate_dynamic(void)
 /* decompress an inflated type 2 (dynamic Huffman codes) block. */
 {
     int i;                /* temporary variables */
@@ -1027,7 +1022,7 @@ goto out;
 
 
 
-STATIC int INIT inflate_block(
+static int __init inflate_block(
 int *e                  /* last block flag */
 )
 /* decompress an inflated block */
@@ -1078,7 +1073,7 @@ NEEDBITS(1)
 
 
 
-STATIC int INIT inflate(void)
+static int __init inflate(void)
 /* decompress an inflated entry */
 {
     int e;                /* last block flag */
@@ -1130,8 +1125,8 @@ STATIC int INIT inflate(void)
  *
  **********************************************************************/
 
-static ulg INITDATA crc_32_tab[256];
-static ulg INITDATA crc;  /* initialized in makecrc() so it'll reside in bss */
+static ulg __initdata crc_32_tab[256];
+static ulg __initdata crc;  /* initialized in makecrc() so it'll reside in bss */
 #define CRC_VALUE (crc ^ 0xffffffffUL)
 
 /*
@@ -1139,7 +1134,7 @@ static ulg INITDATA crc;  /* initialized
  * gzip-1.0.3/makecrc.c.
  */
 
-static void INIT
+static void __init
 makecrc(void)
 {
 /* Not copyrighted 1990 Mark Adler */
@@ -1187,7 +1182,7 @@ makecrc(void)
 /*
  * Do the uncompression!
  */
-static int INIT gunzip(void)
+static int __init gunzip(void)
 {
     uch flags;
     unsigned char magic[2]; /* magic header */



  parent reply	other threads:[~2021-01-26  9:50 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-26  9:46 [PATCH v3 00/15] zstd decompression for DomU-s + fallout / consolidation Jan Beulich
2021-01-26  9:48 ` [PATCH v3 01/15] libxenguest: add get_unaligned_le32() Jan Beulich
2021-01-26 11:51   ` Ian Jackson
2021-01-26  9:49 ` [PATCH v3 02/15] libxenguest: support zstd compressed kernels Jan Beulich
2021-01-26 11:53   ` Ian Jackson
2021-01-26  9:49 ` [PATCH v3 03/15] xen/decompress: make helper symbols static Jan Beulich
2021-01-26  9:49 ` [PATCH v3 04/15] libxenguest: "standardize" LZO kernel decompression code Jan Beulich
2021-01-26  9:50 ` [PATCH v3 05/15] libxenguest: drop redundant decompression declarations Jan Beulich
2021-01-26  9:50 ` [PATCH v3 06/15] libxenguest: simplify kernel decompression Jan Beulich
2021-01-26  9:50 ` Jan Beulich [this message]
2021-01-26  9:54   ` [PATCH v3 01/15] gunzip: drop INIT{,DATA} and STATIC Jan Beulich
2021-01-26 11:56   ` Ian Jackson
2021-01-26 12:49     ` Jan Beulich
2021-01-26  9:51 ` [PATCH v3 08/15] bunzip: replace INIT Jan Beulich
2021-04-15 11:50   ` Julien Grall
2021-01-26  9:51 ` [PATCH v3 09/15] unlzo: " Jan Beulich
2021-04-15 11:51   ` Julien Grall
2021-01-26  9:51 ` [PATCH v3 10/15] unlzma: " Jan Beulich
2021-04-15 11:52   ` Julien Grall
2021-01-26  9:52 ` [PATCH v3 11/15] unlz4: " Jan Beulich
2021-04-15 11:56   ` Julien Grall
2021-01-26  9:52 ` [PATCH v3 12/15] unxz: replace INIT{,DATA} and STATIC Jan Beulich
2021-04-15 11:58   ` Julien Grall
2021-04-15 14:16     ` Jan Beulich
2021-04-15 14:18       ` Julien Grall
2021-04-15 14:22         ` Jan Beulich
2021-04-15 14:24           ` Julien Grall
2021-04-15 14:28             ` Jan Beulich
2021-04-15 14:55               ` Julien Grall
2021-01-26  9:52 ` [PATCH v3 13/15] unzstd: " Jan Beulich
2021-04-15 11:59   ` Julien Grall
2021-04-15 14:21     ` Jan Beulich
2021-04-15 14:22       ` Julien Grall
2021-04-15 14:25         ` Jan Beulich
2021-04-15 14:30           ` Julien Grall
2021-04-15 14:34             ` Jan Beulich
2021-04-15 14:47               ` Julien Grall
2021-01-26  9:53 ` [PATCH v3 14/15] xen/decompress: drop STATIC and INIT Jan Beulich
2021-04-15 14:21   ` Julien Grall
2021-04-15 14:32     ` Jan Beulich
2021-04-15 14:45       ` Julien Grall
2021-01-26  9:53 ` [PATCH v3 15/15] unzstd: make helper symbols static Jan Beulich
2021-04-15 12:09   ` Julien Grall
2021-04-15 14:37     ` Jan Beulich
2021-01-26 12:05 ` [PATCH v3 00/15] zstd decompression for DomU-s + fallout / consolidation Ian Jackson
2021-01-26 13:04   ` Jan Beulich
2021-01-26 13:25     ` Ian Jackson
2021-01-26 13:50       ` Jan Beulich
2021-04-15  9:20 ` Ping: " Jan Beulich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b33f4fd3-e81a-a703-9fb5-a01880c2db9a@suse.com \
    --to=jbeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=george.dunlap@citrix.com \
    --cc=iwj@xenproject.org \
    --cc=julien@xen.org \
    --cc=sstabellini@kernel.org \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.