diff options
| author | Mark Wielaard <[email protected]> | 2015-09-22 22:27:01 +0200 |
|---|---|---|
| committer | Mark Wielaard <[email protected]> | 2015-09-23 15:50:55 +0200 |
| commit | 1ccdfb683ad6c7e59793136c3a657ddf131cafd1 (patch) | |
| tree | d5d24ce4ca0beec37e1ee2fe1f8a36af0e218e28 /lib | |
| parent | e260d79d73be07aee2860c5a5baf4f12c230ad6b (diff) | |
Remove old-style function definitions.
We already require -std=gnu99 and old-style function definitions might
hide some compiler warnings.
Signed-off-by: Mark Wielaard <[email protected]>
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/ChangeLog | 9 | ||||
| -rw-r--r-- | lib/dynamicsizehash.c | 31 | ||||
| -rw-r--r-- | lib/md5.c | 32 | ||||
| -rw-r--r-- | lib/sha1.c | 23 | ||||
| -rw-r--r-- | lib/xmalloc.c | 12 | ||||
| -rw-r--r-- | lib/xstrdup.c | 5 | ||||
| -rw-r--r-- | lib/xstrndup.c | 6 |
7 files changed, 38 insertions, 80 deletions
diff --git a/lib/ChangeLog b/lib/ChangeLog index d04bf172..d1bdc7bc 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,12 @@ +2015-09-22 Mark Wielaard <[email protected]> + + * dynamicsizehash.c: Remove old-style function definitions. + * md5.c: Likewise. + * sha1.c: Likewise. + * xmalloc.c: Likewise. + * xstrdup.c: Likewise. + * xstrndup.c: Likewise. + 2015-05-31 Mark Wielaard <[email protected]> * eu-config.h (ALLOW_UNALIGNED): Define when ! CHECK_UNDEFINED. diff --git a/lib/dynamicsizehash.c b/lib/dynamicsizehash.c index 1fdff1b0..f9406eba 100644 --- a/lib/dynamicsizehash.c +++ b/lib/dynamicsizehash.c @@ -44,10 +44,7 @@ static size_t -lookup (htab, hval, val) - NAME *htab; - HASHTYPE hval; - TYPE val __attribute__ ((unused)); +lookup (NAME *htab, HASHTYPE hval, TYPE val __attribute__ ((unused))) { /* First hash function: simply take the modul but prevent zero. Small values can skip the division, which helps performance when this is common. */ @@ -176,9 +173,7 @@ int #define INIT(name) _INIT (name) #define _INIT(name) \ name##_init -INIT(NAME) (htab, init_size) - NAME *htab; - size_t init_size; +INIT(NAME) (NAME *htab, size_t init_size) { /* We need the size to be a prime. */ init_size = next_prime (init_size); @@ -201,8 +196,7 @@ int #define FREE(name) _FREE (name) #define _FREE(name) \ name##_free -FREE(NAME) (htab) - NAME *htab; +FREE(NAME) (NAME *htab) { free (htab->table); return 0; @@ -213,10 +207,7 @@ int #define INSERT(name) _INSERT (name) #define _INSERT(name) \ name##_insert -INSERT(NAME) (htab, hval, data) - NAME *htab; - HASHTYPE hval; - TYPE data; +INSERT(NAME) (NAME *htab, HASHTYPE hval, TYPE data) { size_t idx; @@ -240,10 +231,7 @@ int #define INSERT(name) _INSERT (name) #define _INSERT(name) \ name##_overwrite -INSERT(NAME) (htab, hval, data) - NAME *htab; - HASHTYPE hval; - TYPE data; +INSERT(NAME) (NAME *htab, HASHTYPE hval, TYPE data) { size_t idx; @@ -263,10 +251,7 @@ TYPE #define FIND(name) _FIND (name) #define _FIND(name) \ name##_find -FIND(NAME) (htab, hval, val) - NAME *htab; - HASHTYPE hval; - TYPE val; +FIND(NAME) (NAME *htab, HASHTYPE hval, TYPE val) { size_t idx; @@ -287,9 +272,7 @@ FIND(NAME) (htab, hval, val) # define _ITERATEFCT(name) \ name##_iterate TYPE -ITERATEFCT(NAME) (htab, ptr) - NAME *htab; - void **ptr; +ITERATEFCT(NAME) (NAME *htab, void **ptr) { void *p = *ptr; @@ -1,6 +1,6 @@ /* Functions to compute MD5 message digest of files or memory blocks. according to the definition of MD5 in RFC 1321 from April 1992. - Copyright (C) 1995-2011 Red Hat, Inc. + Copyright (C) 1995-2011, 2015 Red Hat, Inc. This file is part of elfutils. Written by Ulrich Drepper <[email protected]>, 1995. @@ -49,8 +49,7 @@ static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ... */ }; /* Initialize structure containing state of computation. (RFC 1321, 3.3: Step 3) */ void -md5_init_ctx (ctx) - struct md5_ctx *ctx; +md5_init_ctx (struct md5_ctx *ctx) { ctx->A = 0x67452301; ctx->B = 0xefcdab89; @@ -67,9 +66,7 @@ md5_init_ctx (ctx) IMPORTANT: On some systems it is required that RESBUF is correctly aligned for a 32 bits value. */ void * -md5_read_ctx (ctx, resbuf) - const struct md5_ctx *ctx; - void *resbuf; +md5_read_ctx (const struct md5_ctx *ctx, void *resbuf) { ((md5_uint32 *) resbuf)[0] = SWAP (ctx->A); ((md5_uint32 *) resbuf)[1] = SWAP (ctx->B); @@ -95,9 +92,7 @@ le64_copy (char *dest, uint64_t x) IMPORTANT: On some systems it is required that RESBUF is correctly aligned for a 32 bits value. */ void * -md5_finish_ctx (ctx, resbuf) - struct md5_ctx *ctx; - void *resbuf; +md5_finish_ctx (struct md5_ctx *ctx, void *resbuf) { /* Take yet unprocessed bytes into account. */ md5_uint32 bytes = ctx->buflen; @@ -129,9 +124,7 @@ md5_finish_ctx (ctx, resbuf) resulting message digest number will be written into the 16 bytes beginning at RESBLOCK. */ int -md5_stream (stream, resblock) - FILE *stream; - void *resblock; +md5_stream (FILE *stream, void *resblock) { /* Important: BLOCKSIZE must be a multiple of 64. */ #define BLOCKSIZE 4096 @@ -189,10 +182,7 @@ md5_stream (stream, resblock) output yields to the wanted ASCII representation of the message digest. */ void * -md5_buffer (buffer, len, resblock) - const char *buffer; - size_t len; - void *resblock; +md5_buffer (const char *buffer, size_t len, void *resblock) { struct md5_ctx ctx; @@ -209,10 +199,7 @@ md5_buffer (buffer, len, resblock) void -md5_process_bytes (buffer, len, ctx) - const void *buffer; - size_t len; - struct md5_ctx *ctx; +md5_process_bytes (const void *buffer, size_t len, struct md5_ctx *ctx) { /* When we already have some bits in our internal buffer concatenate both inputs first. */ @@ -296,10 +283,7 @@ md5_process_bytes (buffer, len, ctx) It is assumed that LEN % 64 == 0. */ void -md5_process_block (buffer, len, ctx) - const void *buffer; - size_t len; - struct md5_ctx *ctx; +md5_process_block (const void *buffer, size_t len, struct md5_ctx *ctx) { md5_uint32 correct_words[16]; const md5_uint32 *words = buffer; @@ -1,6 +1,6 @@ /* Functions to compute SHA1 message digest of files or memory blocks. according to the definition of SHA1 in FIPS 180-1 from April 1997. - Copyright (C) 2008-2011 Red Hat, Inc. + Copyright (C) 2008-2011, 2015 Red Hat, Inc. This file is part of elfutils. Written by Ulrich Drepper <[email protected]>, 2008. @@ -48,8 +48,7 @@ static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ... */ }; /* Initialize structure containing state of computation. */ void -sha1_init_ctx (ctx) - struct sha1_ctx *ctx; +sha1_init_ctx (struct sha1_ctx *ctx) { ctx->A = 0x67452301; ctx->B = 0xefcdab89; @@ -67,9 +66,7 @@ sha1_init_ctx (ctx) IMPORTANT: On some systems it is required that RESBUF is correctly aligned for a 32 bits value. */ void * -sha1_read_ctx (ctx, resbuf) - const struct sha1_ctx *ctx; - void *resbuf; +sha1_read_ctx (const struct sha1_ctx *ctx, void *resbuf) { ((sha1_uint32 *) resbuf)[0] = SWAP (ctx->A); ((sha1_uint32 *) resbuf)[1] = SWAP (ctx->B); @@ -93,9 +90,7 @@ be64_copy (char *dest, uint64_t x) IMPORTANT: On some systems it is required that RESBUF is correctly aligned for a 32 bits value. */ void * -sha1_finish_ctx (ctx, resbuf) - struct sha1_ctx *ctx; - void *resbuf; +sha1_finish_ctx (struct sha1_ctx *ctx, void *resbuf) { /* Take yet unprocessed bytes into account. */ sha1_uint32 bytes = ctx->buflen; @@ -123,10 +118,7 @@ sha1_finish_ctx (ctx, resbuf) void -sha1_process_bytes (buffer, len, ctx) - const void *buffer; - size_t len; - struct sha1_ctx *ctx; +sha1_process_bytes (const void *buffer, size_t len, struct sha1_ctx *ctx) { /* When we already have some bits in our internal buffer concatenate both inputs first. */ @@ -220,10 +212,7 @@ sha1_process_bytes (buffer, len, ctx) It is assumed that LEN % 64 == 0. */ void -sha1_process_block (buffer, len, ctx) - const void *buffer; - size_t len; - struct sha1_ctx *ctx; +sha1_process_block (const void *buffer, size_t len, struct sha1_ctx *ctx) { sha1_uint32 computed_words[16]; #define W(i) computed_words[(i) % 16] diff --git a/lib/xmalloc.c b/lib/xmalloc.c index 27ccab95..0cde384f 100644 --- a/lib/xmalloc.c +++ b/lib/xmalloc.c @@ -1,5 +1,5 @@ /* Convenience functions for allocation. - Copyright (C) 2006 Red Hat, Inc. + Copyright (C) 2006, 2015 Red Hat, Inc. This file is part of elfutils. This file is free software; you can redistribute it and/or modify @@ -44,8 +44,7 @@ /* Allocate N bytes of memory dynamically, with error checking. */ void * -xmalloc (n) - size_t n; +xmalloc (size_t n) { void *p; @@ -58,8 +57,7 @@ xmalloc (n) /* Allocate memory for N elements of S bytes, with error checking. */ void * -xcalloc (n, s) - size_t n, s; +xcalloc (size_t n, size_t s) { void *p; @@ -73,9 +71,7 @@ xcalloc (n, s) /* Change the size of an allocated block of memory P to N bytes, with error checking. */ void * -xrealloc (p, n) - void *p; - size_t n; +xrealloc (void *p, size_t n) { p = realloc (p, n); if (p == NULL) diff --git a/lib/xstrdup.c b/lib/xstrdup.c index d9d6010c..aa10352a 100644 --- a/lib/xstrdup.c +++ b/lib/xstrdup.c @@ -1,5 +1,5 @@ /* Convenience function for string allocation. - Copyright (C) 2006 Red Hat, Inc. + Copyright (C) 2006, 2015 Red Hat, Inc. This file is part of elfutils. This file is free software; you can redistribute it and/or modify @@ -36,8 +36,7 @@ /* Return a newly allocated copy of STRING. */ char * -xstrdup (string) - const char *string; +xstrdup (const char *string) { return strcpy (xmalloc (strlen (string) + 1), string); } diff --git a/lib/xstrndup.c b/lib/xstrndup.c index 52304e65..92b79c17 100644 --- a/lib/xstrndup.c +++ b/lib/xstrndup.c @@ -1,5 +1,5 @@ /* Convenience function for string allocation. - Copyright (C) 2006 Red Hat, Inc. + Copyright (C) 2006, 2015 Red Hat, Inc. This file is part of elfutils. This file is free software; you can redistribute it and/or modify @@ -36,9 +36,7 @@ /* Return a newly allocated copy of STRING. */ char * -xstrndup (string, n) - const char *string; - size_t n; +xstrndup (const char *string, size_t n) { char *res; size_t len = strnlen (string, n); |
