Skip to content

Commit 0cd36a9

Browse files
committed
core/clib: Remove K&R function definitions
Soon-to-be-released Clang 15 complains: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
1 parent ff91fc0 commit 0cd36a9

File tree

13 files changed

+63
-260
lines changed

13 files changed

+63
-260
lines changed

core/clib/src/Demangle.c

Lines changed: 37 additions & 164 deletions
Large diffs are not rendered by default.

core/clib/src/attach.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,11 @@ Boston, MA 02111-1307, USA. */
8585
On failure returns NULL. */
8686

8787
PTR
88-
mmalloc_attach (fd, baseaddr, minsize)
8988
#ifndef WIN32
90-
int fd;
89+
mmalloc_attach (int fd, PTR baseaddr, int minsize)
9190
#else
92-
HANDLE fd;
91+
mmalloc_attach (HANDLE fd, PTR baseaddr, int minsize)
9392
#endif
94-
PTR baseaddr;
95-
int minsize;
9693
{
9794
struct mdesc mtemp;
9895
struct mdesc *mdp;
@@ -236,11 +233,10 @@ mmalloc_attach (fd, baseaddr, minsize)
236233
unsuccessful for some reason. */
237234

238235
static struct mdesc *
239-
reuse (cfd)
240236
#ifndef WIN32
241-
int cfd;
237+
reuse(int cfd)
242238
#else
243-
HANDLE cfd;
239+
reuse(HANDLE cfd)
244240
#endif
245241
{
246242
struct mdesc *mtemp = (struct mdesc*) malloc(sizeof(struct mdesc));

core/clib/src/detach.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,7 @@ Boston, MA 02111-1307, USA. */
4141
region we are about to unmap, so we first make a local copy of it on the
4242
stack and use the copy. */
4343

44-
PTR
45-
mmalloc_detach (md)
46-
PTR md;
44+
PTR mmalloc_detach(PTR md)
4745
{
4846
struct mdesc mtemp;
4947

core/clib/src/keys.c

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,7 @@ Boston, MA 02111-1307, USA. */
4141

4242
#include "mmprivate.h"
4343

44-
int
45-
mmalloc_setkey (md, keynum, key)
46-
PTR md;
47-
int keynum;
48-
PTR key;
44+
int mmalloc_setkey(PTR md, int keynum, PTR key)
4945
{
5046
struct mdesc *mdp = (struct mdesc *) md;
5147
int result = 0;
@@ -68,10 +64,7 @@ mmalloc_setkey (md, keynum, key)
6864
return (result);
6965
}
7066

71-
PTR
72-
mmalloc_getkey (md, keynum)
73-
PTR md;
74-
int keynum;
67+
PTR mmalloc_getkey(PTR md, int keynum)
7568
{
7669
struct mdesc *mdp = (struct mdesc *) md;
7770
PTR keyval = NULL;

core/clib/src/mcalloc.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,7 @@ Boston, MA 02111-1307, USA. */
2626
/* Allocate an array of NMEMB elements each SIZE bytes long.
2727
The entire array is initialized to zeros. */
2828

29-
PTR
30-
mcalloc (md, nmemb, size)
31-
PTR md;
32-
register size_t nmemb;
33-
register size_t size;
29+
PTR mcalloc(PTR md, register size_t nmemb, register size_t size)
3430
{
3531
register PTR result;
3632

core/clib/src/mfree.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,7 @@ Boston, MA 02111-1307, USA.
3131
/* Return memory to the heap.
3232
Like `mfree' but don't call a mfree_hook if there is one. */
3333

34-
void
35-
__mmalloc_free (mdp, ptr)
36-
struct mdesc *mdp;
37-
PTR ptr;
34+
void __mmalloc_free(struct mdesc *mdp, PTR ptr)
3835
{
3936
int type;
4037
size_t block, blocks;
@@ -206,10 +203,7 @@ __mmalloc_free (mdp, ptr)
206203

207204
/* Return memory to the heap. */
208205

209-
void
210-
mfree (md, ptr)
211-
PTR md;
212-
PTR ptr;
206+
void mfree(PTR md, PTR ptr)
213207
{
214208
struct mdesc *mdp;
215209
register struct alignlist *l;

core/clib/src/mmalloc.c

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,7 @@ static PTR align PARAMS ((struct mdesc *, size_t));
3939

4040
/* Aligned allocation. */
4141

42-
static PTR
43-
align (mdp, size)
44-
struct mdesc *mdp;
45-
size_t size;
42+
static PTR align(struct mdesc *mdp, size_t size)
4643
{
4744
PTR result;
4845
unsigned long int adj;
@@ -60,9 +57,7 @@ align (mdp, size)
6057

6158
/* Set everything up and remember that we have. */
6259

63-
static int
64-
initialize (mdp)
65-
struct mdesc *mdp;
60+
static int initialize(struct mdesc *mdp)
6661
{
6762
mdp -> heapsize = HEAP / BLOCKSIZE;
6863
mdp -> heapinfo = (mmalloc_info *)
@@ -83,10 +78,7 @@ initialize (mdp)
8378
/* Get neatly aligned memory, initializing or
8479
growing the heap info table as necessary. */
8580

86-
static PTR
87-
morecore (mdp, size)
88-
struct mdesc *mdp;
89-
size_t size;
81+
static PTR morecore(struct mdesc *mdp, size_t size)
9082
{
9183
PTR result;
9284
mmalloc_info *newinfo, *oldinfo;
@@ -130,10 +122,7 @@ morecore (mdp, size)
130122

131123
/* Allocate memory from the heap. */
132124

133-
PTR
134-
mmalloc (md, size)
135-
PTR md;
136-
size_t size;
125+
PTR mmalloc(PTR md, size_t size)
137126
{
138127
struct mdesc *mdp;
139128
PTR result;

core/clib/src/mmapsup.c

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,7 @@ static size_t pagesize;
6060
amount to either add to or subtract from the existing region. Works
6161
like sbrk(), but using mmap(). */
6262

63-
PTR
64-
__mmalloc_mmap_morecore (mdp, size)
65-
struct mdesc *mdp;
66-
int size;
63+
PTR __mmalloc_mmap_morecore(struct mdesc *mdp, int size)
6764
{
6865
PTR result = NULL;
6966
off_t foffset; /* File offset at which new mapping will start */
@@ -200,9 +197,7 @@ __mmalloc_mmap_morecore (mdp, size)
200197
return (result);
201198
}
202199

203-
PTR
204-
__mmalloc_remap_core (mdp)
205-
struct mdesc *mdp;
200+
PTR __mmalloc_remap_core(struct mdesc *mdp)
206201
{
207202
caddr_t base;
208203
int rdonly = 0;
@@ -283,9 +278,7 @@ __mmalloc_remap_core (mdp)
283278
return ((PTR) base);
284279
}
285280

286-
int
287-
mmalloc_update_mapping(md)
288-
PTR md;
281+
int mmalloc_update_mapping(PTR md)
289282
{
290283
/*
291284
* In case of a read-only mapping, we need to call this routine to

core/clib/src/mmcheck.c

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,7 @@ typedef PTR (*mmrealloc_fun_t) PARAMS ((PTR, PTR, size_t));
6161
/* Check the magicword and magicbyte, and if either is corrupted then
6262
call the emergency abort function specified for the heap in use. */
6363

64-
static void
65-
checkhdr (mdp, hdr)
66-
struct mdesc *mdp;
67-
const struct hdr *hdr;
64+
static void checkhdr(struct mdesc *mdp, const struct hdr *hdr)
6865
{
6966
if (hdr -> magic != MAGICWORD ||
7067
((char *) &hdr[1])[hdr -> size] != MAGICBYTE)
@@ -73,10 +70,7 @@ checkhdr (mdp, hdr)
7370
}
7471
}
7572

76-
static void
77-
mfree_check (md, ptr)
78-
PTR md;
79-
PTR ptr;
73+
static void mfree_check(PTR md, PTR ptr)
8074
{
8175
struct hdr *hdr = ((struct hdr *) ptr) - 1;
8276
struct mdesc *mdp;
@@ -89,10 +83,7 @@ mfree_check (md, ptr)
8983
mdp -> mfree_hook = (mmfree_fun_t) mfree_check;
9084
}
9185

92-
static PTR
93-
mmalloc_check (md, size)
94-
PTR md;
95-
size_t size;
86+
static PTR mmalloc_check(PTR md, size_t size)
9687
{
9788
struct hdr *hdr;
9889
struct mdesc *mdp;
@@ -113,11 +104,7 @@ mmalloc_check (md, size)
113104
return ((PTR) hdr);
114105
}
115106

116-
static PTR
117-
mrealloc_check (md, ptr, size)
118-
PTR md;
119-
PTR ptr;
120-
size_t size;
107+
static PTR mrealloc_check(PTR md, PTR ptr, size_t size)
121108
{
122109
struct hdr *hdr = ((struct hdr *) ptr) - 1;
123110
struct mdesc *mdp;
@@ -165,10 +152,7 @@ mrealloc_check (md, ptr, size)
165152
166153
Returns non-zero if checking is successfully enabled, zero otherwise. */
167154

168-
int
169-
mmcheck (md, func)
170-
PTR md;
171-
void (*func) PARAMS ((void));
155+
int mmcheck(PTR md, void(*func) PARAMS((void)))
172156
{
173157
struct mdesc *mdp;
174158
int rtnval;

core/clib/src/mmemalign.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,7 @@ Boston, MA 02111-1307, USA. */
2121

2222
#include "mmprivate.h"
2323

24-
PTR
25-
mmemalign (md, alignment, size)
26-
PTR md;
27-
size_t alignment;
28-
size_t size;
24+
PTR mmemalign(PTR md, size_t alignment, size_t size)
2925
{
3026
PTR result;
3127
unsigned long int adj;

0 commit comments

Comments
 (0)