From d4680f224c84dfcfce1981f1623fae41a4c86562 Mon Sep 17 00:00:00 2001 From: Francisco Javier Trujillo Mata Date: Mon, 19 May 2025 22:27:42 +0200 Subject: [PATCH 1/2] Remove c99 std config --- ee/rpc/ps2snd/Makefile | 2 -- tools/gensymtab/Makefile | 2 +- tools/ps2adpcm/Makefile | 1 - 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/ee/rpc/ps2snd/Makefile b/ee/rpc/ps2snd/Makefile index de098491752..0286b2c2262 100644 --- a/ee/rpc/ps2snd/Makefile +++ b/ee/rpc/ps2snd/Makefile @@ -6,8 +6,6 @@ # Licenced under Academic Free License version 2.0 # Review ps2sdk README & LICENSE files for further details. -EE_CFLAGS += -std=c99 - EE_OBJS = ps2snd.o erl-support.o include $(PS2SDKSRC)/Defs.make diff --git a/tools/gensymtab/Makefile b/tools/gensymtab/Makefile index f9a2cf8a71a..33100a87993 100644 --- a/tools/gensymtab/Makefile +++ b/tools/gensymtab/Makefile @@ -6,7 +6,7 @@ # Licenced under Academic Free License version 2.0 # Review ps2sdk README & LICENSE files for further details. -TOOLS_CFLAGS += -std=c99 -D_BSD_SOURCE=1 +TOOLS_CFLAGS += -D_BSD_SOURCE=1 TOOLS_LDFLAGS += TOOLS_OBJS = main.o diff --git a/tools/ps2adpcm/Makefile b/tools/ps2adpcm/Makefile index 4c98bc935c1..3c58eb42665 100644 --- a/tools/ps2adpcm/Makefile +++ b/tools/ps2adpcm/Makefile @@ -6,7 +6,6 @@ # Licenced under Academic Free License version 2.0 # Review ps2sdk README & LICENSE files for further details. -TOOLS_CFLAGS += -std=c99 TOOLS_LDFLAGS += -lm TOOLS_OBJS = main.o adpcm.o From ebc30a1034d1d5c03f6f5da7d3cd35af8aac5714 Mon Sep 17 00:00:00 2001 From: Francisco Javier Trujillo Mata Date: Mon, 19 May 2025 21:46:03 +0200 Subject: [PATCH 2/2] Make ps2sdk compatible with GCC 15 - Update useless types in erl --- ee/erl/include/hashtab.h | 50 +++++++------- ee/erl/include/lookupa.h | 14 ++-- ee/erl/include/recycle.h | 20 +++--- ee/erl/include/standard.h | 59 +++-------------- ee/erl/src/erl.c | 6 +- ee/erl/src/hashtab.c | 136 ++++++++++++++++++-------------------- ee/erl/src/lookupa.c | 57 ++++++++-------- ee/erl/src/recycle.c | 35 +++++----- 8 files changed, 158 insertions(+), 219 deletions(-) diff --git a/ee/erl/include/hashtab.h b/ee/erl/include/hashtab.h index f158f83e46b..8ed37f2d1f3 100644 --- a/ee/erl/include/hashtab.h +++ b/ee/erl/include/hashtab.h @@ -28,12 +28,10 @@ This implements a hash table. -------------------------------------------------------------------- */ -#ifndef STANDARD -#include "standard.h" -#endif +#ifndef HASHTAB_H +#define HASHTAB_H -#ifndef HASHTAB -#define HASHTAB +#include "standard.h" #ifdef __cplusplus extern "C" { @@ -43,11 +41,11 @@ extern "C" { struct hitem { - ub1 *key; /* key that is hashed */ - ub4 keyl; /* length of key */ - void *stuff; /* stuff stored in this hitem */ - ub4 hval; /* hash value */ - struct hitem *next; /* next hitem in list */ + const char *key; /* key that is hashed */ + size_t keyl; /* length of key */ + void *stuff; /* stuff stored in this hitem */ + size_t hval; /* hash value */ + struct hitem *next; /* next hitem in list */ }; typedef struct hitem hitem; @@ -55,13 +53,13 @@ typedef struct hitem hitem; struct htab { struct hitem **table; /* hash table, array of size 2^logsize */ - word logsize; /* log of size of table */ - size_t mask; /* (hashval & mask) is position in table */ - ub4 count; /* how many items in this hash table so far? */ - ub4 apos; /* position in the array */ + int logsize; /* log of size of table */ + size_t mask; /* (hashval & mask) is position in table */ + size_t count; /* how many items in this hash table so far? */ + size_t apos; /* position in the array */ struct hitem *ipos; /* current item in the array */ struct reroot *space; /* space for the hitems */ - ub4 bcount; /* # hitems useable in current block */ + size_t bcount; /* # hitems useable in current block */ }; typedef struct htab htab; @@ -77,7 +75,7 @@ typedef struct htab htab; RETURNS: the new table */ -extern htab *hcreate(/*_ word logsize _*/); +extern htab *hcreate(int logsize); /* hdestroy - destroy a hash table @@ -88,16 +86,16 @@ extern htab *hcreate(/*_ word logsize _*/); RETURNS: nothing */ -extern void hdestroy(/*_ htab *t _*/); +extern void hdestroy(htab *t); /* hcount, hkey, hkeyl, hstuff ARGUMENTS: t - the hash table RETURNS: - hcount - (ub4) The number of items in the hash table - hkey - (ub1 *) key for the current item - hkeyl - (ub4) key length for the current item + hcount - (size_t) The number of items in the hash table + hkey - (const char *) key for the current item + hkeyl - (size_t) key length for the current item hstuff - (void *) stuff for the current item NOTE: The current position always has an item as long as there @@ -121,7 +119,7 @@ extern void hdestroy(/*_ htab *t _*/); TRUE if the item exists, FALSE if it does not. If the item exists, moves the current position to that item. */ -extern word hfind(/*_ htab *t, ub1 *key, ub4 keyl _*/); +extern int hfind(htab *t, const char *key, size_t keyl); /* hadd - add a new item to the hash table @@ -134,7 +132,7 @@ extern word hfind(/*_ htab *t, ub1 *key, ub4 keyl _*/); RETURNS: FALSE if the operation fails (because that key is already there). */ -extern word hadd(/*_ htab *t, ub1 *key, ub4 keyl, void *stuff _*/); +extern int hadd(htab *t, const char *key, size_t keyl, void *stuff); /* hdel - delete the item at the current position @@ -153,7 +151,7 @@ extern word hadd(/*_ htab *t, ub1 *key, ub4 keyl, void *stuff _*/); hdel(tab); } */ -extern word hdel(/* htab *t */); +extern int hdel(htab *t); /* hfirst - move position to the first item in the table @@ -163,7 +161,7 @@ extern word hdel(/* htab *t */); FALSE if there is no current item (meaning the table is empty) NOTE: */ -extern word hfirst(/*_ htab *t _*/); +extern int hfirst(htab *t); /* hnext - move position to the next item in the table @@ -193,7 +191,7 @@ extern word hfirst(/*_ htab *t _*/); NOTE: This is private to hashtab; do not use it externally. */ -extern word hnbucket(/*_ htab *t _*/); +extern int hnbucket(htab *t); /* hstat - print statistics about the hash table @@ -218,4 +216,4 @@ extern void hstat(/*_ htab *t _*/); } #endif -#endif /* HASHTAB */ +#endif /* HASHTAB_H */ diff --git a/ee/erl/include/lookupa.h b/ee/erl/include/lookupa.h index 12e313ab88a..ded3c87c085 100644 --- a/ee/erl/include/lookupa.h +++ b/ee/erl/include/lookupa.h @@ -7,23 +7,21 @@ Source is http://burtleburtle.net/bob/c/lookupa.h ------------------------------------------------------------------------------ */ -#ifndef STANDARD -#include "standard.h" -#endif +#ifndef LOOKUPA_H +#define LOOKUPA_H -#ifndef LOOKUPA -#define LOOKUPA +#include "standard.h" #ifdef __cplusplus extern "C" { #endif #define CHECKSTATE 8 -#define hashsize(n) ((ub4)1<<(n)) +#define hashsize(n) ((size_t)1<<(n)) #define hashmask(n) (hashsize(n)-1) -extern ub4 lookup(/*_ ub1 *k, ub4 length, ub4 level _*/); -extern void checksum(/*_ ub1 *k, ub4 length, ub4 *state _*/); +extern uint32_t lookup(const char *k, size_t length, uint32_t level); +extern void checksum(const char *k, size_t length, uint32_t *state); #ifdef __cplusplus } diff --git a/ee/erl/include/recycle.h b/ee/erl/include/recycle.h index 1eb9c75faea..1351c648858 100644 --- a/ee/erl/include/recycle.h +++ b/ee/erl/include/recycle.h @@ -13,12 +13,10 @@ This also decreases memory fragmentation, and freeing all structures -------------------------------------------------------------------- */ -#ifndef STANDARD -#include "standard.h" -#endif +#ifndef RECYCLE_H +#define RECYCLE_H -#ifndef RECYCLE -#define RECYCLE +#include "standard.h" #ifdef __cplusplus extern "C" { @@ -39,21 +37,21 @@ struct reroot struct recycle *trash; /* list of deleted items */ size_t size; /* size of an item */ size_t logsize; /* log_2 of number of items in a block */ - word numleft; /* number of bytes left in this block */ + int numleft; /* number of bytes left in this block */ }; typedef struct reroot reroot; /* make a new recycling root */ -extern reroot *remkroot(/*_ size_t mysize _*/); +extern reroot *remkroot(size_t mysize); /* free a recycling root and all the items it has made */ -extern void refree(/*_ struct reroot *r _*/); +extern void refree(struct reroot *r); /* get a new (cleared) item from the root */ #define renew(r) ((r)->numleft ? \ (((char *)((r)->list+1))+((r)->numleft-=(r)->size)) : renewx(r)) -extern char *renewx(/*_ struct reroot *r _*/); +extern char *renewx(struct reroot *r); /* delete an item; let the root recycle it */ /* void redel(/o_ struct reroot *r, struct recycle *item _o/); */ @@ -64,10 +62,10 @@ extern char *renewx(/*_ struct reroot *r _*/); /* malloc, but exit program if no joy */ /* use plain free() to free memory allocated by remalloc() */ -extern char *remalloc(/*_ size_t len _*/); +extern char *remalloc(size_t len); #ifdef __cplusplus } #endif -#endif /* RECYCLE */ +#endif /* RECYCLE_H */ diff --git a/ee/erl/include/standard.h b/ee/erl/include/standard.h index 41d4f978325..8af3c2747b3 100644 --- a/ee/erl/include/standard.h +++ b/ee/erl/include/standard.h @@ -3,16 +3,13 @@ Standard definitions and types, Bob Jenkins ------------------------------------------------------------------------------ */ -#ifndef STANDARD -# define STANDARD -# ifndef STDIO -# include -# define STDIO -# endif -# ifndef STDDEF -# include -# define STDDEF -# endif +#ifndef STANDARD_H +#define STANDARD_H + +#include +#include +#include + #define UB8MAXVAL 0xffffffffffffffffLL #define UB8BITS 64 #define SB8MAXVAL 0x7fffffffffffffffLL @@ -25,45 +22,7 @@ Standard definitions and types, Bob Jenkins #define UB1MAXVAL 0xff #define UB1BITS 8 #define SB1MAXVAL 0x7f -#ifdef _EE -#include -typedef u64 ub8; -typedef s64 sb8; -typedef u32 ub4; -typedef s32 sb4; -typedef u16 ub2; -typedef s16 sb2; -typedef u8 ub1; -typedef s8 sb1; -#else -typedef unsigned long long ub8; -typedef signed long long sb8; -typedef unsigned long int ub4; /* unsigned 4-byte quantities */ -typedef signed long int sb4; -typedef unsigned short int ub2; -typedef signed short int sb2; -typedef unsigned char ub1; -typedef signed char sb1; /* signed 1-byte quantities */ -#endif -typedef int word; /* fastest type available */ -#define bis(target,mask) ((target) |= (mask)) -#define bic(target,mask) ((target) &= ~(mask)) -#define bit(target,mask) ((target) & (mask)) -#ifndef min -# define min(a,b) (((a)<(b)) ? (a) : (b)) -#endif /* min */ -#ifndef max -# define max(a,b) (((a)<(b)) ? (b) : (a)) -#endif /* max */ -#ifndef align -# define align(a) (((ub4)a+(sizeof(void *)-1))&(~(sizeof(void *)-1))) -#endif /* align */ -#ifndef abs -# define abs(a) (((a)>0) ? (a) : -(a)) -#endif -#define TRUE 1 -#define FALSE 0 -#define SUCCESS 0 /* 1 on VAX */ +#define align(a) (((uint32_t)a+(sizeof(void *)-1))&(~(sizeof(void *)-1))) -#endif /* STANDARD */ +#endif /* STANDARD_H */ diff --git a/ee/erl/src/erl.c b/ee/erl/src/erl.c index ecf3a12f16a..b4c4bc052e8 100644 --- a/ee/erl/src/erl.c +++ b/ee/erl/src/erl.c @@ -512,7 +512,7 @@ static void add_loosy(struct erl_record_t * erl, u8 * reloc, int type, const cha l->next = hstuff(loosy_relocs); hstuff(loosy_relocs) = l; } else { - hkey(loosy_relocs) = (ub1 *)strdup(symbol); + hkey(loosy_relocs) = strdup(symbol); } } @@ -530,7 +530,7 @@ static int fix_loosy(struct erl_record_t * provider, const char * symbol, u32 ad count++; } r_destroy_loosy(hstuff(loosy_relocs)); - free(hkey(loosy_relocs)); + free((void *)hkey(loosy_relocs)); hdel(loosy_relocs); } @@ -1177,7 +1177,7 @@ void erl_flush_symbols(struct erl_record_t * erl) { if (hfirst(erl->symbols)) do { destroy_symbol((struct symbol_t *) hstuff(erl->symbols)); - free(hkey(erl->symbols)); + free((void *)hkey(erl->symbols)); hdel(erl->symbols); } while (hcount(erl->symbols)); diff --git a/ee/erl/src/hashtab.c b/ee/erl/src/hashtab.c index 5b5009df4fe..af54baaa1cf 100644 --- a/ee/erl/src/hashtab.c +++ b/ee/erl/src/hashtab.c @@ -30,30 +30,23 @@ This implements a hash table. #include #include +#include +#include -#ifndef STANDARD -#include "standard.h" -#endif -#ifndef LOOKUPA #include "lookupa.h" -#endif -#ifndef HASHTAB #include "hashtab.h" -#endif -#ifndef RECYCLE #include "recycle.h" -#endif /* sanity check -- make sure ipos, apos, and count make sense */ #ifdef HSANITY -static void hsanity(t) -htab *t; -{ - ub4 i, end, counter; +static void hsanity( + htab *t +) { + uint32_t i, end, counter; hitem *h; /* test that apos makes sense */ - end = (ub4)1<<(t->logsize); + end = (uint32_t)1<<(t->logsize); if (end < t->apos) printf("error: end %lu apos %lu\n", end, t->apos); @@ -83,12 +76,12 @@ htab *t; * move everything from the old array to the new array, * then free the old array. */ -static void hgrow( t) -htab *t; /* table */ -{ - register ub4 newsize = (ub4)1<<(++t->logsize); - register ub4 newmask = newsize-1; - register ub4 i; +static void hgrow( + htab *t /* table */ +) { + register uint32_t newsize = (uint32_t)1<<(++t->logsize); + register uint32_t newmask = newsize-1; + register uint32_t i; register hitem **oldtab = t->table; register hitem **newtab = (hitem **)malloc(newsize*sizeof(hitem *)); @@ -117,23 +110,22 @@ htab *t; /* table */ /* free the old array */ free((char *)oldtab); - } /* hcreate - create a hash table initially of size power(2,logsize) */ -htab *hcreate(logsize) -word logsize; /* log base 2 of the size of the hash table */ -{ - ub4 i,len; +htab *hcreate( + int logsize /* log base 2 of the size of the hash table */ +) { + uint32_t i,len; htab *t = (htab *)malloc(sizeof(htab)); - len = ((ub4)1<table = (hitem **)malloc(sizeof(hitem *)*(ub4)len); + len = ((uint32_t)1<table = (hitem **)malloc(sizeof(hitem *)*(uint32_t)len); for (i=0; itable[i] = (hitem *)0; t->logsize = logsize; t->mask = len-1; t->count = 0; - t->apos = (ub4)0; + t->apos = (uint32_t)0; t->ipos = (hitem *)0; t->space = remkroot(sizeof(hitem)); t->bcount = 0; @@ -141,9 +133,9 @@ word logsize; /* log base 2 of the size of the hash table */ } /* hdestroy - destroy the hash table and free all its memory */ -void hdestroy( t) -htab *t; /* the table */ -{ +void hdestroy( + htab *t /* the table */ +) { refree(t->space); free((char *)t->table); free((char *)t); @@ -155,14 +147,14 @@ htab *t; /* the table */ /* hstuff() is a macro, see hashtab.h */ /* hfind - find an item with a given key in a hash table */ -word hfind( t, key, keyl ) -htab *t; /* table */ -ub1 *key; /* key to find */ -ub4 keyl; /* key length */ -{ +int hfind( + htab *t, /* table */ + const char *key, /* key to find */ + size_t keyl /* key length */ +) { hitem *h; - ub4 x = lookup(key,keyl,0); - ub4 y; + uint32_t x = lookup(key,keyl,0); + uint32_t y; for (h = t->table[y=(x&t->mask)]; h; h = h->next) { if ((x == h->hval) && @@ -171,24 +163,24 @@ ub4 keyl; /* key length */ { t->apos = y; t->ipos = h; - return TRUE; + return true; } } - return FALSE; + return false; } /* * hadd - add an item to a hash table. * return FALSE if the key is already there, otherwise TRUE. */ -word hadd( t, key, keyl, stuff) -htab *t; /* table */ -ub1 *key; /* key to add to hash table */ -ub4 keyl; /* key length */ -void *stuff; /* stuff to associate with this key */ -{ +int hadd( + htab *t, /* table */ + const char *key, /* key to add to hash table */ + size_t keyl, /* key length */ + void *stuff /* stuff to associate with this key */ +) { register hitem *h,**hp; - register ub4 y, x = lookup(key,keyl,0); + register uint32_t y, x = lookup(key,keyl,0); /* make sure the key is not already there */ for (h = t->table[(y=(x&t->mask))]; h; h = h->next) @@ -199,7 +191,7 @@ void *stuff; /* stuff to associate with this key */ { t->apos = y; t->ipos = h; - return FALSE; + return false; } } @@ -207,7 +199,7 @@ void *stuff; /* stuff to associate with this key */ h = (hitem *)renew(t->space); /* make the hash table bigger if it is getting full */ - if (++t->count > (ub4)1<<(t->logsize)) + if (++t->count > (uint32_t)1<<(t->logsize)) { hgrow(t); y = (x&t->mask); @@ -228,18 +220,18 @@ void *stuff; /* stuff to associate with this key */ hsanity(t); #endif /* HSANITY */ - return TRUE; + return true; } /* hdel - delete the item at the current position */ -word hdel(t) -htab *t; /* the hash table */ -{ +int hdel( + htab *t /* the hash table */ +) { hitem *h; /* item being deleted */ hitem **ip; /* a counter */ /* check for item not existing */ - if (!(h = t->ipos)) return FALSE; + if (!(h = t->ipos)) return false; /* remove item from its list */ for (ip = &t->table[t->apos]; *ip != h; ip = &(*ip)->next) @@ -257,13 +249,13 @@ htab *t; /* the hash table */ hsanity(t); #endif /* HSANITY */ - return TRUE; + return true; } /* hfirst - position on the first element in the table */ -word hfirst(t) -htab *t; /* the hash table */ -{ +int hfirst( + htab *t /* the hash table */ +) { t->apos = t->mask; (void)hnbucket(t); return (t->ipos != (hitem *)0); @@ -275,12 +267,12 @@ htab *t; /* the hash table */ * hnbucket - Move position to the first item in the next bucket. * Return TRUE if we did not wrap around to the beginning of the table */ -word hnbucket(t) -htab *t; -{ - ub4 oldapos = t->apos; - ub4 end = (ub4)1<<(t->logsize); - ub4 i; +int hnbucket( + htab *t /* hash table */ +) { + uint32_t oldapos = t->apos; + uint32_t end = (uint32_t)1<<(t->logsize); + uint32_t i; /* see if the element can be found without wrapping around */ for (i=oldapos+1; iapos = i; t->ipos = t->table[i]; - return TRUE; + return true; } } @@ -300,18 +292,18 @@ htab *t; { t->apos = i; t->ipos = t->table[i]; - return FALSE; + return false; } } - return FALSE; + return false; } #ifdef HSTAT -void hstat(t) -htab *t; -{ - ub4 i,j; +void hstat( + htab *t +) { + uint32_t i,j; double total = 0.0; hitem *h; hitem *walk, *walk2, *stat = (hitem *)0; @@ -360,7 +352,7 @@ htab *t; printf("items %ld: %ld buckets\n", walk->keyl, walk->hval); } printf("\nbuckets: %lu items: %ld existing: %g\n\n", - ((ub4)1<logsize), t->count, total); + ((uint32_t)1<logsize), t->count, total); /* clean up */ while (stat) diff --git a/ee/erl/src/lookupa.c b/ee/erl/src/lookupa.c index bee6ba43bcd..89bad6aa114 100644 --- a/ee/erl/src/lookupa.c +++ b/ee/erl/src/lookupa.c @@ -5,13 +5,12 @@ Use this code however you wish. Public Domain. No warranty. Source is http://burtleburtle.net/bob/c/lookupa.c -------------------------------------------------------------------- */ -#ifndef STANDARD -#include "standard.h" -#endif #ifndef LOOKUPA #include "lookupa.h" #endif +#include + /* -------------------------------------------------------------------- mix -- mix 3 32-bit values reversibly. @@ -67,7 +66,7 @@ use a bitmask. For example, if you need only 10 bits, do h = (h & hashmask(10)); In which case, the hash table should have hashsize(10) elements. -If you are hashing n strings (ub1 **)k, do it like this: +If you are hashing n strings (const char **)k, do it like this: for (i=0, h=0; i= 12) { - a += (k[0] +((ub4)k[1]<<8) +((ub4)k[2]<<16) +((ub4)k[3]<<24)); - b += (k[4] +((ub4)k[5]<<8) +((ub4)k[6]<<16) +((ub4)k[7]<<24)); - c += (k[8] +((ub4)k[9]<<8) +((ub4)k[10]<<16)+((ub4)k[11]<<24)); + a += (k[0] +((uint32_t)k[1]<<8) +((uint32_t)k[2]<<16) +((uint32_t)k[3]<<24)); + b += (k[4] +((uint32_t)k[5]<<8) +((uint32_t)k[6]<<16) +((uint32_t)k[7]<<24)); + c += (k[8] +((uint32_t)k[9]<<8) +((uint32_t)k[10]<<16)+((uint32_t)k[11]<<24)); mix(a,b,c); k += 12; len -= 12; } @@ -105,17 +104,17 @@ register ub4 level; /* the previous hash, or an arbitrary value */ c += length; switch(len) /* all the case statements fall through */ { - case 11: c+=((ub4)k[10]<<24); - case 10: c+=((ub4)k[9]<<16); - case 9 : c+=((ub4)k[8]<<8); + case 11: c+=((uint32_t)k[10]<<24); + case 10: c+=((uint32_t)k[9]<<16); + case 9 : c+=((uint32_t)k[8]<<8); /* the first byte of c is reserved for the length */ - case 8 : b+=((ub4)k[7]<<24); - case 7 : b+=((ub4)k[6]<<16); - case 6 : b+=((ub4)k[5]<<8); + case 8 : b+=((uint32_t)k[7]<<24); + case 7 : b+=((uint32_t)k[6]<<16); + case 6 : b+=((uint32_t)k[5]<<8); case 5 : b+=k[4]; - case 4 : a+=((ub4)k[3]<<24); - case 3 : a+=((ub4)k[2]<<16); - case 2 : a+=((ub4)k[1]<<8); + case 4 : a+=((uint32_t)k[3]<<24); + case 3 : a+=((uint32_t)k[2]<<16); + case 2 : a+=((uint32_t)k[1]<<8); case 1 : a+=k[0]; /* case 0: nothing left to add */ } @@ -154,7 +153,7 @@ checksum() -- hash a variable-length key into a 256-bit value The state is the checksum. Every bit of the key affects every bit of the state. There are no funnels. About 112+6.875len instructions. -If you are hashing n strings (ub1 **)k, do it like this: +If you are hashing n strings (const char **)k, do it like this: for (i=0; i<8; ++i) state[i] = 0x9e3779b9; for (i=0, h=0; i #include -#ifndef STANDARD -# include "standard.h" -#endif -#ifndef RECYCLE -# include "recycle.h" -#endif - -reroot *remkroot(size) -size_t size; -{ +reroot *remkroot( + size_t size +) { reroot *r = (reroot *)remalloc(sizeof(reroot)); r->list = (recycle *)0; r->trash = (recycle *)0; @@ -35,9 +30,9 @@ size_t size; return r; } -void refree(r) -struct reroot *r; -{ +void refree( + struct reroot *r +) { while (r->list) { recycle *temp = r->list->next; @@ -49,9 +44,9 @@ struct reroot *r; } /* to be called from the macro renew only */ -char *renewx(r) -struct reroot *r; -{ +char *renewx( + struct reroot *r +) { recycle *temp; if (r->trash) { /* pull a node off the trash heap */ @@ -61,7 +56,7 @@ struct reroot *r; } else { /* allocate a new block of nodes */ - r->numleft = r->size*((ub4)1<logsize); + r->numleft = r->size*((uint32_t)1<logsize); if (r->numleft < REMAX) ++r->logsize; temp = (recycle *)remalloc(sizeof(recycle) + r->numleft); temp->next = r->list; @@ -72,9 +67,9 @@ struct reroot *r; return (char *)temp; } -char *remalloc(len) -size_t len; -{ +char *remalloc( + size_t len +) { char *x = (char *)malloc(len); if (!x) {