summaryrefslogtreecommitdiff
path: root/pppdump
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@ozlabs.org>2020-12-29 16:08:24 +1100
committerPaul Mackerras <paulus@ozlabs.org>2020-12-29 16:08:24 +1100
commit75870d7b55e36af526a0786fff94912989c73fd1 (patch)
tree1de0db83a52899c60f3b7abc0934e377a1667ab7 /pppdump
parent505ec5cbd15ec23ed84282462ae9e451a1978133 (diff)
downloadppp-75870d7b55e36af526a0786fff94912989c73fd1.tar.gz
Convert to ANSI C
This gets rid of the __P and __V macros that were used so that the code was in theory compilable by a K&R C compiler, and converts the function definitions to ANSI C style. In fact there were already quite a few function definitions in the ANSI C style, so it would not have been compilable by a K&R C compiler in fact. The Solaris and BSD kernel code modules have had __P removed but the function definitions have not been converted. There are some other minor changes here to remove warnings. Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
Diffstat (limited to 'pppdump')
-rw-r--r--pppdump/bsd-comp.c64
-rw-r--r--pppdump/deflate.c61
-rw-r--r--pppdump/ppp-comp.h18
3 files changed, 52 insertions, 91 deletions
diff --git a/pppdump/bsd-comp.c b/pppdump/bsd-comp.c
index 966e958..9d45f0b 100644
--- a/pppdump/bsd-comp.c
+++ b/pppdump/bsd-comp.c
@@ -124,15 +124,15 @@ struct bsd_db {
#define BSD_OVHD 2 /* BSD compress overhead/packet */
#define BSD_INIT_BITS BSD_MIN_BITS
-static void *bsd_decomp_alloc __P((u_char *options, int opt_len));
-static void bsd_free __P((void *state));
-static int bsd_decomp_init __P((void *state, u_char *options, int opt_len,
- int unit, int hdrlen, int mru, int debug));
-static void bsd_incomp __P((void *state, u_char *dmsg, int len));
-static int bsd_decompress __P((void *state, u_char *cmp, int inlen,
- u_char *dmp, int *outlen));
-static void bsd_reset __P((void *state));
-static void bsd_comp_stats __P((void *state, struct compstat *stats));
+static void *bsd_decomp_alloc(u_char *options, int opt_len);
+static void bsd_free(void *state);
+static int bsd_decomp_init(void *state, u_char *options, int opt_len,
+ int unit, int hdrlen, int mru, int debug);
+static void bsd_incomp(void *state, u_char *dmsg, int len);
+static int bsd_decompress(void *state, u_char *cmp, int inlen,
+ u_char *dmp, int *outlen);
+static void bsd_reset(void *state);
+static void bsd_comp_stats(void *state, struct compstat *stats);
/*
* Exported procedures.
@@ -174,8 +174,7 @@ struct compressor ppp_bsd_compress = {
* clear the dictionary
*/
static void
-bsd_clear(db)
- struct bsd_db *db;
+bsd_clear(struct bsd_db *db)
{
db->clear_count++;
db->max_ent = FIRST-1;
@@ -200,8 +199,7 @@ bsd_clear(db)
* must compute the same ratio.
*/
static int /* 1=output CLEAR */
-bsd_check(db)
- struct bsd_db *db;
+bsd_check(struct bsd_db *db)
{
u_int new_ratio;
@@ -241,9 +239,7 @@ bsd_check(db)
* Return statistics.
*/
static void
-bsd_comp_stats(state, stats)
- void *state;
- struct compstat *stats;
+bsd_comp_stats(void *state, struct compstat *stats)
{
struct bsd_db *db = (struct bsd_db *) state;
u_int out;
@@ -268,8 +264,7 @@ bsd_comp_stats(state, stats)
* Reset state, as on a CCP ResetReq.
*/
static void
-bsd_reset(state)
- void *state;
+bsd_reset(void *state)
{
struct bsd_db *db = (struct bsd_db *) state;
@@ -282,9 +277,7 @@ bsd_reset(state)
* Allocate space for a (de) compressor.
*/
static void *
-bsd_alloc(options, opt_len, decomp)
- u_char *options;
- int opt_len, decomp;
+bsd_alloc(u_char *options, int opt_len, int decomp)
{
int bits;
u_int newlen, hsize, hshift, maxmaxcode;
@@ -350,8 +343,7 @@ bsd_alloc(options, opt_len, decomp)
}
static void
-bsd_free(state)
- void *state;
+bsd_free(void *state)
{
struct bsd_db *db = (struct bsd_db *) state;
@@ -361,9 +353,7 @@ bsd_free(state)
}
static void *
-bsd_decomp_alloc(options, opt_len)
- u_char *options;
- int opt_len;
+bsd_decomp_alloc(u_char *options, int opt_len)
{
return bsd_alloc(options, opt_len, 1);
}
@@ -372,10 +362,8 @@ bsd_decomp_alloc(options, opt_len)
* Initialize the database.
*/
static int
-bsd_init(db, options, opt_len, unit, hdrlen, mru, debug, decomp)
- struct bsd_db *db;
- u_char *options;
- int opt_len, unit, hdrlen, mru, debug, decomp;
+bsd_init(struct bsd_db *db, u_char *options, int opt_len, int unit,
+ int hdrlen, int mru, int debug, int decomp)
{
int i;
@@ -409,10 +397,8 @@ bsd_init(db, options, opt_len, unit, hdrlen, mru, debug, decomp)
}
static int
-bsd_decomp_init(state, options, opt_len, unit, hdrlen, mru, debug)
- void *state;
- u_char *options;
- int opt_len, unit, hdrlen, mru, debug;
+bsd_decomp_init(void *state, u_char *options, int opt_len,
+ int unit, int hdrlen, int mru, int debug)
{
return bsd_init((struct bsd_db *) state, options, opt_len,
unit, hdrlen, mru, debug, 1);
@@ -424,10 +410,7 @@ bsd_decomp_init(state, options, opt_len, unit, hdrlen, mru, debug)
* incompressible data by pretending to compress the incoming data.
*/
static void
-bsd_incomp(state, dmsg, mlen)
- void *state;
- u_char *dmsg;
- int mlen;
+bsd_incomp(void *state, u_char *dmsg, int mlen)
{
struct bsd_db *db = (struct bsd_db *) state;
u_int hshift = db->hshift;
@@ -544,10 +527,7 @@ bsd_incomp(state, dmsg, mlen)
* compression, even though they are detected by inspecting the input.
*/
static int
-bsd_decompress(state, cmsg, inlen, dmp, outlenp)
- void *state;
- u_char *cmsg, *dmp;
- int inlen, *outlenp;
+bsd_decompress(void *state, u_char *cmsg, int inlen, u_char *dmp, int *outlenp)
{
struct bsd_db *db = (struct bsd_db *) state;
u_int max_ent = db->max_ent;
diff --git a/pppdump/deflate.c b/pppdump/deflate.c
index 43c9c51..5668a4d 100644
--- a/pppdump/deflate.c
+++ b/pppdump/deflate.c
@@ -65,17 +65,17 @@ struct deflate_state {
#define DEFLATE_OVHD 2 /* Deflate overhead/packet */
-static void *z_alloc __P((void *, u_int items, u_int size));
-static void z_free __P((void *, void *ptr, u_int nb));
-static void *z_decomp_alloc __P((u_char *options, int opt_len));
-static void z_decomp_free __P((void *state));
-static int z_decomp_init __P((void *state, u_char *options, int opt_len,
- int unit, int hdrlen, int mru, int debug));
-static void z_incomp __P((void *state, u_char *dmsg, int len));
-static int z_decompress __P((void *state, u_char *cmp, int inlen,
- u_char *dmp, int *outlenp));
-static void z_decomp_reset __P((void *state));
-static void z_comp_stats __P((void *state, struct compstat *stats));
+static void *z_alloc(void *, u_int items, u_int size);
+static void z_free(void *, void *ptr, u_int nb);
+static void *z_decomp_alloc(u_char *options, int opt_len);
+static void z_decomp_free(void *state);
+static int z_decomp_init(void *state, u_char *options, int opt_len,
+ int unit, int hdrlen, int mru, int debug);
+static void z_incomp(void *state, u_char *dmsg, int len);
+static int z_decompress(void *state, u_char *cmp, int inlen,
+ u_char *dmp, int *outlenp);
+static void z_decomp_reset(void *state);
+static void z_comp_stats(void *state, struct compstat *stats);
/*
* Procedures exported to if_ppp.c.
@@ -95,26 +95,19 @@ struct compressor ppp_deflate = {
* Space allocation and freeing routines for use by zlib routines.
*/
static void *
-z_alloc(notused, items, size)
- void *notused;
- u_int items, size;
+z_alloc(void *notused, u_int items, u_int size)
{
return malloc(items * size);
}
static void
-z_free(notused, ptr, nbytes)
- void *notused;
- void *ptr;
- u_int nbytes;
+z_free(void *notused, void *ptr, u_int nbytes)
{
free(ptr);
}
static void
-z_comp_stats(arg, stats)
- void *arg;
- struct compstat *stats;
+z_comp_stats(void *arg, struct compstat *stats)
{
struct deflate_state *state = (struct deflate_state *) arg;
u_int out;
@@ -134,9 +127,7 @@ z_comp_stats(arg, stats)
* Allocate space for a decompressor.
*/
static void *
-z_decomp_alloc(options, opt_len)
- u_char *options;
- int opt_len;
+z_decomp_alloc(u_char *options, int opt_len)
{
struct deflate_state *state;
int w_size;
@@ -168,8 +159,7 @@ z_decomp_alloc(options, opt_len)
}
static void
-z_decomp_free(arg)
- void *arg;
+z_decomp_free(void *arg)
{
struct deflate_state *state = (struct deflate_state *) arg;
@@ -178,10 +168,8 @@ z_decomp_free(arg)
}
static int
-z_decomp_init(arg, options, opt_len, unit, hdrlen, mru, debug)
- void *arg;
- u_char *options;
- int opt_len, unit, hdrlen, mru, debug;
+z_decomp_init(void *arg, u_char *options, int opt_len,
+ int unit, int hdrlen, int mru, int debug)
{
struct deflate_state *state = (struct deflate_state *) arg;
@@ -204,8 +192,7 @@ z_decomp_init(arg, options, opt_len, unit, hdrlen, mru, debug)
}
static void
-z_decomp_reset(arg)
- void *arg;
+z_decomp_reset(void *arg)
{
struct deflate_state *state = (struct deflate_state *) arg;
@@ -230,10 +217,7 @@ z_decomp_reset(arg)
* compression, even though they are detected by inspecting the input.
*/
static int
-z_decompress(arg, mi, inlen, mo, outlenp)
- void *arg;
- u_char *mi, *mo;
- int inlen, *outlenp;
+z_decompress(void *arg, u_char *mi, int inlen, u_char *mo, int *outlenp)
{
struct deflate_state *state = (struct deflate_state *) arg;
u_char *rptr, *wptr;
@@ -302,10 +286,7 @@ z_decompress(arg, mi, inlen, mo, outlenp)
* Incompressible data has arrived - add it to the history.
*/
static void
-z_incomp(arg, mi, mlen)
- void *arg;
- u_char *mi;
- int mlen;
+z_incomp(void *arg, u_char *mi, int mlen)
{
struct deflate_state *state = (struct deflate_state *) arg;
u_char *rptr;
diff --git a/pppdump/ppp-comp.h b/pppdump/ppp-comp.h
index 4be51d0..4046a1f 100644
--- a/pppdump/ppp-comp.h
+++ b/pppdump/ppp-comp.h
@@ -58,21 +58,21 @@ struct compressor {
int compress_proto; /* CCP compression protocol number */
/* Allocate space for a decompressor (receive side) */
- void *(*decomp_alloc) __P((u_char *options, int opt_len));
+ void *(*decomp_alloc)(u_char *options, int opt_len);
/* Free space used by a decompressor */
- void (*decomp_free) __P((void *state));
+ void (*decomp_free)(void *state);
/* Initialize a decompressor */
- int (*decomp_init) __P((void *state, u_char *options, int opt_len,
- int unit, int hdrlen, int mru, int debug));
+ int (*decomp_init)(void *state, u_char *options, int opt_len,
+ int unit, int hdrlen, int mru, int debug);
/* Reset a decompressor */
- void (*decomp_reset) __P((void *state));
+ void (*decomp_reset)(void *state);
/* Decompress a packet. */
- int (*decompress) __P((void *state, u_char *mp, int inlen,
- u_char *dmp, int *outlen));
+ int (*decompress)(void *state, u_char *mp, int inlen,
+ u_char *dmp, int *outlen);
/* Update state for an incompressible packet received */
- void (*incomp) __P((void *state, u_char *mp, int len));
+ void (*incomp)(void *state, u_char *mp, int len);
/* Return decompression statistics */
- void (*decomp_stat) __P((void *state, struct compstat *stats));
+ void (*decomp_stat)(void *state, struct compstat *stats);
};
/*