From: Nick Ing-Simmons Date: Fri, 31 Oct 1997 01:43:49 +0000 (+0000) Subject: Convert miniperl sources to ANSI C. Several passes of X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8ac853655d9b744749adcb9687c13d99cdd6e9fb;p=p5sagit%2Fp5-mst-13.2.git Convert miniperl sources to ANSI C. Several passes of GNU C's 'protoize' plus a few hand edits. Will compile miniperl with gcc -x c++ (i.e. treat .c a C++ files) Does not link seems gcc's C++ does not define a symbol for const char foo[] = "...."; i.e. with empty []. p4raw-id: //depot/ansiperl@194 --- diff --git a/av.c b/av.c index 933e655..5a86460 100644 --- a/av.c +++ b/av.c @@ -16,8 +16,7 @@ #include "perl.h" void -av_reify(av) -AV* av; +av_reify(AV *av) { I32 key; SV* sv; @@ -42,9 +41,7 @@ AV* av; } void -av_extend(av,key) -AV *av; -I32 key; +av_extend(AV *av, I32 key) { dTHR; /* only necessary if we have to extend stack */ if (key > AvMAX(av)) { @@ -123,10 +120,7 @@ I32 key; } SV** -av_fetch(av,key,lval) -register AV *av; -I32 key; -I32 lval; +av_fetch(register AV *av, I32 key, I32 lval) { SV *sv; @@ -175,10 +169,7 @@ I32 lval; } SV** -av_store(av,key,val) -register AV *av; -I32 key; -SV *val; +av_store(register AV *av, I32 key, SV *val) { SV** ary; @@ -232,7 +223,7 @@ SV *val; } AV * -newAV() +newAV(void) { register AV *av; @@ -246,9 +237,7 @@ newAV() } AV * -av_make(size,strp) -register I32 size; -register SV **strp; +av_make(register I32 size, register SV **strp) { register AV *av; register I32 i; @@ -274,9 +263,7 @@ register SV **strp; } AV * -av_fake(size,strp) -register I32 size; -register SV **strp; +av_fake(register I32 size, register SV **strp) { register AV *av; register SV** ary; @@ -299,8 +286,7 @@ register SV **strp; } void -av_clear(av) -register AV *av; +av_clear(register AV *av) { register I32 key; SV** ary; @@ -333,8 +319,7 @@ register AV *av; } void -av_undef(av) -register AV *av; +av_undef(register AV *av) { register I32 key; @@ -357,9 +342,7 @@ register AV *av; } void -av_push(av,val) -register AV *av; -SV *val; +av_push(register AV *av, SV *val) { if (!av) return; @@ -367,8 +350,7 @@ SV *val; } SV * -av_pop(av) -register AV *av; +av_pop(register AV *av) { SV *retval; @@ -384,9 +366,7 @@ register AV *av; } void -av_unshift(av,num) -register AV *av; -register I32 num; +av_unshift(register AV *av, register I32 num) { register I32 i; register SV **sstr,**dstr; @@ -427,8 +407,7 @@ register I32 num; } SV * -av_shift(av) -register AV *av; +av_shift(register AV *av) { SV *retval; @@ -448,16 +427,13 @@ register AV *av; } I32 -av_len(av) -register AV *av; +av_len(register AV *av) { return AvFILL(av); } void -av_fill(av, fill) -register AV *av; -I32 fill; +av_fill(register AV *av, I32 fill) { if (!av) croak("panic: null array"); @@ -487,11 +463,7 @@ I32 fill; } SV** -avhv_fetch(av, key, klen, lval) -AV *av; -char *key; -U32 klen; -I32 lval; +avhv_fetch(AV *av, char *key, U32 klen, I32 lval) { SV **keys, **indsvp; I32 ind; @@ -515,11 +487,7 @@ I32 lval; } SV** -avhv_fetch_ent(av, keysv, lval, hash) -AV *av; -SV *keysv; -I32 lval; -U32 hash; +avhv_fetch_ent(AV *av, SV *keysv, I32 lval, U32 hash) { SV **keys, **indsvp; HE *he; @@ -544,12 +512,7 @@ U32 hash; } SV** -avhv_store(av, key, klen, val, hash) -AV *av; -char *key; -U32 klen; -SV *val; -U32 hash; +avhv_store(AV *av, char *key, U32 klen, SV *val, U32 hash) { SV **keys, **indsvp; I32 ind; @@ -570,11 +533,7 @@ U32 hash; } SV** -avhv_store_ent(av, keysv, val, hash) -AV *av; -SV *keysv; -SV *val; -U32 hash; +avhv_store_ent(AV *av, SV *keysv, SV *val, U32 hash) { SV **keys; HE *he; @@ -596,10 +555,7 @@ U32 hash; } bool -avhv_exists_ent(av, keysv, hash) -AV *av; -SV *keysv; -U32 hash; +avhv_exists_ent(AV *av, SV *keysv, U32 hash) { SV **keys; @@ -610,10 +566,7 @@ U32 hash; } bool -avhv_exists(av, key, klen) -AV *av; -char *key; -U32 klen; +avhv_exists(AV *av, char *key, U32 klen) { SV **keys; @@ -625,11 +578,7 @@ U32 klen; /* avhv_delete leaks. Caller can re-index and compress if so desired. */ SV * -avhv_delete(av, key, klen, flags) -AV *av; -char *key; -U32 klen; -I32 flags; +avhv_delete(AV *av, char *key, U32 klen, I32 flags) { SV **keys; SV *sv; @@ -660,11 +609,7 @@ I32 flags; /* avhv_delete_ent leaks. Caller can re-index and compress if so desired. */ SV * -avhv_delete_ent(av, keysv, flags, hash) -AV *av; -SV *keysv; -I32 flags; -U32 hash; +avhv_delete_ent(AV *av, SV *keysv, I32 flags, U32 hash) { SV **keys; SV *sv; @@ -694,8 +639,7 @@ U32 hash; } I32 -avhv_iterinit(av) -AV *av; +avhv_iterinit(AV *av) { SV **keys; @@ -706,8 +650,7 @@ AV *av; } HE * -avhv_iternext(av) -AV *av; +avhv_iternext(AV *av) { SV **keys; @@ -718,9 +661,7 @@ AV *av; } SV * -avhv_iterval(av, entry) -AV *av; -register HE *entry; +avhv_iterval(AV *av, register HE *entry) { SV **keys; SV *sv; @@ -737,10 +678,7 @@ register HE *entry; } SV * -avhv_iternextsv(av, key, retlen) -AV *av; -char **key; -I32 *retlen; +avhv_iternextsv(AV *av, char **key, I32 *retlen) { SV **keys; HE *he; diff --git a/deb.c b/deb.c index 01463c9..95ea3f4 100644 --- a/deb.c +++ b/deb.c @@ -88,7 +88,7 @@ deb(pat, va_alist) #endif /* !defined(I_STDARG) && !defined(I_VARARGS) */ void -deb_growlevel() +deb_growlevel(void) { dlmax += 128; Renew(debname, dlmax, char); @@ -96,7 +96,7 @@ deb_growlevel() } I32 -debstackptrs() +debstackptrs(void) { dTHR; PerlIO_printf(Perl_debug_log, "%8lx %8lx %8ld %8ld %8ld\n", @@ -110,7 +110,7 @@ debstackptrs() } I32 -debstack() +debstack(void) { dTHR; I32 top = stack_sp - stack_base; diff --git a/doio.c b/doio.c index 54b6d56..afb9e75 100644 --- a/doio.c +++ b/doio.c @@ -76,13 +76,7 @@ #endif bool -do_open(gv,name,len,as_raw,rawmode,rawperm,supplied_fp) -GV *gv; -register char *name; -I32 len; -int as_raw; -int rawmode, rawperm; -PerlIO *supplied_fp; +do_open(GV *gv, register char *name, I32 len, int as_raw, int rawmode, int rawperm, FILE *supplied_fp) { register IO *io = GvIOn(gv); PerlIO *saveifp = Nullfp; @@ -364,8 +358,7 @@ say_false: } PerlIO * -nextargv(gv) -register GV *gv; +nextargv(register GV *gv) { register SV *sv; #ifndef FLEXFILENAMES @@ -514,10 +507,7 @@ register GV *gv; #ifdef HAS_PIPE void -do_pipe(sv, rgv, wgv) -SV *sv; -GV *rgv; -GV *wgv; +do_pipe(SV *sv, GV *rgv, GV *wgv) { register IO *rstio; register IO *wstio; @@ -596,8 +586,7 @@ do_close(GV *gv, bool not_implicit) } bool -io_close(io) -IO* io; +io_close(IO *io) { bool retval = FALSE; int status; @@ -625,8 +614,7 @@ IO* io; } bool -do_eof(gv) -GV *gv; +do_eof(GV *gv) { dTHR; register IO *io; @@ -664,8 +652,7 @@ GV *gv; } long -do_tell(gv) -GV *gv; +do_tell(GV *gv) { register IO *io; register PerlIO *fp; @@ -684,10 +671,7 @@ GV *gv; } bool -do_seek(gv, pos, whence) -GV *gv; -long pos; -int whence; +do_seek(GV *gv, long int pos, int whence) { register IO *io; register PerlIO *fp; @@ -706,10 +690,7 @@ int whence; } long -do_sysseek(gv, pos, whence) -GV *gv; -long pos; -int whence; +do_sysseek(GV *gv, long int pos, int whence) { register IO *io; register PerlIO *fp; @@ -774,9 +755,7 @@ Off_t length; /* length to set file to */ #endif /* F_FREESP */ bool -do_print(sv,fp) -register SV *sv; -PerlIO *fp; +do_print(register SV *sv, FILE *fp) { register char *tmps; STRLEN len; @@ -820,8 +799,7 @@ PerlIO *fp; } I32 -my_stat(ARGS) -dARGS +my_stat(ARGSproto) { dSP; IO *io; @@ -872,8 +850,7 @@ dARGS } I32 -my_lstat(ARGS) -dARGS +my_lstat(ARGSproto) { dSP; SV *sv; @@ -903,10 +880,7 @@ dARGS } bool -do_aexec(really,mark,sp) -SV *really; -register SV **mark; -register SV **sp; +do_aexec(SV *really, register SV **mark, register SV **sp) { register char **a; char *tmps; @@ -936,7 +910,7 @@ register SV **sp; } void -do_execfree() +do_execfree(void) { if (Argv) { Safefree(Argv); @@ -951,8 +925,7 @@ do_execfree() #if !defined(OS2) && !defined(WIN32) bool -do_exec(cmd) -char *cmd; +do_exec(char *cmd) { register char **a; register char *s; @@ -1042,10 +1015,7 @@ char *cmd; #endif /* OS2 || WIN32 */ I32 -apply(type,mark,sp) -I32 type; -register SV **mark; -register SV **sp; +apply(I32 type, register SV **mark, register SV **sp) { dTHR; register I32 val; @@ -1215,10 +1185,7 @@ register SV **sp; /* Do the permissions allow some operation? Assumes statcache already set. */ #ifndef VMS /* VMS' cando is in vms.c */ I32 -cando(bit, effective, statbufp) -I32 bit; -I32 effective; -register struct stat *statbufp; +cando(I32 bit, I32 effective, register struct stat *statbufp) { #ifdef DOSISH /* [Comments and code from Len Reed] @@ -1270,9 +1237,7 @@ register struct stat *statbufp; #endif /* ! VMS */ I32 -ingroup(testgid,effective) -I32 testgid; -I32 effective; +ingroup(I32 testgid, I32 effective) { if (testgid == (effective ? egid : gid)) return TRUE; @@ -1296,10 +1261,7 @@ I32 effective; #if defined(HAS_MSG) || defined(HAS_SEM) || defined(HAS_SHM) I32 -do_ipcget(optype, mark, sp) -I32 optype; -SV **mark; -SV **sp; +do_ipcget(I32 optype, SV **mark, SV **sp) { dTHR; key_t key; @@ -1332,10 +1294,7 @@ SV **sp; } I32 -do_ipcctl(optype, mark, sp) -I32 optype; -SV **mark; -SV **sp; +do_ipcctl(I32 optype, SV **mark, SV **sp) { dTHR; SV *astr; @@ -1457,9 +1416,7 @@ SV **sp; } I32 -do_msgsnd(mark, sp) -SV **mark; -SV **sp; +do_msgsnd(SV **mark, SV **sp) { #ifdef HAS_MSG dTHR; @@ -1482,9 +1439,7 @@ SV **sp; } I32 -do_msgrcv(mark, sp) -SV **mark; -SV **sp; +do_msgrcv(SV **mark, SV **sp) { #ifdef HAS_MSG dTHR; @@ -1521,9 +1476,7 @@ SV **sp; } I32 -do_semop(mark, sp) -SV **mark; -SV **sp; +do_semop(SV **mark, SV **sp) { #ifdef HAS_SEM dTHR; @@ -1548,10 +1501,7 @@ SV **sp; } I32 -do_shmio(optype, mark, sp) -I32 optype; -SV **mark; -SV **sp; +do_shmio(I32 optype, SV **mark, SV **sp) { #ifdef HAS_SHM dTHR; @@ -1572,7 +1522,7 @@ SV **sp; SETERRNO(EFAULT,SS$_ACCVIO); /* can't do as caller requested */ return -1; } - shm = (Shmat_t)shmat(id, (char*)NULL, (optype == OP_SHMREAD) ? SHM_RDONLY : 0); + shm = (char *)shmat(id, (char*)NULL, (optype == OP_SHMREAD) ? SHM_RDONLY : 0); if (shm == (char *)-1) /* I hate System V IPC, I really do */ return -1; if (optype == OP_SHMREAD) { diff --git a/doop.c b/doop.c index 3f8bd10..5042e3c 100644 --- a/doop.c +++ b/doop.c @@ -19,9 +19,7 @@ #endif I32 -do_trans(sv,arg) -SV *sv; -OP *arg; +do_trans(SV *sv, OP *arg) { dTHR; register short *tbl; @@ -82,11 +80,7 @@ OP *arg; } void -do_join(sv,del,mark,sp) -register SV *sv; -SV *del; -register SV **mark; -register SV **sp; +do_join(register SV *sv, SV *del, register SV **mark, register SV **sp) { SV **oldmark = mark; register I32 items = sp - mark; @@ -142,10 +136,7 @@ register SV **sp; } void -do_sprintf(sv,len,sarg) -SV *sv; -I32 len; -SV **sarg; +do_sprintf(SV *sv, I32 len, SV **sarg) { STRLEN patlen; char *pat = SvPV(*sarg, patlen); @@ -158,8 +149,7 @@ SV **sarg; } void -do_vecset(sv) -SV *sv; +do_vecset(SV *sv) { SV *targ = LvTARG(sv); register I32 offset; @@ -210,9 +200,7 @@ SV *sv; } void -do_chop(astr,sv) -register SV *astr; -register SV *sv; +do_chop(register SV *astr, register SV *sv) { STRLEN len; char *s; @@ -254,8 +242,7 @@ register SV *sv; } I32 -do_chomp(sv) -register SV *sv; +do_chomp(register SV *sv) { register I32 count; STRLEN len; @@ -328,11 +315,7 @@ register SV *sv; } void -do_vop(optype,sv,left,right) -I32 optype; -SV *sv; -SV *left; -SV *right; +do_vop(I32 optype, SV *sv, SV *left, SV *right) { #ifdef LIBERAL register long *dl; @@ -445,8 +428,7 @@ SV *right; } OP * -do_kv(ARGS) -dARGS +do_kv(ARGSproto) { dSP; HV *hv = (HV*)POPs; diff --git a/dump.c b/dump.c index cf9cf5d..51fd157 100644 --- a/dump.c +++ b/dump.c @@ -17,7 +17,7 @@ #ifndef DEBUGGING void -dump_all() +dump_all(void) { } #else /* Rest of file is for DEBUGGING */ @@ -29,7 +29,7 @@ static void dump(); #endif void -dump_all() +dump_all(void) { dTHR; PerlIO_setlinebuf(Perl_debug_log); @@ -39,8 +39,7 @@ dump_all() } void -dump_packsubs(stash) -HV* stash; +dump_packsubs(HV *stash) { dTHR; I32 i; @@ -64,8 +63,7 @@ HV* stash; } void -dump_sub(gv) -GV* gv; +dump_sub(GV *gv) { SV *sv = sv_newmortal(); @@ -82,8 +80,7 @@ GV* gv; } void -dump_form(gv) -GV* gv; +dump_form(GV *gv) { SV *sv = sv_newmortal(); @@ -96,14 +93,13 @@ GV* gv; } void -dump_eval() +dump_eval(void) { dump_op(eval_root); } void -dump_op(o) -register OP *o; +dump_op(OP *o) { dump("{\n"); if (o->op_seq) @@ -316,8 +312,7 @@ register OP *o; } void -dump_gv(gv) -register GV *gv; +dump_gv(GV *gv) { SV *sv; @@ -340,8 +335,7 @@ register GV *gv; } void -dump_pm(pm) -register PMOP *pm; +dump_pm(PMOP *pm) { char ch; diff --git a/gv.c b/gv.c index 16f16ae..7419d43 100644 --- a/gv.c +++ b/gv.c @@ -22,8 +22,7 @@ EXT char rcsid[]; GV * -gv_AVadd(gv) -register GV *gv; +gv_AVadd(register GV *gv) { if (!gv || SvTYPE((SV*)gv) != SVt_PVGV) croak("Bad symbol for array"); @@ -33,8 +32,7 @@ register GV *gv; } GV * -gv_HVadd(gv) -register GV *gv; +gv_HVadd(register GV *gv) { if (!gv || SvTYPE((SV*)gv) != SVt_PVGV) croak("Bad symbol for hash"); @@ -44,8 +42,7 @@ register GV *gv; } GV * -gv_IOadd(gv) -register GV *gv; +gv_IOadd(register GV *gv) { if (!gv || SvTYPE((SV*)gv) != SVt_PVGV) croak("Bad symbol for filehandle"); @@ -55,8 +52,7 @@ register GV *gv; } GV * -gv_fetchfile(name) -char *name; +gv_fetchfile(char *name) { dTHR; char smallbuf[256]; @@ -86,12 +82,7 @@ char *name; } void -gv_init(gv, stash, name, len, multi) -GV *gv; -HV *stash; -char *name; -STRLEN len; -int multi; +gv_init(GV *gv, HV *stash, char *name, STRLEN len, int multi) { dTHR; register GP *gp; @@ -114,9 +105,7 @@ int multi; } static void -gv_init_sv(gv, sv_type) -GV* gv; -I32 sv_type; +gv_init_sv(GV *gv, I32 sv_type) { switch (sv_type) { case SVt_PVIO: @@ -132,11 +121,7 @@ I32 sv_type; } GV * -gv_fetchmeth(stash, name, len, level) -HV* stash; -char* name; -STRLEN len; -I32 level; +gv_fetchmeth(HV *stash, char *name, STRLEN len, I32 level) { AV* av; GV* topgv; @@ -249,18 +234,13 @@ I32 level; } GV * -gv_fetchmethod(stash, name) -HV* stash; -char* name; +gv_fetchmethod(HV *stash, char *name) { return gv_fetchmethod_autoload(stash, name, TRUE); } GV * -gv_fetchmethod_autoload(stash, name, autoload) -HV* stash; -char* name; -I32 autoload; +gv_fetchmethod_autoload(HV *stash, char *name, I32 autoload) { dTHR; register char *nend; @@ -321,11 +301,7 @@ I32 autoload; } GV* -gv_autoload4(stash, name, len, method) -HV* stash; -char* name; -STRLEN len; -I32 method; +gv_autoload4(HV *stash, char *name, STRLEN len, I32 method) { static char autoload[] = "AUTOLOAD"; static STRLEN autolen = 8; @@ -368,18 +344,13 @@ I32 method; } HV* -gv_stashpv(name,create) -char *name; -I32 create; +gv_stashpv(char *name, I32 create) { return gv_stashpvn(name, strlen(name), create); } HV* -gv_stashpvn(name,namelen,create) -char *name; -U32 namelen; -I32 create; +gv_stashpvn(char *name, U32 namelen, I32 create) { char smallbuf[256]; char *tmpbuf; @@ -408,9 +379,7 @@ I32 create; } HV* -gv_stashsv(sv,create) -SV *sv; -I32 create; +gv_stashsv(SV *sv, I32 create) { register char *ptr; STRLEN len; @@ -420,10 +389,7 @@ I32 create; GV * -gv_fetchpv(nambeg,add,sv_type) -char *nambeg; -I32 add; -I32 sv_type; +gv_fetchpv(char *nambeg, I32 add, I32 sv_type) { dTHR; register char *name = nambeg; @@ -778,10 +744,7 @@ I32 sv_type; } void -gv_fullname3(sv, gv, prefix) -SV *sv; -GV *gv; -char *prefix; +gv_fullname3(SV *sv, GV *gv, char *prefix) { HV *hv = GvSTASH(gv); if (!hv) { @@ -795,10 +758,7 @@ char *prefix; } void -gv_efullname3(sv, gv, prefix) -SV *sv; -GV *gv; -char *prefix; +gv_efullname3(SV *sv, GV *gv, char *prefix) { GV *egv = GvEGV(gv); if (!egv) @@ -808,24 +768,20 @@ char *prefix; /* XXX compatibility with versions <= 5.003. */ void -gv_fullname(sv,gv) -SV *sv; -GV *gv; +gv_fullname(SV *sv, GV *gv) { gv_fullname3(sv, gv, sv == (SV*)gv ? "*" : ""); } /* XXX compatibility with versions <= 5.003. */ void -gv_efullname(sv,gv) -SV *sv; -GV *gv; +gv_efullname(SV *sv, GV *gv) { gv_efullname3(sv, gv, sv == (SV*)gv ? "*" : ""); } IO * -newIO() +newIO(void) { dTHR; IO *io; @@ -843,8 +799,7 @@ newIO() } void -gv_check(stash) -HV* stash; +gv_check(HV *stash) { dTHR; register HE *entry; @@ -880,8 +835,7 @@ HV* stash; } GV * -newGVgen(pack) -char *pack; +newGVgen(char *pack) { return gv_fetchpv(form("%s::_GEN_%ld", pack, (long)gensym++), TRUE, SVt_PVGV); @@ -890,8 +844,7 @@ char *pack; /* hopefully this is only called on local symbol table entries */ GP* -gp_ref(gp) -GP* gp; +gp_ref(GP *gp) { gp->gp_refcnt++; if (gp->gp_cv) { @@ -910,8 +863,7 @@ GP* gp; } void -gp_free(gv) -GV* gv; +gp_free(GV *gv) { GP* gp; CV* cv; @@ -971,8 +923,7 @@ register GV *gv; /* Updates and caches the CV's */ bool -Gv_AMupdate(stash) -HV* stash; +Gv_AMupdate(HV *stash) { dTHR; GV** gvp; @@ -980,7 +931,7 @@ HV* stash; GV* gv; CV* cv; MAGIC* mg=mg_find((SV*)stash,'c'); - AMT *amtp=mg ? (AMT*)mg->mg_ptr: NULL; + AMT *amtp = (mg) ? (AMT*)mg->mg_ptr: (AMT *) NULL; AMT amt; if (mg && amtp->was_ok_am == amagic_generation @@ -1132,11 +1083,7 @@ HV* stash; * advised to call SPAGAIN macro in your code after call */ SV* -amagic_call(left,right,method,flags) -SV* left; -SV* right; -int method; -int flags; +amagic_call(SV *left, SV *right, int method, int flags) { dTHR; MAGIC *mg; @@ -1150,7 +1097,7 @@ int flags; && (mg = mg_find((SV*)(stash=SvSTASH(SvRV(left))),'c')) && (ocvp = cvp = (AMT_AMAGIC((AMT*)mg->mg_ptr) ? (oamtp = amtp = (AMT*)mg->mg_ptr)->table - : NULL)) + : (CV **) NULL)) && ((cv = cvp[off=method+assignshift]) || (assign && amtp->fallback > AMGfallNEVER && /* fallback to * usual method */ @@ -1243,7 +1190,7 @@ int flags; && (mg = mg_find((SV*)(stash=SvSTASH(SvRV(right))),'c')) && (cvp = (AMT_AMAGIC((AMT*)mg->mg_ptr) ? (amtp = (AMT*)mg->mg_ptr)->table - : NULL)) + : (CV **) NULL)) && (cv = cvp[off=method])) { /* Method for right * argument found */ lr=1; diff --git a/hv.c b/hv.c index 50ff060..2ef9ae3 100644 --- a/hv.c +++ b/hv.c @@ -17,10 +17,10 @@ static void hsplit _((HV *hv)); static void hfreeentries _((HV *hv)); -static HE* more_he(); +static HE* more_he(void); static HE* -new_he() +new_he(void) { HE* he; if (he_root) { @@ -32,15 +32,14 @@ new_he() } static void -del_he(p) -HE* p; +del_he(HE *p) { HeNEXT(p) = (HE*)he_root; he_root = p; } static HE* -more_he() +more_he(void) { register HE* he; register HE* heend; @@ -56,10 +55,7 @@ more_he() } static HEK * -save_hek(str, len, hash) -char *str; -I32 len; -U32 hash; +save_hek(char *str, I32 len, U32 hash) { char *k; register HEK *hek; @@ -74,8 +70,7 @@ U32 hash; } void -unshare_hek(hek) -HEK *hek; +unshare_hek(HEK *hek) { unsharepvn(HEK_KEY(hek),HEK_LEN(hek),HEK_HASH(hek)); } @@ -84,11 +79,7 @@ HEK *hek; * contains an SV* */ SV** -hv_fetch(hv,key,klen,lval) -HV *hv; -char *key; -U32 klen; -I32 lval; +hv_fetch(HV *hv, char *key, U32 klen, I32 lval) { register XPVHV* xhv; register U32 hash; @@ -153,11 +144,7 @@ I32 lval; /* returns a HE * structure with the all fields set */ /* note that hent_val will be a mortal sv for MAGICAL hashes */ HE * -hv_fetch_ent(hv,keysv,lval,hash) -HV *hv; -SV *keysv; -I32 lval; -register U32 hash; +hv_fetch_ent(HV *hv, SV *keysv, I32 lval, register U32 hash) { register XPVHV* xhv; register char *key; @@ -230,12 +217,7 @@ register U32 hash; } SV** -hv_store(hv,key,klen,val,hash) -HV *hv; -char *key; -U32 klen; -SV *val; -register U32 hash; +hv_store(HV *hv, char *key, U32 klen, SV *val, register U32 hash) { register XPVHV* xhv; register I32 i; @@ -298,11 +280,7 @@ register U32 hash; } HE * -hv_store_ent(hv,keysv,val,hash) -HV *hv; -SV *keysv; -SV *val; -register U32 hash; +hv_store_ent(HV *hv, SV *keysv, SV *val, register U32 hash) { register XPVHV* xhv; register char *key; @@ -375,11 +353,7 @@ register U32 hash; } SV * -hv_delete(hv,key,klen,flags) -HV *hv; -char *key; -U32 klen; -I32 flags; +hv_delete(HV *hv, char *key, U32 klen, I32 flags) { register XPVHV* xhv; register I32 i; @@ -435,11 +409,7 @@ I32 flags; } SV * -hv_delete_ent(hv,keysv,flags,hash) -HV *hv; -SV *keysv; -I32 flags; -U32 hash; +hv_delete_ent(HV *hv, SV *keysv, I32 flags, U32 hash) { register XPVHV* xhv; register I32 i; @@ -497,10 +467,7 @@ U32 hash; } bool -hv_exists(hv,key,klen) -HV *hv; -char *key; -U32 klen; +hv_exists(HV *hv, char *key, U32 klen) { register XPVHV* xhv; register U32 hash; @@ -541,10 +508,7 @@ U32 klen; bool -hv_exists_ent(hv,keysv,hash) -HV *hv; -SV *keysv; -U32 hash; +hv_exists_ent(HV *hv, SV *keysv, U32 hash) { register XPVHV* xhv; register char *key; @@ -588,8 +552,7 @@ U32 hash; } static void -hsplit(hv) -HV *hv; +hsplit(HV *hv) { register XPVHV* xhv = (XPVHV*)SvANY(hv); I32 oldsize = (I32) xhv->xhv_max + 1; /* sic(k) */ @@ -653,9 +616,7 @@ HV *hv; } void -hv_ksplit(hv, newmax) -HV *hv; -IV newmax; +hv_ksplit(HV *hv, IV newmax) { register XPVHV* xhv = (XPVHV*)SvANY(hv); I32 oldsize = (I32) xhv->xhv_max + 1; /* sic(k) */ @@ -731,7 +692,7 @@ IV newmax; } HV * -newHV() +newHV(void) { register HV *hv; register XPVHV* xhv; @@ -752,9 +713,7 @@ newHV() } void -hv_free_ent(hv, entry) -HV *hv; -register HE *entry; +hv_free_ent(HV *hv, register HE *entry) { if (!entry) return; @@ -773,9 +732,7 @@ register HE *entry; } void -hv_delayfree_ent(hv, entry) -HV *hv; -register HE *entry; +hv_delayfree_ent(HV *hv, register HE *entry) { if (!entry) return; @@ -794,8 +751,7 @@ register HE *entry; } void -hv_clear(hv) -HV *hv; +hv_clear(HV *hv) { register XPVHV* xhv; if (!hv) @@ -812,8 +768,7 @@ HV *hv; } static void -hfreeentries(hv) -HV *hv; +hfreeentries(HV *hv) { register HE **array; register HE *entry; @@ -846,8 +801,7 @@ HV *hv; } void -hv_undef(hv) -HV *hv; +hv_undef(HV *hv) { register XPVHV* xhv; if (!hv) @@ -869,8 +823,7 @@ HV *hv; } I32 -hv_iterinit(hv) -HV *hv; +hv_iterinit(HV *hv) { register XPVHV* xhv; HE *entry; @@ -893,8 +846,7 @@ HV *hv; } HE * -hv_iternext(hv) -HV *hv; +hv_iternext(HV *hv) { register XPVHV* xhv; register HE *entry; @@ -961,9 +913,7 @@ HV *hv; } char * -hv_iterkey(entry,retlen) -register HE *entry; -I32 *retlen; +hv_iterkey(register HE *entry, I32 *retlen) { if (HeKLEN(entry) == HEf_SVKEY) { STRLEN len; @@ -979,8 +929,7 @@ I32 *retlen; /* unlike hv_iterval(), this always returns a mortal copy of the key */ SV * -hv_iterkeysv(entry) -register HE *entry; +hv_iterkeysv(register HE *entry) { if (HeKLEN(entry) == HEf_SVKEY) return sv_mortalcopy(HeKEY_sv(entry)); @@ -990,9 +939,7 @@ register HE *entry; } SV * -hv_iterval(hv,entry) -HV *hv; -register HE *entry; +hv_iterval(HV *hv, register HE *entry) { if (SvRMAGICAL(hv)) { if (mg_find((SV*)hv,'P')) { @@ -1007,10 +954,7 @@ register HE *entry; } SV * -hv_iternextsv(hv, key, retlen) - HV *hv; - char **key; - I32 *retlen; +hv_iternextsv(HV *hv, char **key, I32 *retlen) { HE *he; if ( (he = hv_iternext(hv)) == NULL) @@ -1020,19 +964,13 @@ hv_iternextsv(hv, key, retlen) } void -hv_magic(hv, gv, how) -HV* hv; -GV* gv; -int how; +hv_magic(HV *hv, GV *gv, int how) { sv_magic((SV*)hv, (SV*)gv, how, Nullch, 0); } char* -sharepvn(sv, len, hash) -char* sv; -I32 len; -U32 hash; +sharepvn(char *sv, I32 len, U32 hash) { return HEK_KEY(share_hek(sv, len, hash)); } @@ -1041,10 +979,7 @@ U32 hash; * len and hash must both be valid for str. */ void -unsharepvn(str, len, hash) -char* str; -I32 len; -U32 hash; +unsharepvn(char *str, I32 len, U32 hash) { register XPVHV* xhv; register HE *entry; @@ -1088,10 +1023,7 @@ U32 hash; * len and hash must both be valid for str. */ HEK * -share_hek(str, len, hash) -char *str; -I32 len; -register U32 hash; +share_hek(char *str, I32 len, register U32 hash) { register XPVHV* xhv; register HE *entry; diff --git a/malloc.c b/malloc.c index 4794e08..00ca556 100644 --- a/malloc.c +++ b/malloc.c @@ -237,8 +237,14 @@ static union overhead *nextf[NBUCKETS]; #ifdef USE_PERL_SBRK #define sbrk(a) Perl_sbrk(a) char * Perl_sbrk _((int size)); +#else +#ifdef DONT_DECLARE_STD +#ifdef I_UNISTD +#include +#endif #else -extern char *sbrk(); +extern char *sbrk(int); +#endif #endif #ifdef DEBUGGING_MSTATS @@ -255,8 +261,7 @@ static u_int start_slack; #ifdef DEBUGGING #define ASSERT(p) if (!(p)) botch(STRINGIFY(p)); else static void -botch(s) - char *s; +botch(char *s) { PerlIO_printf(PerlIO_stderr(), "assertion botched: %s\n", s); abort(); @@ -266,8 +271,7 @@ botch(s) #endif Malloc_t -malloc(nbytes) - register MEM_SIZE nbytes; +malloc(register size_t nbytes) { register union overhead *p; register int bucket = 0; @@ -368,8 +372,7 @@ malloc(nbytes) * Allocate more memory to the indicated bucket. */ static void -morecore(bucket) - register int bucket; +morecore(register int bucket) { register union overhead *ovp; register int rnu; /* 2^rnu bytes will be requested */ @@ -481,8 +484,7 @@ morecore(bucket) } Free_t -free(mp) - Malloc_t mp; +free(void *mp) { register MEM_SIZE size; register union overhead *ovp; @@ -546,9 +548,7 @@ free(mp) int reall_srchlen = 4; /* 4 should be plenty, -1 =>'s whole list */ Malloc_t -realloc(mp, nbytes) - Malloc_t mp; - MEM_SIZE nbytes; +realloc(void *mp, size_t nbytes) { register MEM_SIZE onb; union overhead *ovp; @@ -672,9 +672,7 @@ realloc(mp, nbytes) * Return bucket number, or -1 if not found. */ static int -findbucket(freep, srchlen) - union overhead *freep; - int srchlen; +findbucket(union overhead *freep, int srchlen) { register union overhead *p; register int i, j; @@ -691,9 +689,7 @@ findbucket(freep, srchlen) } Malloc_t -calloc(elements, size) - register MEM_SIZE elements; - register MEM_SIZE size; +calloc(register size_t elements, register size_t size) { long sz = elements * size; Malloc_t p = malloc(sz); @@ -713,8 +709,7 @@ calloc(elements, size) * frees for each size category. */ void -dump_mstats(s) - char *s; +dump_mstats(char *s) { register int i, j; register union overhead *p; @@ -746,8 +741,7 @@ dump_mstats(s) } #else void -dump_mstats(s) - char *s; +dump_mstats(char *s) { } #endif diff --git a/mg.c b/mg.c index 7f49f68..ea46b68 100644 --- a/mg.c +++ b/mg.c @@ -39,9 +39,7 @@ typedef struct magic_state MGS; static void restore_magic _((void *p)); static void -save_magic(mgs, sv) -MGS* mgs; -SV* sv; +save_magic(MGS *mgs, SV *sv) { assert(SvMAGICAL(sv)); @@ -55,8 +53,7 @@ SV* sv; } static void -restore_magic(p) -void* p; +restore_magic(void *p) { MGS* mgs = (MGS*)p; SV* sv = mgs->mgs_sv; @@ -74,8 +71,7 @@ void* p; void -mg_magical(sv) -SV* sv; +mg_magical(SV *sv) { MAGIC* mg; for (mg = SvMAGIC(sv); mg; mg = mg->mg_moremagic) { @@ -92,8 +88,7 @@ SV* sv; } int -mg_get(sv) -SV* sv; +mg_get(SV *sv) { MGS mgs; MAGIC* mg; @@ -127,8 +122,7 @@ SV* sv; } int -mg_set(sv) -SV* sv; +mg_set(SV *sv) { MGS mgs; MAGIC* mg; @@ -153,8 +147,7 @@ SV* sv; } U32 -mg_len(sv) -SV* sv; +mg_len(SV *sv) { MAGIC* mg; char *junk; @@ -179,8 +172,7 @@ SV* sv; } int -mg_clear(sv) -SV* sv; +mg_clear(SV *sv) { MGS mgs; MAGIC* mg; @@ -201,9 +193,7 @@ SV* sv; } MAGIC* -mg_find(sv, type) -SV* sv; -int type; +mg_find(SV *sv, int type) { MAGIC* mg; for (mg = SvMAGIC(sv); mg; mg = mg->mg_moremagic) { @@ -214,11 +204,7 @@ int type; } int -mg_copy(sv, nsv, key, klen) -SV* sv; -SV* nsv; -char *key; -I32 klen; +mg_copy(SV *sv, SV *nsv, char *key, I32 klen) { int count = 0; MAGIC* mg; @@ -232,8 +218,7 @@ I32 klen; } int -mg_free(sv) -SV* sv; +mg_free(SV *sv) { MAGIC* mg; MAGIC* moremagic; @@ -260,9 +245,7 @@ SV* sv; #endif U32 -magic_len(sv, mg) -SV *sv; -MAGIC *mg; +magic_len(SV *sv, MAGIC *mg) { register I32 paren; register char *s; @@ -325,9 +308,7 @@ MAGIC *mg; } int -magic_get(sv, mg) -SV *sv; -MAGIC *mg; +magic_get(SV *sv, MAGIC *mg) { register I32 paren; register char *s; @@ -577,9 +558,7 @@ MAGIC *mg; } int -magic_getuvar(sv, mg) -SV *sv; -MAGIC *mg; +magic_getuvar(SV *sv, MAGIC *mg) { struct ufuncs *uf = (struct ufuncs *)mg->mg_ptr; @@ -589,9 +568,7 @@ MAGIC *mg; } int -magic_setenv(sv,mg) -SV* sv; -MAGIC* mg; +magic_setenv(SV *sv, MAGIC *mg) { register char *s; char *ptr; @@ -667,18 +644,14 @@ MAGIC* mg; } int -magic_clearenv(sv,mg) -SV* sv; -MAGIC* mg; +magic_clearenv(SV *sv, MAGIC *mg) { my_setenv(MgPV(mg,na),Nullch); return 0; } int -magic_set_all_env(sv,mg) -SV* sv; -MAGIC* mg; +magic_set_all_env(SV *sv, MAGIC *mg) { #if defined(VMS) die("Can't make list assignment to %%ENV on this system"); @@ -699,9 +672,7 @@ MAGIC* mg; } int -magic_clear_all_env(sv,mg) -SV* sv; -MAGIC* mg; +magic_clear_all_env(SV *sv, MAGIC *mg) { #if defined(VMS) die("Can't make list assignment to %%ENV on this system"); @@ -738,9 +709,7 @@ MAGIC* mg; } int -magic_getsig(sv,mg) -SV* sv; -MAGIC* mg; +magic_getsig(SV *sv, MAGIC *mg) { I32 i; /* Are we fetching a signal entry? */ @@ -764,9 +733,7 @@ MAGIC* mg; return 0; } int -magic_clearsig(sv,mg) -SV* sv; -MAGIC* mg; +magic_clearsig(SV *sv, MAGIC *mg) { I32 i; /* Are we clearing a signal entry? */ @@ -785,9 +752,7 @@ MAGIC* mg; } int -magic_setsig(sv,mg) -SV* sv; -MAGIC* mg; +magic_setsig(SV *sv, MAGIC *mg) { dTHR; register char *s; @@ -861,9 +826,7 @@ MAGIC* mg; } int -magic_setisa(sv,mg) -SV* sv; -MAGIC* mg; +magic_setisa(SV *sv, MAGIC *mg) { sub_generation++; return 0; @@ -872,9 +835,7 @@ MAGIC* mg; #ifdef OVERLOAD int -magic_setamagic(sv,mg) -SV* sv; -MAGIC* mg; +magic_setamagic(SV *sv, MAGIC *mg) { /* HV_badAMAGIC_on(Sv_STASH(sv)); */ amagic_generation++; @@ -884,9 +845,7 @@ MAGIC* mg; #endif /* OVERLOAD */ int -magic_setnkeys(sv,mg) -SV* sv; -MAGIC* mg; +magic_setnkeys(SV *sv, MAGIC *mg) { if (LvTARG(sv)) { hv_ksplit((HV*)LvTARG(sv), SvIV(sv)); @@ -896,10 +855,7 @@ MAGIC* mg; } static int -magic_methpack(sv,mg,meth) -SV* sv; -MAGIC* mg; -char *meth; +magic_methpack(SV *sv, MAGIC *mg, char *meth) { dTHR; dSP; @@ -928,9 +884,7 @@ char *meth; } int -magic_getpack(sv,mg) -SV* sv; -MAGIC* mg; +magic_getpack(SV *sv, MAGIC *mg) { magic_methpack(sv,mg,"FETCH"); if (mg->mg_ptr) @@ -939,9 +893,7 @@ MAGIC* mg; } int -magic_setpack(sv,mg) -SV* sv; -MAGIC* mg; +magic_setpack(SV *sv, MAGIC *mg) { dTHR; dSP; @@ -966,16 +918,12 @@ MAGIC* mg; } int -magic_clearpack(sv,mg) -SV* sv; -MAGIC* mg; +magic_clearpack(SV *sv, MAGIC *mg) { return magic_methpack(sv,mg,"DELETE"); } -int magic_wipepack(sv,mg) -SV* sv; -MAGIC* mg; +int magic_wipepack(SV *sv, MAGIC *mg) { dTHR; dSP; @@ -990,10 +938,7 @@ MAGIC* mg; } int -magic_nextpack(sv,mg,key) -SV* sv; -MAGIC* mg; -SV* key; +magic_nextpack(SV *sv, MAGIC *mg, SV *key) { dTHR; dSP; @@ -1017,17 +962,13 @@ SV* key; } int -magic_existspack(sv,mg) -SV* sv; -MAGIC* mg; +magic_existspack(SV *sv, MAGIC *mg) { return magic_methpack(sv,mg,"EXISTS"); } int -magic_setdbline(sv,mg) -SV* sv; -MAGIC* mg; +magic_setdbline(SV *sv, MAGIC *mg) { dTHR; OP *o; @@ -1047,9 +988,7 @@ MAGIC* mg; } int -magic_getarylen(sv,mg) -SV* sv; -MAGIC* mg; +magic_getarylen(SV *sv, MAGIC *mg) { dTHR; sv_setiv(sv, AvFILL((AV*)mg->mg_obj) + curcop->cop_arybase); @@ -1057,9 +996,7 @@ MAGIC* mg; } int -magic_setarylen(sv,mg) -SV* sv; -MAGIC* mg; +magic_setarylen(SV *sv, MAGIC *mg) { dTHR; av_fill((AV*)mg->mg_obj, SvIV(sv) - curcop->cop_arybase); @@ -1067,9 +1004,7 @@ MAGIC* mg; } int -magic_getpos(sv,mg) -SV* sv; -MAGIC* mg; +magic_getpos(SV *sv, MAGIC *mg) { SV* lsv = LvTARG(sv); @@ -1086,9 +1021,7 @@ MAGIC* mg; } int -magic_setpos(sv,mg) -SV* sv; -MAGIC* mg; +magic_setpos(SV *sv, MAGIC *mg) { SV* lsv = LvTARG(sv); SSize_t pos; @@ -1125,9 +1058,7 @@ MAGIC* mg; } int -magic_getglob(sv,mg) -SV* sv; -MAGIC* mg; +magic_getglob(SV *sv, MAGIC *mg) { if (SvFAKE(sv)) { /* FAKE globs can get coerced */ SvFAKE_off(sv); @@ -1140,9 +1071,7 @@ MAGIC* mg; } int -magic_setglob(sv,mg) -SV* sv; -MAGIC* mg; +magic_setglob(SV *sv, MAGIC *mg) { register char *s; GV* gv; @@ -1162,9 +1091,7 @@ MAGIC* mg; } int -magic_setsubstr(sv,mg) -SV* sv; -MAGIC* mg; +magic_setsubstr(SV *sv, MAGIC *mg) { STRLEN len; char *tmps = SvPV(sv,len); @@ -1173,9 +1100,7 @@ MAGIC* mg; } int -magic_gettaint(sv,mg) -SV* sv; -MAGIC* mg; +magic_gettaint(SV *sv, MAGIC *mg) { TAINT_IF((mg->mg_len & 1) || (mg->mg_len & 2) && mg->mg_obj == sv); /* kludge */ @@ -1183,9 +1108,7 @@ MAGIC* mg; } int -magic_settaint(sv,mg) -SV* sv; -MAGIC* mg; +magic_settaint(SV *sv, MAGIC *mg) { dTHR; if (localizing) { @@ -1202,18 +1125,14 @@ MAGIC* mg; } int -magic_setvec(sv,mg) -SV* sv; -MAGIC* mg; +magic_setvec(SV *sv, MAGIC *mg) { do_vecset(sv); /* XXX slurp this routine */ return 0; } int -magic_getdefelem(sv,mg) -SV* sv; -MAGIC* mg; +magic_getdefelem(SV *sv, MAGIC *mg) { SV *targ = Nullsv; if (LvTARGLEN(sv)) { @@ -1246,9 +1165,7 @@ MAGIC* mg; } int -magic_setdefelem(sv,mg) -SV* sv; -MAGIC* mg; +magic_setdefelem(SV *sv, MAGIC *mg) { if (LvTARGLEN(sv)) vivify_defelem(sv); @@ -1260,17 +1177,14 @@ MAGIC* mg; } int -magic_freedefelem(sv,mg) -SV* sv; -MAGIC* mg; +magic_freedefelem(SV *sv, MAGIC *mg) { SvREFCNT_dec(LvTARG(sv)); return 0; } void -vivify_defelem(sv) -SV* sv; +vivify_defelem(SV *sv) { dTHR; /* just for SvREFCNT_inc and SvREFCNT_dec*/ MAGIC* mg; @@ -1304,9 +1218,7 @@ SV* sv; } int -magic_setmglob(sv,mg) -SV* sv; -MAGIC* mg; +magic_setmglob(SV *sv, MAGIC *mg) { mg->mg_len = -1; SvSCREAM_off(sv); @@ -1314,9 +1226,7 @@ MAGIC* mg; } int -magic_setbm(sv,mg) -SV* sv; -MAGIC* mg; +magic_setbm(SV *sv, MAGIC *mg) { sv_unmagic(sv, 'B'); SvVALID_off(sv); @@ -1324,9 +1234,7 @@ MAGIC* mg; } int -magic_setfm(sv,mg) -SV* sv; -MAGIC* mg; +magic_setfm(SV *sv, MAGIC *mg) { sv_unmagic(sv, 'f'); SvCOMPILED_off(sv); @@ -1334,9 +1242,7 @@ MAGIC* mg; } int -magic_setuvar(sv,mg) -SV* sv; -MAGIC* mg; +magic_setuvar(SV *sv, MAGIC *mg) { struct ufuncs *uf = (struct ufuncs *)mg->mg_ptr; @@ -1347,9 +1253,7 @@ MAGIC* mg; #ifdef USE_LOCALE_COLLATE int -magic_setcollxfrm(sv,mg) -SV* sv; -MAGIC* mg; +magic_setcollxfrm(SV *sv, MAGIC *mg) { /* * RenĂ© Descartes said "I think not." @@ -1365,9 +1269,7 @@ MAGIC* mg; #endif /* USE_LOCALE_COLLATE */ int -magic_set(sv,mg) -SV* sv; -MAGIC* mg; +magic_set(SV *sv, MAGIC *mg) { dTHR; register char *s; @@ -1712,9 +1614,7 @@ MAGIC* mg; #ifdef USE_THREADS int -magic_mutexfree(sv, mg) -SV *sv; -MAGIC *mg; +magic_mutexfree(SV *sv, MAGIC *mg) { dTHR; DEBUG_L(PerlIO_printf(PerlIO_stderr(), "0x%lx: magic_mutexfree 0x%lx\n", @@ -1729,8 +1629,7 @@ MAGIC *mg; #endif /* USE_THREADS */ I32 -whichsig(sig) -char *sig; +whichsig(char *sig) { register char **sigv; @@ -1751,8 +1650,7 @@ char *sig; static SV* sig_sv; static void -unwind_handler_stack(p) - void *p; +unwind_handler_stack(void *p) { dTHR; U32 flags = *(U32*)p; @@ -1765,8 +1663,7 @@ unwind_handler_stack(p) } Signal_t -sighandler(sig) -int sig; +sighandler(int sig) { dTHR; dSP; diff --git a/miniperlmain.c b/miniperlmain.c index 402f2ef..a55a855 100644 --- a/miniperlmain.c +++ b/miniperlmain.c @@ -65,7 +65,7 @@ char **env; /* Do not delete this line--writemain depends on it */ static void -xs_init() +xs_init(void) { dXSUB_SYS; } diff --git a/op.c b/op.c index e7d843d..a0309de 100644 --- a/op.c +++ b/op.c @@ -42,8 +42,7 @@ static PADOFFSET pad_findlex _((char* name, PADOFFSET newoff, U32 seq, CV* startcv, I32 cx_ix)); static char* -gv_ename(gv) -GV* gv; +gv_ename(GV *gv) { SV* tmpsv = sv_newmortal(); gv_efullname3(tmpsv, gv, Nullch); @@ -51,8 +50,7 @@ GV* gv; } static OP * -no_fh_allowed(o) -OP *o; +no_fh_allowed(OP *o) { yyerror(form("Missing comma after first argument to %s function", op_desc[o->op_type])); @@ -60,37 +58,28 @@ OP *o; } static OP * -too_few_arguments(o, name) -OP* o; -char* name; +too_few_arguments(OP *o, char *name) { yyerror(form("Not enough arguments for %s", name)); return o; } static OP * -too_many_arguments(o, name) -OP *o; -char* name; +too_many_arguments(OP *o, char *name) { yyerror(form("Too many arguments for %s", name)); return o; } static void -bad_type(n, t, name, kid) -I32 n; -char *t; -char *name; -OP *kid; +bad_type(I32 n, char *t, char *name, OP *kid) { yyerror(form("Type of arg %d to %s must be %s (not %s)", (int)n, name, t, op_desc[kid->op_type])); } void -assertref(o) -OP *o; +assertref(OP *o) { int type = o->op_type; if (type != OP_AELEM && type != OP_HELEM) { @@ -104,8 +93,7 @@ OP *o; /* "register" allocation */ PADOFFSET -pad_allocmy(name) -char *name; +pad_allocmy(char *name) { dTHR; PADOFFSET off; @@ -295,8 +283,7 @@ pad_findlex(char *name, PADOFFSET newoff, U32 seq, CV* startcv, I32 cx_ix) } PADOFFSET -pad_findmy(name) -char *name; +pad_findmy(char *name) { dTHR; I32 off; @@ -345,8 +332,7 @@ char *name; } void -pad_leavemy(fill) -I32 fill; +pad_leavemy(I32 fill) { I32 off; SV **svp = AvARRAY(comppad_name); @@ -365,9 +351,7 @@ I32 fill; } PADOFFSET -pad_alloc(optype,tmptype) -I32 optype; -U32 tmptype; +pad_alloc(I32 optype, U32 tmptype) { dTHR; SV *sv; @@ -488,7 +472,7 @@ pad_swipe(PADOFFSET po) } void -pad_reset() +pad_reset(void) { dTHR; register I32 po; @@ -514,8 +498,7 @@ pad_reset() /* Destructor */ void -op_free(o) -OP *o; +op_free(OP *o) { register OP *kid, *nextkid; @@ -580,8 +563,7 @@ OP *o; } static void -null(o) -OP* o; +null(OP *o) { if (o->op_type != OP_NULL && o->op_targ > 0) pad_free(o->op_targ); @@ -595,8 +577,7 @@ OP* o; #define LINKLIST(o) ((o)->op_next ? (o)->op_next : linklist((OP*)o)) OP * -linklist(o) -OP *o; +linklist(OP *o) { register OP *kid; @@ -620,8 +601,7 @@ OP *o; } OP * -scalarkids(o) -OP *o; +scalarkids(OP *o) { OP *kid; if (o && o->op_flags & OPf_KIDS) { @@ -632,8 +612,7 @@ OP *o; } static OP * -scalarboolean(o) -OP *o; +scalarboolean(OP *o) { if (dowarn && o->op_type == OP_SASSIGN && cBINOPo->op_first->op_type == OP_CONST) { @@ -649,8 +628,7 @@ OP *o; } OP * -scalar(o) -OP *o; +scalar(OP *o) { OP *kid; @@ -716,8 +694,7 @@ OP *o; } OP * -scalarvoid(o) -OP *o; +scalarvoid(OP *o) { OP *kid; char* useless = 0; @@ -900,8 +877,7 @@ OP *o; } OP * -listkids(o) -OP *o; +listkids(OP *o) { OP *kid; if (o && o->op_flags & OPf_KIDS) { @@ -912,8 +888,7 @@ OP *o; } OP * -list(o) -OP *o; +list(OP *o) { OP *kid; @@ -979,8 +954,7 @@ OP *o; } OP * -scalarseq(o) -OP *o; +scalarseq(OP *o) { OP *kid; @@ -1008,9 +982,7 @@ OP *o; } static OP * -modkids(o, type) -OP *o; -I32 type; +modkids(OP *o, I32 type) { OP *kid; if (o && o->op_flags & OPf_KIDS) { @@ -1023,9 +995,7 @@ I32 type; static I32 modcount; OP * -mod(o, type) -OP *o; -I32 type; +mod(OP *o, I32 type) { dTHR; OP *kid; @@ -1218,9 +1188,7 @@ I32 type; } static bool -scalar_mod_type(o, type) -OP *o; -I32 type; +scalar_mod_type(OP *o, I32 type) { switch (type) { case OP_SASSIGN: @@ -1264,9 +1232,7 @@ I32 type; } OP * -refkids(o, type) -OP *o; -I32 type; +refkids(OP *o, I32 type) { OP *kid; if (o && o->op_flags & OPf_KIDS) { @@ -1277,9 +1243,7 @@ I32 type; } OP * -ref(o, type) -OP *o; -I32 type; +ref(OP *o, I32 type) { OP *kid; @@ -1360,8 +1324,7 @@ I32 type; } OP * -my(o) -OP *o; +my(OP *o) { OP *kid; I32 type; @@ -1388,8 +1351,7 @@ OP *o; } OP * -sawparens(o) -OP *o; +sawparens(OP *o) { if (o) o->op_flags |= OPf_PARENS; @@ -1397,10 +1359,7 @@ OP *o; } OP * -bind_match(type, left, right) -I32 type; -OP *left; -OP *right; +bind_match(I32 type, OP *left, OP *right) { OP *o; @@ -1438,8 +1397,7 @@ OP *right; } OP * -invert(o) -OP *o; +invert(OP *o) { if (!o) return o; @@ -1448,8 +1406,7 @@ OP *o; } OP * -scope(o) -OP *o; +scope(OP *o) { if (o) { if (o->op_flags & OPf_PARENS || PERLDB_NOOPT || tainting) { @@ -1476,8 +1433,7 @@ OP *o; } int -block_start(full) -int full; +block_start(int full) { dTHR; int retval = savestack_ix; @@ -1501,9 +1457,7 @@ int full; } OP* -block_end(floor, seq) -I32 floor; -OP* seq; +block_end(I32 floor, OP *seq) { dTHR; int needblockscope = hints & HINT_BLOCK_SCOPE; @@ -1518,8 +1472,7 @@ OP* seq; } void -newPROG(o) -OP *o; +newPROG(OP *o) { dTHR; if (in_eval) { @@ -1553,9 +1506,7 @@ OP *o; } OP * -localize(o, lex) -OP *o; -I32 lex; +localize(OP *o, I32 lex) { if (o->op_flags & OPf_PARENS) list(o); @@ -1577,8 +1528,7 @@ I32 lex; } OP * -jmaybe(o) -OP *o; +jmaybe(OP *o) { if (o->op_type == OP_LIST) { o = convert(OP_JOIN, 0, @@ -1590,8 +1540,7 @@ OP *o; } OP * -fold_constants(o) -register OP *o; +fold_constants(register OP *o) { dTHR; register OP *curop; @@ -1684,8 +1633,7 @@ register OP *o; } OP * -gen_constant_list(o) -register OP *o; +gen_constant_list(register OP *o) { dTHR; register OP *curop; @@ -1713,10 +1661,7 @@ register OP *o; } OP * -convert(type, flags, o) -I32 type; -I32 flags; -OP* o; +convert(I32 type, I32 flags, OP *o) { OP *kid; OP *last = 0; @@ -1750,10 +1695,7 @@ OP* o; /* List constructors */ OP * -append_elem(type, first, last) -I32 type; -OP* first; -OP* last; +append_elem(I32 type, OP *first, OP *last) { if (!first) return last; @@ -1776,10 +1718,7 @@ OP* last; } OP * -append_list(type, first, last) -I32 type; -LISTOP* first; -LISTOP* last; +append_list(I32 type, LISTOP *first, LISTOP *last) { if (!first) return (OP*)last; @@ -1804,10 +1743,7 @@ LISTOP* last; } OP * -prepend_elem(type, first, last) -I32 type; -OP* first; -OP* last; +prepend_elem(I32 type, OP *first, OP *last) { if (!first) return last; @@ -1838,14 +1774,13 @@ OP* last; /* Constructors */ OP * -newNULLLIST() +newNULLLIST(void) { return newOP(OP_STUB, 0); } OP * -force_list(o) -OP *o; +force_list(OP *o) { if (!o || o->op_type != OP_LIST) o = newLISTOP(OP_LIST, 0, o, Nullop); @@ -1854,11 +1789,7 @@ OP *o; } OP * -newLISTOP(type, flags, first, last) -I32 type; -I32 flags; -OP* first; -OP* last; +newLISTOP(I32 type, I32 flags, OP *first, OP *last) { LISTOP *listop; @@ -1893,9 +1824,7 @@ OP* last; } OP * -newOP(type, flags) -I32 type; -I32 flags; +newOP(I32 type, I32 flags) { OP *o; Newz(1101, o, 1, OP); @@ -1913,10 +1842,7 @@ I32 flags; } OP * -newUNOP(type, flags, first) -I32 type; -I32 flags; -OP* first; +newUNOP(I32 type, I32 flags, OP *first) { UNOP *unop; @@ -1940,11 +1866,7 @@ OP* first; } OP * -newBINOP(type, flags, first, last) -I32 type; -I32 flags; -OP* first; -OP* last; +newBINOP(I32 type, I32 flags, OP *first, OP *last) { BINOP *binop; Newz(1101, binop, 1, BINOP); @@ -1975,10 +1897,7 @@ OP* last; } OP * -pmtrans(o, expr, repl) -OP *o; -OP *expr; -OP *repl; +pmtrans(OP *o, OP *expr, OP *repl) { SV *tstr = ((SVOP*)expr)->op_sv; SV *rstr = ((SVOP*)repl)->op_sv; @@ -1988,13 +1907,13 @@ OP *repl; register U8 *r = (U8*)SvPV(rstr, rlen); register I32 i; register I32 j; - I32 delete; + I32 Delete; I32 complement; register short *tbl; tbl = (short*)cPVOPo->op_pv; complement = o->op_private & OPpTRANS_COMPLEMENT; - delete = o->op_private & OPpTRANS_DELETE; + Delete = o->op_private & OPpTRANS_DELETE; /* squash = o->op_private & OPpTRANS_SQUASH; */ if (complement) { @@ -2004,7 +1923,7 @@ OP *repl; for (i = 0, j = 0; i < 256; i++) { if (!tbl[i]) { if (j >= rlen) { - if (delete) + if (Delete) tbl[i] = -2; else if (rlen) tbl[i] = r[j-1]; @@ -2017,14 +1936,14 @@ OP *repl; } } else { - if (!rlen && !delete) { + if (!rlen && !Delete) { r = t; rlen = tlen; } for (i = 0; i < 256; i++) tbl[i] = -1; for (i = 0, j = 0; i < tlen; i++,j++) { if (j >= rlen) { - if (delete) { + if (Delete) { if (tbl[t[i]] == -1) tbl[t[i]] = -2; continue; @@ -2042,9 +1961,7 @@ OP *repl; } OP * -newPMOP(type, flags) -I32 type; -I32 flags; +newPMOP(I32 type, I32 flags) { dTHR; PMOP *pmop; @@ -2068,10 +1985,7 @@ I32 flags; } OP * -pmruntime(o, expr, repl) -OP *o; -OP *expr; -OP *repl; +pmruntime(OP *o, OP *expr, OP *repl) { PMOP *pm; LOGOP *rcop; @@ -2187,10 +2101,7 @@ OP *repl; } OP * -newSVOP(type, flags, sv) -I32 type; -I32 flags; -SV *sv; +newSVOP(I32 type, I32 flags, SV *sv) { SVOP *svop; Newz(1101, svop, 1, SVOP); @@ -2207,10 +2118,7 @@ SV *sv; } OP * -newGVOP(type, flags, gv) -I32 type; -I32 flags; -GV *gv; +newGVOP(I32 type, I32 flags, GV *gv) { dTHR; GVOP *gvop; @@ -2228,10 +2136,7 @@ GV *gv; } OP * -newPVOP(type, flags, pv) -I32 type; -I32 flags; -char *pv; +newPVOP(I32 type, I32 flags, char *pv) { PVOP *pvop; Newz(1101, pvop, 1, PVOP); @@ -2248,8 +2153,7 @@ char *pv; } void -package(o) -OP *o; +package(OP *o) { dTHR; SV *sv; @@ -2274,12 +2178,7 @@ OP *o; } void -utilize(aver, floor, version, id, arg) -int aver; -I32 floor; -OP *version; -OP *id; -OP *arg; +utilize(int aver, I32 floor, OP *version, OP *id, OP *arg) { OP *pack; OP *meth; @@ -2355,10 +2254,7 @@ OP *arg; } OP * -newSLICEOP(flags, subscript, listval) -I32 flags; -OP *subscript; -OP *listval; +newSLICEOP(I32 flags, OP *subscript, OP *listval) { return newBINOP(OP_LSLICE, flags, list(force_list(subscript)), @@ -2366,8 +2262,7 @@ OP *listval; } static I32 -list_assignment(o) -register OP *o; +list_assignment(register OP *o) { if (!o) return TRUE; @@ -2401,11 +2296,7 @@ register OP *o; } OP * -newASSIGNOP(flags, left, optype, right) -I32 flags; -OP *left; -I32 optype; -OP *right; +newASSIGNOP(I32 flags, OP *left, I32 optype, OP *right) { OP *o; @@ -2534,10 +2425,7 @@ OP *right; } OP * -newSTATEOP(flags, label, o) -I32 flags; -char *label; -OP *o; +newSTATEOP(I32 flags, char *label, OP *o) { dTHR; U32 seq = intro_my(); @@ -2589,7 +2477,7 @@ OP *o; /* "Introduce" my variables to visible status. */ U32 -intro_my() +intro_my(void) { SV **svp; SV *sv; @@ -2611,11 +2499,7 @@ intro_my() } OP * -newLOGOP(type, flags, first, other) -I32 type; -I32 flags; -OP* first; -OP* other; +newLOGOP(I32 type, I32 flags, OP *first, OP *other) { dTHR; LOGOP *logop; @@ -2716,11 +2600,7 @@ OP* other; } OP * -newCONDOP(flags, first, trueop, falseop) -I32 flags; -OP* first; -OP* trueop; -OP* falseop; +newCONDOP(I32 flags, OP *first, OP *trueop, OP *falseop) { dTHR; CONDOP *condop; @@ -2773,10 +2653,7 @@ OP* falseop; } OP * -newRANGE(flags, left, right) -I32 flags; -OP *left; -OP *right; +newRANGE(I32 flags, OP *left, OP *right) { dTHR; CONDOP *condop; @@ -2821,11 +2698,7 @@ OP *right; } OP * -newLOOPOP(flags, debuggable, expr, block) -I32 flags; -I32 debuggable; -OP *expr; -OP *block; +newLOOPOP(I32 flags, I32 debuggable, OP *expr, OP *block) { dTHR; OP* listop; @@ -2861,14 +2734,7 @@ OP *block; } OP * -newWHILEOP(flags, debuggable, loop, whileline, expr, block, cont) -I32 flags; -I32 debuggable; -LOOP *loop; -I32 whileline; -OP *expr; -OP *block; -OP *cont; +newWHILEOP(I32 flags, I32 debuggable, LOOP *loop, I32 whileline, OP *expr, OP *block, OP *cont) { dTHR; OP *redo; @@ -2989,9 +2855,7 @@ newFOROP(I32 flags,char *label,line_t forline,OP *sv,OP *expr,OP *block,OP *cont } OP* -newLOOPEX(type, label) -I32 type; -OP* label; +newLOOPEX(I32 type, OP *label) { dTHR; OP *o; @@ -3012,8 +2876,7 @@ OP* label; } void -cv_undef(cv) -CV *cv; +cv_undef(CV *cv) { dTHR; #ifdef USE_THREADS @@ -3118,9 +2981,7 @@ CV* cv; #endif /* DEBUG_CLOSURES */ static CV * -cv_clone2(proto, outside) -CV* proto; -CV* outside; +cv_clone2(CV *proto, CV *outside) { dTHR; AV* av; @@ -3252,17 +3113,13 @@ CV* outside; } CV * -cv_clone(proto) -CV* proto; +cv_clone(CV *proto) { return cv_clone2(proto, CvOUTSIDE(proto)); } void -cv_ckproto(cv, gv, p) -CV* cv; -GV* gv; -char* p; +cv_ckproto(CV *cv, GV *gv, char *p) { if ((!p != !SvPOK(cv)) || (p && strNE(p, SvPVX(cv)))) { SV* msg = sv_newmortal(); @@ -3285,8 +3142,7 @@ char* p; } SV * -cv_const_sv(cv) -CV* cv; +cv_const_sv(CV *cv) { OP *o; SV *sv; @@ -3321,11 +3177,7 @@ CV* cv; } CV * -newSUB(floor,o,proto,block) -I32 floor; -OP *o; -OP *proto; -OP *block; +newSUB(I32 floor, OP *o, OP *proto, OP *block) { dTHR; char *name = o ? SvPVx(cSVOPo->op_sv, na) : Nullch; @@ -3554,10 +3406,7 @@ char *filename; #endif CV * -newXS(name, subaddr, filename) -char *name; -void (*subaddr) _((CV*)); -char *filename; +newXS(char *name, void (*subaddr) (CV *), char *filename) { dTHR; GV *gv = gv_fetchpv(name ? name : "__ANON__", GV_ADDMULTI, SVt_PVCV); @@ -3634,10 +3483,7 @@ char *filename; } void -newFORM(floor,o,block) -I32 floor; -OP *o; -OP *block; +newFORM(I32 floor, OP *o, OP *block) { dTHR; register CV *cv; @@ -3681,34 +3527,28 @@ OP *block; } OP * -newANONLIST(o) -OP* o; +newANONLIST(OP *o) { return newUNOP(OP_REFGEN, 0, mod(list(convert(OP_ANONLIST, 0, o)), OP_REFGEN)); } OP * -newANONHASH(o) -OP* o; +newANONHASH(OP *o) { return newUNOP(OP_REFGEN, 0, mod(list(convert(OP_ANONHASH, 0, o)), OP_REFGEN)); } OP * -newANONSUB(floor, proto, block) -I32 floor; -OP *proto; -OP *block; +newANONSUB(I32 floor, OP *proto, OP *block) { return newUNOP(OP_REFGEN, 0, newSVOP(OP_ANONCODE, 0, (SV*)newSUB(floor, 0, proto, block))); } OP * -oopsAV(o) -OP *o; +oopsAV(OP *o) { switch (o->op_type) { case OP_PADSV: @@ -3730,8 +3570,7 @@ OP *o; } OP * -oopsHV(o) -OP *o; +oopsHV(OP *o) { switch (o->op_type) { case OP_PADSV: @@ -3755,8 +3594,7 @@ OP *o; } OP * -newAVREF(o) -OP *o; +newAVREF(OP *o) { if (o->op_type == OP_PADANY) { o->op_type = OP_PADAV; @@ -3767,9 +3605,7 @@ OP *o; } OP * -newGVREF(type,o) -I32 type; -OP *o; +newGVREF(I32 type, OP *o) { if (type == OP_MAPSTART) return newUNOP(OP_NULL, 0, o); @@ -3777,8 +3613,7 @@ OP *o; } OP * -newHVREF(o) -OP *o; +newHVREF(OP *o) { if (o->op_type == OP_PADANY) { o->op_type = OP_PADHV; @@ -3789,8 +3624,7 @@ OP *o; } OP * -oopsCV(o) -OP *o; +oopsCV(OP *o) { croak("NOT IMPL LINE %d",__LINE__); /* STUB */ @@ -3798,16 +3632,13 @@ OP *o; } OP * -newCVREF(flags, o) -I32 flags; -OP *o; +newCVREF(I32 flags, OP *o) { return newUNOP(OP_RV2CV, flags, scalar(o)); } OP * -newSVREF(o) -OP *o; +newSVREF(OP *o) { if (o->op_type == OP_PADANY) { o->op_type = OP_PADSV; @@ -3820,8 +3651,7 @@ OP *o; /* Check routines. */ OP * -ck_anoncode(o) -OP *o; +ck_anoncode(OP *o) { PADOFFSET ix; SV* name; @@ -3841,16 +3671,14 @@ OP *o; } OP * -ck_bitop(o) -OP *o; +ck_bitop(OP *o) { o->op_private = hints; return o; } OP * -ck_concat(o) -OP *o; +ck_concat(OP *o) { if (cUNOPo->op_first->op_type == OP_CONCAT) o->op_flags |= OPf_STACKED; @@ -3858,8 +3686,7 @@ OP *o; } OP * -ck_spair(o) -OP *o; +ck_spair(OP *o) { if (o->op_flags & OPf_KIDS) { OP* newop; @@ -3884,8 +3711,7 @@ OP *o; } OP * -ck_delete(o) -OP *o; +ck_delete(OP *o) { o = ck_fun(o); o->op_private = 0; @@ -3902,8 +3728,7 @@ OP *o; } OP * -ck_eof(o) -OP *o; +ck_eof(OP *o) { I32 type = o->op_type; @@ -3919,8 +3744,7 @@ OP *o; } OP * -ck_eval(o) -OP *o; +ck_eval(OP *o) { hints |= HINT_BLOCK_SCOPE; if (o->op_flags & OPf_KIDS) { @@ -3961,8 +3785,7 @@ OP *o; } OP * -ck_exec(o) -OP *o; +ck_exec(OP *o) { OP *kid; if (o->op_flags & OPf_STACKED) { @@ -3977,8 +3800,7 @@ OP *o; } OP * -ck_exists(o) -OP *o; +ck_exists(OP *o) { o = ck_fun(o); if (o->op_flags & OPf_KIDS) { @@ -3991,8 +3813,7 @@ OP *o; } OP * -ck_gvconst(o) -register OP *o; +ck_gvconst(register OP *o) { o = fold_constants(o); if (o->op_type == OP_CONST) @@ -4001,8 +3822,7 @@ register OP *o; } OP * -ck_rvconst(o) -register OP *o; +ck_rvconst(register OP *o) { dTHR; SVOP *kid = (SVOP*)cUNOPo->op_first; @@ -4062,8 +3882,7 @@ register OP *o; } OP * -ck_ftst(o) -OP *o; +ck_ftst(OP *o) { dTHR; I32 type = o->op_type; @@ -4093,8 +3912,7 @@ OP *o; } OP * -ck_fun(o) -OP *o; +ck_fun(OP *o) { dTHR; register OP *kid; @@ -4232,8 +4050,7 @@ OP *o; } OP * -ck_glob(o) -OP *o; +ck_glob(OP *o) { GV *gv; @@ -4268,8 +4085,7 @@ OP *o; } OP * -ck_grep(o) -OP *o; +ck_grep(OP *o) { LOGOP *gwop; OP *kid; @@ -4320,8 +4136,7 @@ OP *o; } OP * -ck_index(o) -OP *o; +ck_index(OP *o) { if (o->op_flags & OPf_KIDS) { OP *kid = cLISTOPo->op_first->op_sibling; /* get past pushmark */ @@ -4332,32 +4147,28 @@ OP *o; } OP * -ck_lengthconst(o) -OP *o; +ck_lengthconst(OP *o) { /* XXX length optimization goes here */ return ck_fun(o); } OP * -ck_lfun(o) -OP *o; +ck_lfun(OP *o) { OPCODE type = o->op_type; return modkids(ck_fun(o), type); } OP * -ck_rfun(o) -OP *o; +ck_rfun(OP *o) { OPCODE type = o->op_type; return refkids(ck_fun(o), type); } OP * -ck_listiob(o) -OP *o; +ck_listiob(OP *o) { register OP *kid; @@ -4395,8 +4206,7 @@ OP *o; } OP * -ck_fun_locale(o) -OP *o; +ck_fun_locale(OP *o) { o = ck_fun(o); @@ -4410,8 +4220,7 @@ OP *o; } OP * -ck_scmp(o) -OP *o; +ck_scmp(OP *o) { o->op_private = 0; #ifdef USE_LOCALE @@ -4423,23 +4232,20 @@ OP *o; } OP * -ck_match(o) -OP *o; +ck_match(OP *o) { o->op_private |= OPpRUNTIME; return o; } OP * -ck_null(o) -OP *o; +ck_null(OP *o) { return o; } OP * -ck_repeat(o) -OP *o; +ck_repeat(OP *o) { if (cBINOPo->op_first->op_flags & OPf_PARENS) { o->op_private |= OPpREPEAT_DOLIST; @@ -4451,8 +4257,7 @@ OP *o; } OP * -ck_require(o) -OP *o; +ck_require(OP *o) { if (o->op_flags & OPf_KIDS) { /* Shall we supply missing .pm? */ SVOP *kid = (SVOP*)cUNOPo->op_first; @@ -4473,8 +4278,7 @@ OP *o; } OP * -ck_retarget(o) -OP *o; +ck_retarget(OP *o) { croak("NOT IMPL LINE %d",__LINE__); /* STUB */ @@ -4482,8 +4286,7 @@ OP *o; } OP * -ck_select(o) -OP *o; +ck_select(OP *o) { OP* kid; if (o->op_flags & OPf_KIDS) { @@ -4503,8 +4306,7 @@ OP *o; } OP * -ck_shift(o) -OP *o; +ck_shift(OP *o) { I32 type = o->op_type; @@ -4533,8 +4335,7 @@ OP *o; } OP * -ck_sort(o) -OP *o; +ck_sort(OP *o) { o->op_private = 0; #ifdef USE_LOCALE @@ -4583,8 +4384,7 @@ OP *o; } OP * -ck_split(o) -OP *o; +ck_split(OP *o) { register OP *kid; PMOP* pm; @@ -4641,8 +4441,7 @@ OP *o; } OP * -ck_subr(o) -OP *o; +ck_subr(OP *o) { dTHR; OP *prev = ((cUNOPo->op_first->op_sibling) @@ -4767,16 +4566,14 @@ OP *o; } OP * -ck_svconst(o) -OP *o; +ck_svconst(OP *o) { SvREADONLY_on(cSVOPo->op_sv); return o; } OP * -ck_trunc(o) -OP *o; +ck_trunc(OP *o) { if (o->op_flags & OPf_KIDS) { SVOP *kid = (SVOP*)cUNOPo->op_first; @@ -4793,8 +4590,7 @@ OP *o; /* A peephole optimizer. We visit the ops in the order they're to execute. */ void -peep(o) -register OP* o; +peep(register OP *o) { dTHR; register OP* oldop = 0; diff --git a/perl.c b/perl.c index a1dd4e5..a7ff240 100644 --- a/perl.c +++ b/perl.c @@ -94,7 +94,7 @@ catch_sigsegv(int signo, struct sigcontext_struct sc) #endif PerlInterpreter * -perl_alloc() +perl_alloc(void) { PerlInterpreter *sv_interp; @@ -104,8 +104,7 @@ perl_alloc() } void -perl_construct( sv_interp ) -register PerlInterpreter *sv_interp; +perl_construct(register PerlInterpreter *sv_interp) { #if defined(USE_THREADS) && !defined(FAKE_THREADS) struct thread *thr; @@ -239,8 +238,7 @@ register PerlInterpreter *sv_interp; } void -perl_destruct(sv_interp) -register PerlInterpreter *sv_interp; +perl_destruct(register PerlInterpreter *sv_interp) { dTHR; int destruct_level; /* 0=none, 1=full, 2=full with checks */ @@ -598,8 +596,7 @@ register PerlInterpreter *sv_interp; } void -perl_free(sv_interp) -PerlInterpreter *sv_interp; +perl_free(PerlInterpreter *sv_interp) { if (!(curinterp = sv_interp)) return; @@ -607,12 +604,7 @@ PerlInterpreter *sv_interp; } int -perl_parse(sv_interp, xsinit, argc, argv, env) -PerlInterpreter *sv_interp; -void (*xsinit)_((void)); -int argc; -char **argv; -char **env; +perl_parse(PerlInterpreter *sv_interp, void (*xsinit) (void), int argc, char **argv, char **env) { dTHR; register SV *sv; @@ -1010,8 +1002,7 @@ print \" \\@INC:\\n @INC\\n\";"); } int -perl_run(sv_interp) -PerlInterpreter *sv_interp; +perl_run(PerlInterpreter *sv_interp) { dTHR; I32 oldscope; @@ -1096,9 +1087,7 @@ PerlInterpreter *sv_interp; } SV* -perl_get_sv(name, create) -char* name; -I32 create; +perl_get_sv(char *name, I32 create) { GV* gv = gv_fetchpv(name, create, SVt_PV); if (gv) @@ -1107,9 +1096,7 @@ I32 create; } AV* -perl_get_av(name, create) -char* name; -I32 create; +perl_get_av(char *name, I32 create) { GV* gv = gv_fetchpv(name, create, SVt_PVAV); if (create) @@ -1120,9 +1107,7 @@ I32 create; } HV* -perl_get_hv(name, create) -char* name; -I32 create; +perl_get_hv(char *name, I32 create) { GV* gv = gv_fetchpv(name, create, SVt_PVHV); if (create) @@ -1133,9 +1118,7 @@ I32 create; } CV* -perl_get_cv(name, create) -char* name; -I32 create; +perl_get_cv(char *name, I32 create) { GV* gv = gv_fetchpv(name, create, SVt_PVCV); if (create && !GvCVu(gv)) @@ -1151,10 +1134,10 @@ I32 create; /* Be sure to refetch the stack pointer after calling these routines. */ I32 -perl_call_argv(subname, flags, argv) -char *subname; -I32 flags; /* See G_* flags in cop.h */ -register char **argv; /* null terminated arg list */ +perl_call_argv(char *subname, I32 flags, register char **argv) + + /* See G_* flags in cop.h */ + /* null terminated arg list */ { dTHR; dSP; @@ -1171,17 +1154,17 @@ register char **argv; /* null terminated arg list */ } I32 -perl_call_pv(subname, flags) -char *subname; /* name of the subroutine */ -I32 flags; /* See G_* flags in cop.h */ +perl_call_pv(char *subname, I32 flags) + /* name of the subroutine */ + /* See G_* flags in cop.h */ { return perl_call_sv((SV*)perl_get_cv(subname, TRUE), flags); } I32 -perl_call_method(methname, flags) -char *methname; /* name of the subroutine */ -I32 flags; /* See G_* flags in cop.h */ +perl_call_method(char *methname, I32 flags) + /* name of the subroutine */ + /* See G_* flags in cop.h */ { dTHR; dSP; @@ -1196,9 +1179,9 @@ I32 flags; /* See G_* flags in cop.h */ /* May be called with any of a CV, a GV, or an SV containing the name. */ I32 -perl_call_sv(sv, flags) -SV* sv; -I32 flags; /* See G_* flags in cop.h */ +perl_call_sv(SV *sv, I32 flags) + + /* See G_* flags in cop.h */ { dTHR; LOGOP myop; /* fake syntax tree node */ @@ -1340,9 +1323,9 @@ I32 flags; /* See G_* flags in cop.h */ /* Eval a string. The G_EVAL flag is always assumed. */ I32 -perl_eval_sv(sv, flags) -SV* sv; -I32 flags; /* See G_* flags in cop.h */ +perl_eval_sv(SV *sv, I32 flags) + + /* See G_* flags in cop.h */ { dTHR; UNOP myop; /* fake syntax tree node */ @@ -1429,9 +1412,7 @@ I32 flags; /* See G_* flags in cop.h */ } SV* -perl_eval_pv(p, croak_on_error) -char* p; -I32 croak_on_error; +perl_eval_pv(char *p, I32 croak_on_error) { dTHR; dSP; @@ -1454,8 +1435,7 @@ I32 croak_on_error; /* Require a module. */ void -perl_require_pv(pv) -char* pv; +perl_require_pv(char *pv) { SV* sv = sv_newmortal(); sv_setpv(sv, "require '"); @@ -1465,10 +1445,7 @@ char* pv; } void -magicname(sym,name,namlen) -char *sym; -char *name; -I32 namlen; +magicname(char *sym, char *name, I32 namlen) { register GV *gv; @@ -1477,8 +1454,8 @@ I32 namlen; } static void -usage(name) /* XXX move this out into a module ? */ -char *name; +usage(char *name) /* XXX move this out into a module ? */ + { /* This message really ought to be max 23 lines. * Removed -h because the user already knows that opton. Others? */ @@ -1520,8 +1497,7 @@ NULL /* This routine handles any switches that can be given during run */ char * -moreswitches(s) -char *s; +moreswitches(char *s) { I32 numlen; U32 rschar; @@ -1761,7 +1737,7 @@ GNU General Public License, which may be found in the Perl 5.0 source kit.\n\n") /* unexec() can be found in the Gnu emacs distribution */ void -my_unexec() +my_unexec(void) { #ifdef UNEXEC SV* prog; @@ -1790,7 +1766,7 @@ my_unexec() } static void -init_main_stash() +init_main_stash(void) { dTHR; GV *gv; @@ -2149,9 +2125,7 @@ sed %s -e \"/^[^#]/b\" \ } static void -validate_suid(validarg, scriptname) -char *validarg; -char *scriptname; +validate_suid(char *validarg, char *scriptname) { int which; @@ -2391,7 +2365,7 @@ FIX YOUR KERNEL, PUT A C WRAPPER AROUND THIS SCRIPT, OR USE -u AND UNDUMP!\n"); } static void -find_beginning() +find_beginning(void) { register char *s, *s2; @@ -2420,7 +2394,7 @@ find_beginning() } static void -init_ids() +init_ids(void) { uid = (int)getuid(); euid = (int)geteuid(); @@ -2434,8 +2408,7 @@ init_ids() } static void -forbid_setid(s) -char *s; +forbid_setid(char *s) { if (euid != uid) croak("No %s allowed while running setuid", s); @@ -2444,7 +2417,7 @@ char *s; } static void -init_debugger() +init_debugger(void) { dTHR; curstash = debstash; @@ -2463,8 +2436,7 @@ init_debugger() } void -init_stacks(ARGS) -dARGS +init_stacks(ARGSproto) { curstack = newAV(); mainstack = curstack; /* remember in case we switch stacks */ @@ -2523,7 +2495,7 @@ dARGS } static void -nuke_stacks() +nuke_stacks(void) { dTHR; Safefree(cxstack); @@ -2537,7 +2509,7 @@ nuke_stacks() static PerlIO *tmpfp; /* moved outside init_lexer() because of UNICOS bug */ static void -init_lexer() +init_lexer(void) { tmpfp = rsfp; rsfp = Nullfp; @@ -2547,7 +2519,7 @@ init_lexer() } static void -init_predump_symbols() +init_predump_symbols(void) { dTHR; GV *tmpgv; @@ -2584,10 +2556,7 @@ init_predump_symbols() } static void -init_postdump_symbols(argc,argv,env) -register int argc; -register char **argv; -register char **env; +init_postdump_symbols(register int argc, register char **argv, register char **env) { char *s; SV *sv; @@ -2674,7 +2643,7 @@ register char **env; } static void -init_perllib() +init_perllib(void) { char *s; if (!tainting) { @@ -2741,9 +2710,7 @@ init_perllib() #endif static void -incpush(p, addsubdirs) -char *p; -int addsubdirs; +incpush(char *p, int addsubdirs) { SV *subdir = Nullsv; static char *archpat_auto; @@ -2833,9 +2800,7 @@ int addsubdirs; } void -call_list(oldscope, list) -I32 oldscope; -AV* list; +call_list(I32 oldscope, AV *list) { dTHR; line_t oldline = curcop->cop_line; @@ -2907,8 +2872,7 @@ AV* list; } void -my_exit(status) -U32 status; +my_exit(U32 status) { dTHR; @@ -2931,7 +2895,7 @@ U32 status; } void -my_failure_exit() +my_failure_exit(void) { #ifdef VMS if (vaxc$errno & 1) { @@ -2954,7 +2918,7 @@ my_failure_exit() } static void -my_exit_jump() +my_exit_jump(void) { dTHR; register CONTEXT *cx; diff --git a/perl.h b/perl.h index c8a33a0..47df12c 100644 --- a/perl.h +++ b/perl.h @@ -1029,7 +1029,7 @@ union any { }; #ifdef USE_THREADS -#define ARGSproto struct thread * +#define ARGSproto struct thread *thr #else #define ARGSproto void #endif /* USE_THREADS */ @@ -1361,7 +1361,7 @@ EXT struct thread * thr; /* Currently executing (fake) thread */ /* VMS doesn't use environ array and NeXT has problems with crt0.o globals */ #if !defined(VMS) && !(defined(NeXT) && defined(__DYNAMIC__)) -#ifndef DONT_DECLARE_STD +#if !defined(DONT_DECLARE_STD) || (defined(__svr4__) && defined(__GNUC__) && defined(sun)) extern char ** environ; /* environment variables supplied via exec */ #endif #else diff --git a/perlio.c b/perlio.c index f269dcd..2ddc3f1 100644 --- a/perlio.c +++ b/perlio.c @@ -26,7 +26,7 @@ #ifdef PERLIO_IS_STDIO void -PerlIO_init() +PerlIO_init(void) { /* Does nothing (yet) except force this file to be included in perl binary. That allows this file to force inclusion @@ -37,7 +37,7 @@ PerlIO_init() #undef PerlIO_tmpfile PerlIO * -PerlIO_tmpfile() +PerlIO_tmpfile(void) { return tmpfile(); } @@ -610,11 +610,7 @@ char *pat, *args; #ifndef PerlIO_vsprintf int -PerlIO_vsprintf(s,n,fmt,ap) -char *s; -const char *fmt; -int n; -va_list ap; +PerlIO_vsprintf(char *s, int n, const char *fmt, va_list ap) { int val = vsprintf(s, fmt, ap); if (n >= 0) diff --git a/perly.y b/perly.y index 4c4f67a..481a2cc 100644 --- a/perly.y +++ b/perly.y @@ -17,7 +17,7 @@ #include "perl.h" static void -dep() +dep(void) { deprecate("\"do\" to call subroutines"); } diff --git a/pp.c b/pp.c index 649506f..49860d4 100644 --- a/pp.c +++ b/pp.c @@ -24,6 +24,16 @@ */ #ifdef CXUX_BROKEN_CONSTANT_CONVERT static double UV_MAX_cxux = ((double)UV_MAX); +#endif + +#ifdef HAS_CRYPT +#ifdef __cplusplus +#ifdef FCRYPT +extern "C" char *fcrypt(char *,char *); +#else +extern "C" char *crypt(char *,char *); +#endif +#endif #endif /* @@ -105,6 +115,14 @@ static bool srand_called = FALSE; /* variations on pp_null */ +#ifdef DONT_DECLARE_STD +#ifdef I_UNISTD +#include +#endif +#else +extern pid_t getpid (void); +#endif + PP(pp_stub) { dSP; @@ -382,8 +400,7 @@ PP(pp_refgen) } static SV* -refto(sv) -SV* sv; +refto(SV *sv) { SV* rv; @@ -1500,7 +1517,7 @@ PP(pp_srand) } static U32 -seed() +seed(void) { /* * This is really just a quick hack which grabs various garbage @@ -2717,9 +2734,7 @@ PP(pp_reverse) } static SV * -mul128(sv, m) - SV *sv; - U8 m; +mul128(SV *sv, U8 m) { STRLEN len; char *s = SvPV(sv, len); @@ -2727,11 +2742,11 @@ mul128(sv, m) U32 i = 0; if (!strnEQ(s, "0000", 4)) { /* need to grow sv */ - SV *new = newSVpv("0000000000", 10); + SV *New = newSVpv("0000000000", 10); - sv_catsv(new, sv); + sv_catsv(New, sv); SvREFCNT_dec(sv); /* free old sv */ - sv = new; + sv = New; s = SvPV(sv, len); } t = s + len - 1; @@ -3441,10 +3456,7 @@ PP(pp_unpack) } static void -doencodes(sv, s, len) -register SV *sv; -register char *s; -register I32 len; +doencodes(register SV *sv, register char *s, register I32 len) { char hunk[5]; @@ -3468,9 +3480,7 @@ register I32 len; } static SV * -is_an_int(s, l) - char *s; - STRLEN l; +is_an_int(char *s, STRLEN l) { SV *result = newSVpv("", l); char *result_c = SvPV(result, na); /* convenience */ @@ -3518,9 +3528,9 @@ is_an_int(s, l) } static int -div128(pnum, done) - SV *pnum; /* must be '\0' terminated */ - bool *done; +div128(SV *pnum, char *done) + /* must be '\0' terminated */ + { STRLEN len; char *s = SvPV(pnum, len); @@ -4244,8 +4254,7 @@ PP(pp_split) #ifdef USE_THREADS void -unlock_condpair(svv) -void *svv; +unlock_condpair(void *svv) { dTHR; MAGIC *mg = mg_find((SV*)svv, 'm'); diff --git a/pp_ctl.c b/pp_ctl.c index d14fa4b..5cae7ce 100644 --- a/pp_ctl.c +++ b/pp_ctl.c @@ -164,9 +164,7 @@ PP(pp_substcont) } void -rxres_save(rsp, rx) -void **rsp; -REGEXP *rx; +rxres_save(void **rsp, REGEXP *rx) { UV *p = (UV*)*rsp; U32 i; @@ -194,9 +192,7 @@ REGEXP *rx; } void -rxres_restore(rsp, rx) -void **rsp; -REGEXP *rx; +rxres_restore(void **rsp, REGEXP *rx) { UV *p = (UV*)*rsp; U32 i; @@ -216,8 +212,7 @@ REGEXP *rx; } void -rxres_free(rsp) -void **rsp; +rxres_free(void **rsp) { UV *p = (UV*)*rsp; @@ -847,8 +842,7 @@ PP(pp_flop) /* Control. */ static I32 -dopoptolabel(label) -char *label; +dopoptolabel(char *label) { dTHR; register I32 i; @@ -888,14 +882,14 @@ char *label; } I32 -dowantarray() +dowantarray(void) { I32 gimme = block_gimme(); return (gimme == G_VOID) ? G_SCALAR : gimme; } I32 -block_gimme() +block_gimme(void) { dTHR; I32 cxix; @@ -917,8 +911,7 @@ block_gimme() } static I32 -dopoptosub(startingblock) -I32 startingblock; +dopoptosub(I32 startingblock) { dTHR; I32 i; @@ -938,8 +931,7 @@ I32 startingblock; } static I32 -dopoptoeval(startingblock) -I32 startingblock; +dopoptoeval(I32 startingblock) { dTHR; I32 i; @@ -958,8 +950,7 @@ I32 startingblock; } static I32 -dopoptoloop(startingblock) -I32 startingblock; +dopoptoloop(I32 startingblock) { dTHR; I32 i; @@ -992,8 +983,7 @@ I32 startingblock; } void -dounwind(cxix) -I32 cxix; +dounwind(I32 cxix) { dTHR; register CONTEXT *cx; @@ -1026,8 +1016,7 @@ I32 cxix; } OP * -die_where(message) -char *message; +die_where(char *message) { dTHR; if (in_eval) { @@ -1230,9 +1219,7 @@ PP(pp_caller) } static int -sortcv(a, b) -const void *a; -const void *b; +sortcv(const void *a, const void *b) { dTHR; SV * const *str1 = (SV * const *)a; @@ -1258,17 +1245,13 @@ const void *b; } static int -sortcmp(a, b) -const void *a; -const void *b; +sortcmp(const void *a, const void *b) { return sv_cmp(*(SV * const *)a, *(SV * const *)b); } static int -sortcmp_locale(a, b) -const void *a; -const void *b; +sortcmp_locale(const void *a, const void *b) { return sv_cmp_locale(*(SV * const *)a, *(SV * const *)b); } @@ -1643,11 +1626,7 @@ PP(pp_redo) static OP* lastgotoprobe; static OP * -dofindlabel(o,label,opstack,oplimit) -OP *o; -char *label; -OP **opstack; -OP **oplimit; +dofindlabel(OP *o, char *label, OP **opstack, OP **oplimit) { OP *kid; OP **ops = opstack; @@ -2063,9 +2042,7 @@ PP(pp_cswitch) /* Eval. */ static void -save_lines(array, sv) -AV *array; -SV *sv; +save_lines(AV *array, SV *sv) { register char *s = SvPVX(sv); register char *send = SvPVX(sv) + SvCUR(sv); @@ -2089,8 +2066,7 @@ SV *sv; } static OP * -docatch(o) -OP *o; +docatch(OP *o) { dTHR; int ret; @@ -2131,8 +2107,7 @@ OP *o; /* With USE_THREADS, eval_owner must be held on entry to doeval */ static OP * -doeval(gimme) -int gimme; +doeval(int gimme) { dTHR; dSP; @@ -2658,8 +2633,7 @@ PP(pp_leavetry) } static void -doparseform(sv) -SV *sv; +doparseform(SV *sv) { STRLEN len; register char *s = SvPV_force(sv, len); diff --git a/pp_hot.c b/pp_hot.c index f4741a1..df9798a 100644 --- a/pp_hot.c +++ b/pp_hot.c @@ -18,12 +18,15 @@ #include "EXTERN.h" #include "perl.h" +#ifdef I_UNISTD +#include +#endif + /* Hot code. */ #ifdef USE_THREADS static void -unset_cvowner(cvarg) -void *cvarg; +unset_cvowner(void *cvarg) { register CV* cv = (CV *) cvarg; #ifdef DEBUGGING @@ -947,7 +950,7 @@ ret_no: } OP * -do_readline() +do_readline(void) { dTHR; dSP; dTARGETSTACKED; @@ -1370,7 +1373,7 @@ PP(pp_iter) } LvTARG(lv) = SvREFCNT_inc(av); LvTARGOFF(lv) = cx->blk_loop.iterix; - LvTARGLEN(lv) = -1; + LvTARGLEN(lv) = (UV) -1; sv = (SV*)lv; } @@ -1713,9 +1716,7 @@ PP(pp_leavesub) } static CV * -get_db_sub(svp, cv) -SV **svp; -CV *cv; +get_db_sub(SV **svp, CV *cv) { dTHR; SV *oldsv = *svp; @@ -2144,8 +2145,7 @@ PP(pp_entersub) } void -sub_crush_depth(cv) -CV* cv; +sub_crush_depth(CV *cv) { if (CvANON(cv)) warn("Deep recursion on anonymous subroutine"); @@ -2195,9 +2195,7 @@ PP(pp_aelem) } void -vivify_ref(sv, to_what) -SV* sv; -U32 to_what; +vivify_ref(SV *sv, U32 to_what) { if (SvGMAGICAL(sv)) mg_get(sv); diff --git a/pp_sys.c b/pp_sys.c index 99abde9..1aabab8 100644 --- a/pp_sys.c +++ b/pp_sys.c @@ -22,6 +22,12 @@ # include #endif +#ifdef HAS_SYSCALL +#ifdef __cplusplus +extern "C" int syscall(unsigned long,...); +#endif +#endif + #ifdef I_SYS_WAIT # include #endif @@ -832,8 +838,7 @@ PP(pp_sselect) } void -setdefout(gv) -GV *gv; +setdefout(GV *gv) { dTHR; if (gv) @@ -849,7 +854,7 @@ PP(pp_select) GV *newdefout, *egv; HV *hv; - newdefout = (op->op_private > 0) ? ((GV *) POPs) : NULL; + newdefout = (op->op_private > 0) ? ((GV *) POPs) : (GV *) NULL; egv = GvEGV(defoutgv); if (!egv) @@ -918,10 +923,7 @@ PP(pp_read) } static OP * -doform(cv,gv,retop) -CV *cv; -GV *gv; -OP *retop; +doform(CV *cv, GV *gv, OP *retop) { dTHR; register CONTEXT *cx; @@ -2941,7 +2943,7 @@ PP(pp_telldir) { dSP; dTARGET; #if defined(HAS_TELLDIR) || defined(telldir) -#if !defined(telldir) && !defined(HAS_TELLDIR_PROTOTYPE) +#if !defined(telldir) && !defined(HAS_TELLDIR_PROTOTYPE) && !defined(DONT_DECLARE_STD) long telldir _((DIR *)); #endif GV *gv = (GV*)POPs; @@ -3604,10 +3606,10 @@ PP(pp_ghostent) I32 which = op->op_type; register char **elem; register SV *sv; - struct hostent *gethostbyname(); - struct hostent *gethostbyaddr(); -#ifdef HAS_GETHOSTENT - struct hostent *gethostent(); +#if defined(HAS_GETHOSTENT) && !defined(DONT_DECLARE_STD) + struct hostent *gethostbyname(const char *); + struct hostent *gethostbyaddr(const char *, int, int); + struct hostent *gethostent(void); #endif struct hostent *hent; unsigned long len; @@ -3705,9 +3707,11 @@ PP(pp_gnetent) I32 which = op->op_type; register char **elem; register SV *sv; - struct netent *getnetbyname(); - struct netent *getnetbyaddr(); - struct netent *getnetent(); +#ifndef DONT_DECLARE_STD + struct netent *getnetbyname(const char *); + struct netent *getnetbyaddr(long int, int); + struct netent *getnetent(void); +#endif struct netent *nent; if (which == OP_GNBYNAME) @@ -3777,10 +3781,12 @@ PP(pp_gprotoent) #ifdef HAS_SOCKET I32 which = op->op_type; register char **elem; - register SV *sv; - struct protoent *getprotobyname(); - struct protoent *getprotobynumber(); - struct protoent *getprotoent(); + register SV *sv; +#ifndef DONT_DECLARE_STD + struct protoent *getprotobyname(const char *); + struct protoent *getprotobynumber(int); + struct protoent *getprotoent(void); +#endif struct protoent *pent; if (which == OP_GPBYNAME) @@ -3846,9 +3852,11 @@ PP(pp_gservent) I32 which = op->op_type; register char **elem; register SV *sv; - struct servent *getservbyname(); +#ifndef DONT_DECLARE_STD + struct servent *getservbyname(const char *, const char *); struct servent *getservbynumber(); - struct servent *getservent(); + struct servent *getservent(void); +#endif struct servent *sent; if (which == OP_GSBYNAME) { @@ -4230,7 +4238,7 @@ PP(pp_getlogin) PP(pp_syscall) { -#ifdef HAS_SYSCALL +#ifdef HAS_SYSCALL dSP; dMARK; dORIGMARK; dTARGET; register I32 items = SP - MARK; unsigned long a[20]; @@ -4332,9 +4340,7 @@ PP(pp_syscall) */ static int -fcntl_emulate_flock(fd, operation) -int fd; -int operation; +fcntl_emulate_flock(int fd, int operation) { struct flock flock; diff --git a/regcomp.c b/regcomp.c index d93a593..c8118f2 100644 --- a/regcomp.c +++ b/regcomp.c @@ -132,10 +132,7 @@ static char* nextchar _((void)); * of the structure of the compiled regexp. [I'll say.] */ regexp * -pregcomp(exp,xend,pm) -char* exp; -char* xend; -PMOP* pm; +pregcomp(char *exp, char *xend, PMOP *pm) { register regexp *r; register char *scan; @@ -436,9 +433,9 @@ PMOP* pm; * follows makes it hard to avoid. */ static char * -reg(paren, flagp) -I32 paren; /* Parenthesized? */ -I32 *flagp; +reg(I32 paren, I32 *flagp) + /* Parenthesized? */ + { register char *ret; register char *br; @@ -567,8 +564,7 @@ I32 *flagp; * Implements the concatenation operator. */ static char * -regbranch(flagp) -I32 *flagp; +regbranch(I32 *flagp) { register char *ret; register char *chain; @@ -614,8 +610,7 @@ I32 *flagp; * endmarker role is not redundant. */ static char * -regpiece(flagp) -I32 *flagp; +regpiece(I32 *flagp) { register char *ret; register char op; @@ -762,8 +757,7 @@ I32 *flagp; * [Yes, it is worth fixing, some scripts can run twice the speed.] */ static char * -regatom(flagp) -I32 *flagp; +regatom(I32 *flagp) { register char *ret = 0; I32 flags; @@ -1075,9 +1069,7 @@ tryagain: } static char * -regwhite(p, e) -char *p; -char *e; +regwhite(char *p, char *e) { while (p < e) { if (isSPACE(*p)) @@ -1094,9 +1086,7 @@ char *e; } static void -regset(opnd, c) -char *opnd; -register I32 c; +regset(char *opnd, register I32 c) { if (opnd == ®dummy) return; @@ -1105,10 +1095,10 @@ register I32 c; } static char * -regclass() +regclass(void) { register char *opnd; - register I32 class; + register I32 Class; register I32 lastclass = 1234; register I32 range = 0; register char *ret; @@ -1117,7 +1107,7 @@ regclass() ret = regnode(ANYOF); opnd = regcode; - for (class = 0; class < 33; class++) + for (Class = 0; Class < 33; Class++) regc(0); if (*regparse == '^') { /* Complement of range. */ regnaughty++; @@ -1135,19 +1125,19 @@ regclass() goto skipcond; /* allow 1st char to be ] or - */ while (regparse < regxend && *regparse != ']') { skipcond: - class = UCHARAT(regparse++); - if (class == '\\') { - class = UCHARAT(regparse++); - switch (class) { + Class = UCHARAT(regparse++); + if (Class == '\\') { + Class = UCHARAT(regparse++); + switch (Class) { case 'w': if (regflags & PMf_LOCALE) { if (opnd != ®dummy) *opnd |= ANYOF_ALNUML; } else { - for (class = 0; class < 256; class++) - if (isALNUM(class)) - regset(opnd, class); + for (Class = 0; Class < 256; Class++) + if (isALNUM(Class)) + regset(opnd, Class); } lastclass = 1234; continue; @@ -1157,9 +1147,9 @@ regclass() *opnd |= ANYOF_NALNUML; } else { - for (class = 0; class < 256; class++) - if (!isALNUM(class)) - regset(opnd, class); + for (Class = 0; Class < 256; Class++) + if (!isALNUM(Class)) + regset(opnd, Class); } lastclass = 1234; continue; @@ -1169,9 +1159,9 @@ regclass() *opnd |= ANYOF_SPACEL; } else { - for (class = 0; class < 256; class++) - if (isSPACE(class)) - regset(opnd, class); + for (Class = 0; Class < 256; Class++) + if (isSPACE(Class)) + regset(opnd, Class); } lastclass = 1234; continue; @@ -1181,67 +1171,67 @@ regclass() *opnd |= ANYOF_NSPACEL; } else { - for (class = 0; class < 256; class++) - if (!isSPACE(class)) - regset(opnd, class); + for (Class = 0; Class < 256; Class++) + if (!isSPACE(Class)) + regset(opnd, Class); } lastclass = 1234; continue; case 'd': - for (class = '0'; class <= '9'; class++) - regset(opnd, class); + for (Class = '0'; Class <= '9'; Class++) + regset(opnd, Class); lastclass = 1234; continue; case 'D': - for (class = 0; class < '0'; class++) - regset(opnd, class); - for (class = '9' + 1; class < 256; class++) - regset(opnd, class); + for (Class = 0; Class < '0'; Class++) + regset(opnd, Class); + for (Class = '9' + 1; Class < 256; Class++) + regset(opnd, Class); lastclass = 1234; continue; case 'n': - class = '\n'; + Class = '\n'; break; case 'r': - class = '\r'; + Class = '\r'; break; case 't': - class = '\t'; + Class = '\t'; break; case 'f': - class = '\f'; + Class = '\f'; break; case 'b': - class = '\b'; + Class = '\b'; break; case 'e': - class = '\033'; + Class = '\033'; break; case 'a': - class = '\007'; + Class = '\007'; break; case 'x': - class = scan_hex(regparse, 2, &numlen); + Class = scan_hex(regparse, 2, &numlen); regparse += numlen; break; case 'c': - class = UCHARAT(regparse++); - class = toCTRL(class); + Class = UCHARAT(regparse++); + Class = toCTRL(Class); break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': - class = scan_oct(--regparse, 3, &numlen); + Class = scan_oct(--regparse, 3, &numlen); regparse += numlen; break; } } if (range) { - if (lastclass > class) + if (lastclass > Class) FAIL("invalid [] range in regexp"); range = 0; } else { - lastclass = class; + lastclass = Class; if (*regparse == '-' && regparse+1 < regxend && regparse[1] != ']') { regparse++; @@ -1249,9 +1239,9 @@ regclass() continue; /* do it next time */ } } - for ( ; lastclass <= class; lastclass++) + for ( ; lastclass <= Class; lastclass++) regset(opnd, lastclass); - lastclass = class; + lastclass = Class; } if (*regparse != ']') FAIL("unmatched [] in regexp"); @@ -1260,7 +1250,7 @@ regclass() } static char* -nextchar() +nextchar(void) { char* retval = regparse++; @@ -1447,9 +1437,7 @@ char *opnd; - regtail - set the next-pointer at the end of a node chain */ static void -regtail(p, val) -char *p; -char *val; +regtail(char *p, char *val) { register char *scan; register char *temp; @@ -1488,9 +1476,7 @@ char *val; - regoptail - regtail on operand of first argument; nop if operandless */ static void -regoptail(p, val) -char *p; -char *val; +regoptail(char *p, char *val) { /* "Operandless" and "op != BRANCH" are synonymous in practice. */ if (p == NULL || p == ®dummy || regkind[(U8)OP(p)] != BRANCH) @@ -1502,8 +1488,7 @@ char *val; - regcurly - a little FSA that accepts {\d+,?\d*} */ STATIC I32 -regcurly(s) -register char *s; +regcurly(register char *s) { if (*s++ != '{') return FALSE; @@ -1526,8 +1511,7 @@ register char *s; - regdump - dump a regexp onto Perl_debug_log in vaguely comprehensible form */ void -regdump(r) -regexp *r; +regdump(regexp *r) { register char *s; register char op = EXACT; /* Arbitrary non-END op. */ @@ -1599,9 +1583,7 @@ regexp *r; - regprop - printable representation of opcode */ void -regprop(sv, o) -SV *sv; -char *o; +regprop(SV *sv, char *o) { register char *p = 0; @@ -1752,8 +1734,7 @@ char *o; #endif /* DEBUGGING */ void -pregfree(r) -struct regexp *r; +pregfree(struct regexp *r) { if (!r) return; diff --git a/regexec.c b/regexec.c index e5d9e4d..9e8d451 100644 --- a/regexec.c +++ b/regexec.c @@ -86,8 +86,7 @@ static CHECKPOINT regcppush _((I32 parenfloor)); static char * regcppop _((void)); static CHECKPOINT -regcppush(parenfloor) -I32 parenfloor; +regcppush(I32 parenfloor) { dTHR; int retval = savestack_ix; @@ -109,7 +108,7 @@ I32 parenfloor; } static char * -regcppop() +regcppop(void) { dTHR; I32 i = SSPOPINT; @@ -145,8 +144,7 @@ regcppop() * 0 > length [ "foobar" =~ / ( (foo) | (bar) )* /x ]->[1] */ static void -regcppartblow(base) -I32 base; +regcppartblow(I32 base) { dTHR; I32 i = SSPOPINT; @@ -188,14 +186,14 @@ static bool regtainted; /* tainted information used? */ - pregexec - match a regexp against a string */ I32 -pregexec(prog, stringarg, strend, strbeg, minend, screamer, safebase) -register regexp *prog; -char *stringarg; -register char *strend; /* pointer to null at end of string */ -char *strbeg; /* real beginning of string */ -I32 minend; /* end of match must be at least minend after stringarg */ -SV *screamer; -I32 safebase; /* no need to remember string in subbase */ +pregexec(register regexp *prog, char *stringarg, register char *strend, char *strbeg, I32 minend, SV *screamer, I32 safebase) + + + /* pointer to null at end of string */ + /* real beginning of string */ + /* end of match must be at least minend after stringarg */ + + /* no need to remember string in subbase */ { register char *s; register char *c; @@ -595,9 +593,7 @@ phooey: - regtry - try match at specific point */ static I32 /* 0 failure, 1 success */ -regtry(prog, startpos) -regexp *prog; -char *startpos; +regtry(regexp *prog, char *startpos) { register I32 i; register char **sp; @@ -642,8 +638,7 @@ char *startpos; * advantage of machines that use a register save mask on subroutine entry. */ static I32 /* 0 failure, 1 success */ -regmatch(prog) -char *prog; +regmatch(char *prog) { register char *scan; /* Current node. */ char *next; /* Next node. */ @@ -1186,9 +1181,7 @@ no: * rather than incrementing count on every character.] */ static I32 -regrepeat(p, max) -char *p; -I32 max; +regrepeat(char *p, I32 max) { register char *scan; register char *opnd; @@ -1288,9 +1281,7 @@ I32 max; */ static bool -reginclass(p, c) -register char *p; -register I32 c; +reginclass(register char *p, register I32 c) { char flags = *p; bool match = FALSE; @@ -1332,8 +1323,7 @@ register I32 c; * that bypass this code for speed.] */ char * -regnext(p) -register char *p; +regnext(register char *p) { register I32 offset; diff --git a/run.c b/run.c index 1e1001d..543fb08 100644 --- a/run.c +++ b/run.c @@ -20,7 +20,7 @@ dEXT char **watchaddr = 0; dEXT char *watchok; int -runops_standard() { +runops_standard(void) { dTHR; SAVEI32(runlevel); runlevel++; @@ -35,7 +35,7 @@ runops_standard() { static void debprof _((OP*o)); int -runops_debug() { +runops_debug(void) { dTHR; if (!op) { warn("NULL OP IN RUN"); @@ -61,8 +61,7 @@ runops_debug() { } I32 -debop(o) -OP *o; +debop(OP *o) { SV *sv; deb("%s", op_name[o->op_type]); @@ -89,8 +88,7 @@ OP *o; } void -watch(addr) -char **addr; +watch(char **addr) { watchaddr = addr; watchok = *addr; @@ -99,8 +97,7 @@ char **addr; } static void -debprof(o) -OP* o; +debprof(OP *o) { if (!profiledata) New(000, profiledata, MAXO, U32); @@ -108,7 +105,7 @@ OP* o; } void -debprofdump() +debprofdump(void) { unsigned i; if (!profiledata) diff --git a/scope.c b/scope.c index 3fc1a0e..fe7cb2d 100644 --- a/scope.c +++ b/scope.c @@ -16,10 +16,7 @@ #include "perl.h" SV** -stack_grow(sp, p, n) -SV** sp; -SV** p; -int n; +stack_grow(SV **sp, SV **p, int n) { dTHR; stack_sp = sp; @@ -28,7 +25,7 @@ int n; } I32 -cxinc() +cxinc(void) { dTHR; cxstack_max = cxstack_max * 3 / 2; @@ -37,8 +34,7 @@ cxinc() } void -push_return(retop) -OP *retop; +push_return(OP *retop) { dTHR; if (retstack_ix == retstack_max) { @@ -49,7 +45,7 @@ OP *retop; } OP * -pop_return() +pop_return(void) { dTHR; if (retstack_ix > 0) @@ -59,7 +55,7 @@ pop_return() } void -push_scope() +push_scope(void) { dTHR; if (scopestack_ix == scopestack_max) { @@ -71,7 +67,7 @@ push_scope() } void -pop_scope() +pop_scope(void) { dTHR; I32 oldsave = scopestack[--scopestack_ix]; @@ -79,7 +75,7 @@ pop_scope() } void -markstack_grow() +markstack_grow(void) { dTHR; I32 oldmax = markstack_max - markstack; @@ -91,7 +87,7 @@ markstack_grow() } void -savestack_grow() +savestack_grow(void) { dTHR; savestack_max = savestack_max * 3 / 2; @@ -99,7 +95,7 @@ savestack_grow() } void -free_tmps() +free_tmps(void) { dTHR; /* XXX should tmps_floor live in cxstack? */ @@ -117,8 +113,7 @@ free_tmps() } static SV * -save_scalar_at(sptr) -SV **sptr; +save_scalar_at(SV **sptr) { dTHR; register SV *sv; @@ -149,8 +144,7 @@ SV **sptr; } SV * -save_scalar(gv) -GV *gv; +save_scalar(GV *gv) { dTHR; SSCHECK(3); @@ -161,8 +155,7 @@ GV *gv; } SV* -save_svref(sptr) -SV **sptr; +save_svref(SV **sptr) { dTHR; SSCHECK(3); @@ -173,9 +166,7 @@ SV **sptr; } void -save_gp(gv, empty) -GV *gv; -I32 empty; +save_gp(GV *gv, I32 empty) { dTHR; SSCHECK(6); @@ -203,8 +194,7 @@ I32 empty; } AV * -save_ary(gv) -GV *gv; +save_ary(GV *gv) { dTHR; AV *oav, *av; @@ -229,8 +219,7 @@ GV *gv; } HV * -save_hash(gv) -GV *gv; +save_hash(GV *gv) { dTHR; HV *ohv, *hv; @@ -255,8 +244,7 @@ GV *gv; } void -save_item(item) -register SV *item; +save_item(register SV *item) { dTHR; register SV *sv; @@ -270,8 +258,7 @@ register SV *item; } void -save_int(intp) -int *intp; +save_int(int *intp) { dTHR; SSCHECK(3); @@ -281,8 +268,7 @@ int *intp; } void -save_long(longp) -long *longp; +save_long(long int *longp) { dTHR; SSCHECK(3); @@ -292,8 +278,7 @@ long *longp; } void -save_I32(intp) -I32 *intp; +save_I32(I32 *intp) { dTHR; SSCHECK(3); @@ -303,8 +288,7 @@ I32 *intp; } void -save_I16(intp) -I16 *intp; +save_I16(I16 *intp) { dTHR; SSCHECK(3); @@ -314,8 +298,7 @@ I16 *intp; } void -save_iv(ivp) -IV *ivp; +save_iv(IV *ivp) { dTHR; SSCHECK(3); @@ -328,8 +311,7 @@ IV *ivp; * force word-alignment and we'll miss the pointer. */ void -save_pptr(pptr) -char **pptr; +save_pptr(char **pptr) { dTHR; SSCHECK(3); @@ -339,8 +321,7 @@ char **pptr; } void -save_sptr(sptr) -SV **sptr; +save_sptr(SV **sptr) { dTHR; SSCHECK(3); @@ -350,8 +331,7 @@ SV **sptr; } void -save_nogv(gv) -GV *gv; +save_nogv(GV *gv) { dTHR; SSCHECK(2); @@ -360,8 +340,7 @@ GV *gv; } void -save_hptr(hptr) -HV **hptr; +save_hptr(HV **hptr) { dTHR; SSCHECK(3); @@ -371,8 +350,7 @@ HV **hptr; } void -save_aptr(aptr) -AV **aptr; +save_aptr(AV **aptr) { dTHR; SSCHECK(3); @@ -382,8 +360,7 @@ AV **aptr; } void -save_freesv(sv) -SV *sv; +save_freesv(SV *sv) { dTHR; SSCHECK(2); @@ -392,8 +369,7 @@ SV *sv; } void -save_freeop(o) -OP *o; +save_freeop(OP *o) { dTHR; SSCHECK(2); @@ -402,8 +378,7 @@ OP *o; } void -save_freepv(pv) -char *pv; +save_freepv(char *pv) { dTHR; SSCHECK(2); @@ -412,8 +387,7 @@ char *pv; } void -save_clearsv(svp) -SV** svp; +save_clearsv(SV **svp) { dTHR; SSCHECK(2); @@ -422,10 +396,7 @@ SV** svp; } void -save_delete(hv,key,klen) -HV *hv; -char *key; -I32 klen; +save_delete(HV *hv, char *key, I32 klen) { dTHR; SSCHECK(4); @@ -436,9 +407,7 @@ I32 klen; } void -save_list(sarg,maxsarg) -register SV **sarg; -I32 maxsarg; +save_list(register SV **sarg, I32 maxsarg) { dTHR; register SV *sv; @@ -455,9 +424,7 @@ I32 maxsarg; } void -save_destructor(f,p) -void (*f) _((void*)); -void* p; +save_destructor(void (*f) (void *), void *p) { dTHR; SSCHECK(3); @@ -467,7 +434,7 @@ void* p; } void -save_op() +save_op(void) { dTHR; SSCHECK(2); @@ -476,8 +443,7 @@ save_op() } void -leave_scope(base) -I32 base; +leave_scope(I32 base) { dTHR; register SV *sv; @@ -717,8 +683,7 @@ I32 base; #ifdef DEBUGGING void -cx_dump(cx) -CONTEXT* cx; +cx_dump(CONTEXT *cx) { dTHR; PerlIO_printf(Perl_debug_log, "CX %ld = %s\n", (long)(cx - cxstack), block_type[cx->cx_type]); diff --git a/sv.c b/sv.c index da4c73d..74f7307 100644 --- a/sv.c +++ b/sv.c @@ -204,8 +204,7 @@ U32 flags; } while (0) static void -del_sv(p) -SV* p; +del_sv(SV *p) { if (debug & 32768) { SV* sva; @@ -233,10 +232,7 @@ SV* p; #endif /* DEBUGGING */ void -sv_add_arena(ptr, size, flags) -char* ptr; -U32 size; -U32 flags; +sv_add_arena(char *ptr, U32 size, U32 flags) { SV* sva = (SV*)ptr; register SV* sv; @@ -264,7 +260,7 @@ U32 flags; /* sv_mutex must be held while calling more_sv() */ static SV* -more_sv() +more_sv(void) { register SV* sv; @@ -282,8 +278,7 @@ more_sv() } static void -visit(f) -SVFUNC f; +visit(SVFUNC f) { SV* sva; SV* sv; @@ -301,8 +296,7 @@ SVFUNC f; #endif /* PURIFY */ static void -do_report_used(sv) -SV* sv; +do_report_used(SV *sv) { if (SvTYPE(sv) != SVTYPEMASK) { /* XXX Perhaps this ought to go to Perl_debug_log, if DEBUGGING. */ @@ -312,14 +306,13 @@ SV* sv; } void -sv_report_used() +sv_report_used(void) { visit(do_report_used); } static void -do_clean_objs(sv) -SV* sv; +do_clean_objs(SV *sv) { SV* rv; @@ -335,8 +328,7 @@ SV* sv; #ifndef DISABLE_DESTRUCTOR_KLUDGE static void -do_clean_named_objs(sv) -SV* sv; +do_clean_named_objs(SV *sv) { if (SvTYPE(sv) == SVt_PVGV && GvSV(sv)) do_clean_objs(GvSV(sv)); @@ -346,7 +338,7 @@ SV* sv; static bool in_clean_objs = FALSE; void -sv_clean_objs() +sv_clean_objs(void) { in_clean_objs = TRUE; #ifndef DISABLE_DESTRUCTOR_KLUDGE @@ -357,8 +349,7 @@ sv_clean_objs() } static void -do_clean_all(sv) -SV* sv; +do_clean_all(SV *sv) { DEBUG_D((PerlIO_printf(Perl_debug_log, "Cleaning loops:\n "), sv_dump(sv));) SvFLAGS(sv) |= SVf_BREAK; @@ -368,7 +359,7 @@ SV* sv; static bool in_clean_all = FALSE; void -sv_clean_all() +sv_clean_all(void) { in_clean_all = TRUE; visit(do_clean_all); @@ -376,7 +367,7 @@ sv_clean_all() } void -sv_free_arenas() +sv_free_arenas(void) { SV* sva; SV* svanext; @@ -398,7 +389,7 @@ sv_free_arenas() } static XPVIV* -new_xiv() +new_xiv(void) { IV** xiv; if (xiv_root) { @@ -413,8 +404,7 @@ new_xiv() } static void -del_xiv(p) -XPVIV* p; +del_xiv(XPVIV *p) { IV** xiv = (IV**)((char*)(p) + sizeof(XPV)); *xiv = (IV *)xiv_root; @@ -422,7 +412,7 @@ XPVIV* p; } static XPVIV* -more_xiv() +more_xiv(void) { register IV** xiv; register IV** xivend; @@ -443,7 +433,7 @@ more_xiv() } static XPVNV* -new_xnv() +new_xnv(void) { double* xnv; if (xnv_root) { @@ -455,8 +445,7 @@ new_xnv() } static void -del_xnv(p) -XPVNV* p; +del_xnv(XPVNV *p) { double* xnv = (double*)((char*)(p) + sizeof(XPVIV)); *(double**)xnv = xnv_root; @@ -464,7 +453,7 @@ XPVNV* p; } static XPVNV* -more_xnv() +more_xnv(void) { register double* xnv; register double* xnvend; @@ -481,7 +470,7 @@ more_xnv() } static XRV* -new_xrv() +new_xrv(void) { XRV* xrv; if (xrv_root) { @@ -493,15 +482,14 @@ new_xrv() } static void -del_xrv(p) -XRV* p; +del_xrv(XRV *p) { p->xrv_rv = (SV*)xrv_root; xrv_root = p; } static XRV* -more_xrv() +more_xrv(void) { register XRV* xrv; register XRV* xrvend; @@ -517,7 +505,7 @@ more_xrv() } static XPV* -new_xpv() +new_xpv(void) { XPV* xpv; if (xpv_root) { @@ -529,15 +517,14 @@ new_xpv() } static void -del_xpv(p) -XPV* p; +del_xpv(XPV *p) { p->xpv_pv = (char*)xpv_root; xpv_root = p; } static XPV* -more_xpv() +more_xpv(void) { register XPV* xpv; register XPV* xpvend; @@ -557,7 +544,7 @@ more_xpv() #define del_XIV(p) free((char*)p) #else #define new_XIV() (void*)new_xiv() -#define del_XIV(p) del_xiv(p) +#define del_XIV(p) del_xiv((XPVIV*) p) #endif #ifdef PURIFY @@ -565,7 +552,7 @@ more_xpv() #define del_XNV(p) free((char*)p) #else #define new_XNV() (void*)new_xnv() -#define del_XNV(p) del_xnv(p) +#define del_XNV(p) del_xnv((XPVNV*) p) #endif #ifdef PURIFY @@ -573,7 +560,7 @@ more_xpv() #define del_XRV(p) free((char*)p) #else #define new_XRV() (void*)new_xrv() -#define del_XRV(p) del_xrv(p) +#define del_XRV(p) del_xrv((XRV*) p) #endif #ifdef PURIFY @@ -581,7 +568,7 @@ more_xpv() #define del_XPV(p) free((char*)p) #else #define new_XPV() (void*)new_xpv() -#define del_XPV(p) del_xpv(p) +#define del_XPV(p) del_xpv((XPV *)p) #endif #define new_XPVIV() (void*)safemalloc(sizeof(XPVIV)) @@ -618,9 +605,7 @@ more_xpv() #define del_XPVIO(p) free((char*)p) bool -sv_upgrade(sv, mt) -register SV* sv; -U32 mt; +sv_upgrade(register SV *sv, U32 mt) { char* pv; U32 cur; @@ -895,8 +880,7 @@ U32 mt; #ifdef DEBUGGING char * -sv_peek(sv) -register SV *sv; +sv_peek(SV *sv) { SV *t = sv_newmortal(); STRLEN prevlen; @@ -1043,8 +1027,7 @@ register SV *sv; #endif int -sv_backoff(sv) -register SV *sv; +sv_backoff(register SV *sv) { assert(SvOOK(sv)); if (SvIVX(sv)) { @@ -1059,12 +1042,12 @@ register SV *sv; } char * -sv_grow(sv,newlen) -register SV *sv; +sv_grow(register SV *sv, register I32 newlen) + #ifndef DOSISH -register I32 newlen; + #else -unsigned long newlen; + #endif { register char *s; @@ -1101,9 +1084,7 @@ unsigned long newlen; } void -sv_setiv(sv,i) -register SV *sv; -IV i; +sv_setiv(register SV *sv, IV i) { sv_check_thinkfirst(sv); switch (SvTYPE(sv)) { @@ -1141,9 +1122,7 @@ IV i; } void -sv_setuv(sv,u) -register SV *sv; -UV u; +sv_setuv(register SV *sv, UV u) { if (u <= IV_MAX) sv_setiv(sv, u); @@ -1152,9 +1131,7 @@ UV u; } void -sv_setnv(sv,num) -register SV *sv; -double num; +sv_setnv(register SV *sv, double num) { sv_check_thinkfirst(sv); switch (SvTYPE(sv)) { @@ -1198,8 +1175,7 @@ double num; } static void -not_a_number(sv) -SV *sv; +not_a_number(SV *sv) { dTHR; char tmpbuf[64]; @@ -1254,8 +1230,7 @@ SV *sv; } IV -sv_2iv(sv) -register SV *sv; +sv_2iv(register SV *sv) { if (!sv) return 0; @@ -1335,8 +1310,7 @@ register SV *sv; } UV -sv_2uv(sv) -register SV *sv; +sv_2uv(register SV *sv) { if (!sv) return 0; @@ -1406,8 +1380,7 @@ register SV *sv; } double -sv_2nv(sv) -register SV *sv; +sv_2nv(register SV *sv) { if (!sv) return 0.0; @@ -1489,8 +1462,7 @@ register SV *sv; } static IV -asIV(sv) -SV *sv; +asIV(SV *sv) { I32 numtype = looks_like_number(sv); double d; @@ -1508,8 +1480,7 @@ SV *sv; } static UV -asUV(sv) -SV *sv; +asUV(SV *sv) { I32 numtype = looks_like_number(sv); @@ -1524,8 +1495,7 @@ SV *sv; } I32 -looks_like_number(sv) -SV *sv; +looks_like_number(SV *sv) { register char *s; register char *send; @@ -1604,9 +1574,7 @@ SV *sv; } char * -sv_2pv(sv, lp) -register SV *sv; -STRLEN *lp; +sv_2pv(register SV *sv, STRLEN *lp) { register char *s; int olderrno; @@ -1797,8 +1765,7 @@ STRLEN *lp; /* This function is only called on magical items */ bool -sv_2bool(sv) -register SV *sv; +sv_2bool(register SV *sv) { if (SvGMAGICAL(sv)) mg_get(sv); @@ -1844,9 +1811,7 @@ register SV *sv; */ void -sv_setsv(dstr,sstr) -SV *dstr; -register SV *sstr; +sv_setsv(SV *dstr, register SV *sstr) { dTHR; register U32 sflags; @@ -2181,10 +2146,7 @@ register SV *sstr; } void -sv_setpvn(sv,ptr,len) -register SV *sv; -register const char *ptr; -register STRLEN len; +sv_setpvn(register SV *sv, register const char *ptr, register STRLEN len) { assert(len >= 0); /* STRLEN is probably unsigned, so this may elicit a warning, but it won't hurt. */ @@ -2208,9 +2170,7 @@ register STRLEN len; } void -sv_setpv(sv,ptr) -register SV *sv; -register const char *ptr; +sv_setpv(register SV *sv, register const char *ptr) { register STRLEN len; @@ -2234,10 +2194,7 @@ register const char *ptr; } void -sv_usepvn(sv,ptr,len) -register SV *sv; -register char *ptr; -register STRLEN len; +sv_usepvn(register SV *sv, register char *ptr, register STRLEN len) { sv_check_thinkfirst(sv); if (!SvUPGRADE(sv, SVt_PV)) @@ -2258,8 +2215,7 @@ register STRLEN len; } static void -sv_check_thinkfirst(sv) -register SV *sv; +sv_check_thinkfirst(register SV *sv) { if (SvTHINKFIRST(sv)) { if (SvREADONLY(sv)) { @@ -2273,9 +2229,9 @@ register SV *sv; } void -sv_chop(sv,ptr) /* like set but assuming ptr is in sv */ -register SV *sv; -register char *ptr; +sv_chop(register SV *sv, register char *ptr) /* like set but assuming ptr is in sv */ + + { register STRLEN delta; @@ -2298,10 +2254,7 @@ register char *ptr; } void -sv_catpvn(sv,ptr,len) -register SV *sv; -register char *ptr; -register STRLEN len; +sv_catpvn(register SV *sv, register char *ptr, register STRLEN len) { STRLEN tlen; char *junk; @@ -2318,9 +2271,7 @@ register STRLEN len; } void -sv_catsv(dstr,sstr) -SV *dstr; -register SV *sstr; +sv_catsv(SV *dstr, register SV *sstr) { char *s; STRLEN len; @@ -2331,9 +2282,7 @@ register SV *sstr; } void -sv_catpv(sv,ptr) -register SV *sv; -register char *ptr; +sv_catpv(register SV *sv, register char *ptr) { register STRLEN len; STRLEN tlen; @@ -2357,9 +2306,9 @@ SV * newSV(x,len) I32 x; #else -newSV(len) +newSV(STRLEN len) #endif -STRLEN len; + { register SV *sv; @@ -2377,12 +2326,7 @@ STRLEN len; /* name is assumed to contain an SV* if (name && namelen == HEf_SVKEY) */ void -sv_magic(sv, obj, how, name, namlen) -register SV *sv; -SV *obj; -int how; -char *name; -I32 namlen; +sv_magic(register SV *sv, SV *obj, int how, char *name, I32 namlen) { MAGIC* mg; @@ -2532,9 +2476,7 @@ I32 namlen; } int -sv_unmagic(sv, type) -SV* sv; -int type; +sv_unmagic(SV *sv, int type) { MAGIC* mg; MAGIC** mgp; @@ -2568,12 +2510,7 @@ int type; } void -sv_insert(bigstr,offset,len,little,littlelen) -SV *bigstr; -STRLEN offset; -STRLEN len; -char *little; -STRLEN littlelen; +sv_insert(SV *bigstr, STRLEN offset, STRLEN len, char *little, STRLEN littlelen) { register char *big; register char *mid; @@ -2651,9 +2588,7 @@ STRLEN littlelen; /* make sv point to what nstr did */ void -sv_replace(sv,nsv) -register SV *sv; -register SV *nsv; +sv_replace(register SV *sv, register SV *nsv) { U32 refcnt = SvREFCNT(sv); sv_check_thinkfirst(sv); @@ -2679,8 +2614,7 @@ register SV *nsv; } void -sv_clear(sv) -register SV *sv; +sv_clear(register SV *sv) { assert(sv); assert(SvREFCNT(sv) == 0); @@ -2837,8 +2771,7 @@ register SV *sv; } SV * -sv_newref(sv) -SV* sv; +sv_newref(SV *sv) { if (sv) SvREFCNT(sv)++; @@ -2846,8 +2779,7 @@ SV* sv; } void -sv_free(sv) -SV *sv; +sv_free(SV *sv) { if (!sv) return; @@ -2877,8 +2809,7 @@ SV *sv; } STRLEN -sv_len(sv) -register SV *sv; +sv_len(register SV *sv) { char *junk; STRLEN len; @@ -2894,9 +2825,7 @@ register SV *sv; } I32 -sv_eq(str1,str2) -register SV *str1; -register SV *str2; +sv_eq(register SV *str1, register SV *str2) { char *pv1; STRLEN cur1; @@ -2922,14 +2851,12 @@ register SV *str2; } I32 -sv_cmp(str1, str2) -register SV *str1; -register SV *str2; +sv_cmp(register SV *str1, register SV *str2) { STRLEN cur1 = 0; - char *pv1 = str1 ? SvPV(str1, cur1) : NULL; + char *pv1 = str1 ? SvPV(str1, cur1) : (char *) NULL; STRLEN cur2 = 0; - char *pv2 = str2 ? SvPV(str2, cur2) : NULL; + char *pv2 = str2 ? SvPV(str2, cur2) : (char *) NULL; I32 retval; if (!cur1) @@ -2950,9 +2877,7 @@ register SV *str2; } I32 -sv_cmp_locale(sv1, sv2) -register SV *sv1; -register SV *sv2; +sv_cmp_locale(register SV *sv1, register SV *sv2) { #ifdef USE_LOCALE_COLLATE @@ -2964,9 +2889,9 @@ register SV *sv2; goto raw_compare; len1 = 0; - pv1 = sv1 ? sv_collxfrm(sv1, &len1) : NULL; + pv1 = sv1 ? sv_collxfrm(sv1, &len1) : (char *) NULL; len2 = 0; - pv2 = sv2 ? sv_collxfrm(sv2, &len2) : NULL; + pv2 = sv2 ? sv_collxfrm(sv2, &len2) : (char *) NULL; if (!pv1 || !len1) { if (pv2 && len2) @@ -3007,13 +2932,11 @@ register SV *sv2; * according to the locale settings. */ char * -sv_collxfrm(sv, nxp) - SV *sv; - STRLEN *nxp; +sv_collxfrm(SV *sv, STRLEN *nxp) { MAGIC *mg; - mg = SvMAGICAL(sv) ? mg_find(sv, 'o') : NULL; + mg = SvMAGICAL(sv) ? mg_find(sv, 'o') : (MAGIC *) NULL; if (!mg || !mg->mg_ptr || *(U32*)mg->mg_ptr != collation_ix) { char *s, *xf; STRLEN len, xlen; @@ -3055,10 +2978,7 @@ sv_collxfrm(sv, nxp) #endif /* USE_LOCALE_COLLATE */ char * -sv_gets(sv,fp,append) -register SV *sv; -register PerlIO *fp; -I32 append; +sv_gets(register SV *sv, register FILE *fp, I32 append) { char *rsptr; STRLEN rslen; @@ -3296,8 +3216,7 @@ screamer2: void -sv_inc(sv) -register SV *sv; +sv_inc(register SV *sv) { register char *d; int flags; @@ -3375,8 +3294,7 @@ register SV *sv; } void -sv_dec(sv) -register SV *sv; +sv_dec(register SV *sv) { int flags; @@ -3429,7 +3347,7 @@ register SV *sv; * permanent location. */ static void -sv_mortalgrow() +sv_mortalgrow(void) { dTHR; tmps_max += (tmps_max < 512) ? 128 : 512; @@ -3437,8 +3355,7 @@ sv_mortalgrow() } SV * -sv_mortalcopy(oldstr) -SV *oldstr; +sv_mortalcopy(SV *oldstr) { dTHR; register SV *sv; @@ -3456,7 +3373,7 @@ SV *oldstr; } SV * -sv_newmortal() +sv_newmortal(void) { dTHR; register SV *sv; @@ -3474,8 +3391,7 @@ sv_newmortal() /* same thing without the copying */ SV * -sv_2mortal(sv) -register SV *sv; +sv_2mortal(register SV *sv) { dTHR; if (!sv) @@ -3490,9 +3406,7 @@ register SV *sv; } SV * -newSVpv(s,len) -char *s; -STRLEN len; +newSVpv(char *s, STRLEN len) { register SV *sv; @@ -3536,8 +3450,7 @@ va_dcl SV * -newSVnv(n) -double n; +newSVnv(double n) { register SV *sv; @@ -3550,8 +3463,7 @@ double n; } SV * -newSViv(i) -IV i; +newSViv(IV i) { register SV *sv; @@ -3564,8 +3476,7 @@ IV i; } SV * -newRV(ref) -SV *ref; +newRV(SV *ref) { dTHR; register SV *sv; @@ -3583,8 +3494,7 @@ SV *ref; #ifdef CRIPPLED_CC SV * -newRV_noinc(ref) -SV *ref; +newRV_noinc(SV *ref) { register SV *sv; @@ -3597,8 +3507,7 @@ SV *ref; /* make an exact duplicate of old */ SV * -newSVsv(old) -register SV *old; +newSVsv(register SV *old) { register SV *sv; @@ -3623,9 +3532,7 @@ register SV *old; } void -sv_reset(s,stash) -register char *s; -HV *stash; +sv_reset(register char *s, HV *stash) { register HE *entry; register GV *gv; @@ -3688,8 +3595,7 @@ HV *stash; } IO* -sv_2io(sv) -SV *sv; +sv_2io(SV *sv) { IO* io; GV* gv; @@ -3722,11 +3628,7 @@ SV *sv; } CV * -sv_2cv(sv, st, gvp, lref) -SV *sv; -HV **st; -GV **gvp; -I32 lref; +sv_2cv(SV *sv, HV **st, GV **gvp, I32 lref) { GV *gv; CV *cv; @@ -3787,8 +3689,7 @@ I32 lref; #ifndef SvTRUE I32 -SvTRUE(sv) -register SV *sv; +SvTRUE(register SV *sv) { if (!sv) return 0; @@ -3819,8 +3720,7 @@ register SV *sv; #ifndef SvIV IV -SvIV(sv) -register SV *sv; +SvIV(register SV *sv) { if (SvIOK(sv)) return SvIVX(sv); @@ -3830,8 +3730,7 @@ register SV *sv; #ifndef SvUV UV -SvUV(sv) -register SV *sv; +SvUV(register SV *sv) { if (SvIOK(sv)) return SvUVX(sv); @@ -3841,8 +3740,7 @@ register SV *sv; #ifndef SvNV double -SvNV(sv) -register SV *sv; +SvNV(register SV *sv) { if (SvNOK(sv)) return SvNVX(sv); @@ -3852,9 +3750,7 @@ register SV *sv; #ifdef CRIPPLED_CC char * -sv_pvn(sv, lp) -SV *sv; -STRLEN *lp; +sv_pvn(SV *sv, STRLEN *lp) { if (SvPOK(sv)) { *lp = SvCUR(sv); @@ -3865,9 +3761,7 @@ STRLEN *lp; #endif char * -sv_pvn_force(sv, lp) -SV *sv; -STRLEN *lp; +sv_pvn_force(SV *sv, STRLEN *lp) { char *s; @@ -3917,9 +3811,7 @@ STRLEN *lp; } char * -sv_reftype(sv, ob) -SV* sv; -int ob; +sv_reftype(SV *sv, int ob) { if (ob && SvOBJECT(sv)) return HvNAME(SvSTASH(sv)); @@ -3950,8 +3842,7 @@ int ob; } int -sv_isobject(sv) -SV *sv; +sv_isobject(SV *sv) { if (!sv) return 0; @@ -3966,9 +3857,7 @@ SV *sv; } int -sv_isa(sv, name) -SV *sv; -char *name; +sv_isa(SV *sv, char *name) { if (!sv) return 0; @@ -3984,9 +3873,7 @@ char *name; } SV* -newSVrv(rv, classname) -SV *rv; -char *classname; +newSVrv(SV *rv, char *classname) { dTHR; SV *sv; @@ -4007,10 +3894,7 @@ char *classname; } SV* -sv_setref_pv(rv, classname, pv) -SV *rv; -char *classname; -void* pv; +sv_setref_pv(SV *rv, char *classname, void *pv) { if (!pv) sv_setsv(rv, &sv_undef); @@ -4020,40 +3904,28 @@ void* pv; } SV* -sv_setref_iv(rv, classname, iv) -SV *rv; -char *classname; -IV iv; +sv_setref_iv(SV *rv, char *classname, IV iv) { sv_setiv(newSVrv(rv,classname), iv); return rv; } SV* -sv_setref_nv(rv, classname, nv) -SV *rv; -char *classname; -double nv; +sv_setref_nv(SV *rv, char *classname, double nv) { sv_setnv(newSVrv(rv,classname), nv); return rv; } SV* -sv_setref_pvn(rv, classname, pv, n) -SV *rv; -char *classname; -char* pv; -I32 n; +sv_setref_pvn(SV *rv, char *classname, char *pv, I32 n) { sv_setpvn(newSVrv(rv,classname), pv, n); return rv; } SV* -sv_bless(sv,stash) -SV* sv; -HV* stash; +sv_bless(SV *sv, HV *stash) { dTHR; SV *ref; @@ -4086,8 +3958,7 @@ HV* stash; } static void -sv_unglob(sv) -SV* sv; +sv_unglob(SV *sv) { assert(SvTYPE(sv) == SVt_PVGV); SvFAKE_off(sv); @@ -4101,8 +3972,7 @@ SV* sv; } void -sv_unref(sv) -SV* sv; +sv_unref(SV *sv) { SV* rv = SvRV(sv); @@ -4115,15 +3985,13 @@ SV* sv; } void -sv_taint(sv) -SV *sv; +sv_taint(SV *sv) { sv_magic((sv), Nullsv, 't', Nullch, 0); } void -sv_untaint(sv) -SV *sv; +sv_untaint(SV *sv) { if (SvTYPE(sv) >= SVt_PVMG && SvMAGIC(sv)) { MAGIC *mg = mg_find(sv, 't'); @@ -4133,8 +4001,7 @@ SV *sv; } bool -sv_tainted(sv) -SV *sv; +sv_tainted(SV *sv) { if (SvTYPE(sv) >= SVt_PVMG && SvMAGIC(sv)) { MAGIC *mg = mg_find(sv, 't'); @@ -4145,9 +4012,7 @@ SV *sv; } void -sv_setpviv(sv, iv) -SV *sv; -IV iv; +sv_setpviv(SV *sv, IV iv) { STRLEN len; char buf[TYPE_DIGITS(UV)]; @@ -4224,28 +4089,14 @@ sv_catpvf(sv, pat, va_alist) } void -sv_vsetpvfn(sv, pat, patlen, args, svargs, svmax, used_locale) - SV *sv; - const char *pat; - STRLEN patlen; - va_list *args; - SV **svargs; - I32 svmax; - bool *used_locale; +sv_vsetpvfn(SV *sv, const char *pat, STRLEN patlen, va_list *args, SV **svargs, I32 svmax, char *used_locale) { sv_setpvn(sv, "", 0); sv_vcatpvfn(sv, pat, patlen, args, svargs, svmax, used_locale); } void -sv_vcatpvfn(sv, pat, patlen, args, svargs, svmax, used_locale) - SV *sv; - const char *pat; - STRLEN patlen; - va_list *args; - SV **svargs; - I32 svmax; - bool *used_locale; +sv_vcatpvfn(SV *sv, const char *pat, STRLEN patlen, va_list *args, SV **svargs, I32 svmax, char *used_locale) { dTHR; char *p; @@ -4736,8 +4587,7 @@ sv_vcatpvfn(sv, pat, patlen, args, svargs, svmax, used_locale) #ifdef DEBUGGING void -sv_dump(sv) -SV* sv; +sv_dump(SV *sv) { SV *d = sv_newmortal(); char *s; @@ -5000,8 +4850,7 @@ SV* sv; } #else void -sv_dump(sv) -SV* sv; +sv_dump(SV *sv) { } #endif diff --git a/taint.c b/taint.c index 6776272..c8c6800 100644 --- a/taint.c +++ b/taint.c @@ -8,9 +8,7 @@ #include "perl.h" void -taint_proper(f, s) -const char *f; -char *s; +taint_proper(const char *f, char *s) { char *ug; @@ -32,7 +30,7 @@ char *s; } void -taint_env() +taint_env(void) { SV** svp; MAGIC* mg; diff --git a/toke.c b/toke.c index bfcab10..b5e1bc0 100644 --- a/toke.c +++ b/toke.c @@ -144,8 +144,7 @@ static struct { #define OLDLOP(f) return(yylval.ival=f,expect = XTERM,bufptr = s,(int)LSTOP) static int -ao(toketype) -int toketype; +ao(int toketype) { if (*bufptr == '=') { bufptr++; @@ -159,9 +158,7 @@ int toketype; } static void -no_op(what, s) -char *what; -char *s; +no_op(char *what, char *s) { char *oldbp = bufptr; bool is_first = (oldbufptr == linestart); @@ -184,8 +181,7 @@ char *s; } static void -missingterm(s) -char *s; +missingterm(char *s) { char tmpbuf[3]; char q; @@ -211,22 +207,20 @@ char *s; } void -deprecate(s) -char *s; +deprecate(char *s) { if (dowarn) warn("Use of %s is deprecated", s); } static void -depcom() +depcom(void) { deprecate("comma-less variable list"); } void -lex_start(line) -SV *line; +lex_start(SV *line) { dTHR; char *s; @@ -290,14 +284,13 @@ SV *line; } void -lex_end() +lex_end(void) { doextract = FALSE; } static void -restore_rsfp(f) -void *f; +restore_rsfp(void *f) { PerlIO *fp = (PerlIO*)f; @@ -309,8 +302,7 @@ void *f; } static void -incline(s) -char *s; +incline(char *s) { dTHR; char *t; @@ -351,8 +343,7 @@ char *s; } static char * -skipspace(s) -register char *s; +skipspace(register char *s) { dTHR; if (lex_formbrack && lex_brackets <= lex_formbrack) { @@ -410,7 +401,7 @@ register char *s; } static void -check_uni() { +check_uni(void) { char *s; char ch; char *t; @@ -434,9 +425,7 @@ check_uni() { #define UNI(f) return uni(f,s) static int -uni(f,s) -I32 f; -char *s; +uni(I32 f, char *s) { yylval.ival = f; expect = XTERM; @@ -486,8 +475,7 @@ char *s; } static void -force_next(type) -I32 type; +force_next(I32 type) { nexttype[nexttoke] = type; nexttoke++; @@ -499,12 +487,7 @@ I32 type; } static char * -force_word(start,token,check_keyword,allow_pack,allow_tick) -register char *start; -int token; -int check_keyword; -int allow_pack; -int allow_tick; +force_word(register char *start, int token, int check_keyword, int allow_pack, int allow_tick) { register char *s; STRLEN len; @@ -536,9 +519,7 @@ int allow_tick; } static void -force_ident(s, kind) -register char *s; -int kind; +force_ident(register char *s, int kind) { if (s && *s) { OP* o = (OP*)newSVOP(OP_CONST, 0, newSVpv(s,0)); @@ -561,8 +542,7 @@ int kind; } static char * -force_version(s) -char *s; +force_version(char *s) { OP *version = Nullop; @@ -589,8 +569,7 @@ char *s; } static SV * -q(sv) -SV *sv; +q(SV *sv) { register char *s; register char *send; @@ -623,7 +602,7 @@ SV *sv; } static I32 -sublex_start() +sublex_start(void) { register I32 op_type = yylval.ival; @@ -658,7 +637,7 @@ sublex_start() } static I32 -sublex_push() +sublex_push(void) { dTHR; push_scope(); @@ -711,7 +690,7 @@ sublex_push() } static I32 -sublex_done() +sublex_done(void) { if (!lex_starts++) { expect = XOPERATOR; @@ -756,8 +735,7 @@ sublex_done() } static char * -scan_const(start) -char *start; +scan_const(char *start) { register char *send = bufend; SV *sv = NEWSV(93, send - start); @@ -896,8 +874,7 @@ char *start; /* This is the one truly awful dwimmer necessary to conflate C and sed. */ static int -intuit_more(s) -register char *s; +intuit_more(register char *s) { if (lex_brackets) return TRUE; @@ -1025,9 +1002,7 @@ register char *s; } static int -intuit_method(start,gv) -char *start; -GV *gv; +intuit_method(char *start, GV *gv) { char *s = start + (*start == '$'); char tmpbuf[sizeof tokenbuf]; @@ -1073,7 +1048,7 @@ GV *gv; } static char* -incl_perldb() +incl_perldb(void) { if (perldb) { char *pdb = getenv("PERL5DB"); @@ -1104,9 +1079,7 @@ incl_perldb() static int filter_debug = 0; SV * -filter_add(funcp, datasv) - filter_t funcp; - SV *datasv; +filter_add(filter_t funcp, SV *datasv) { if (!funcp){ /* temporary handy debugging hack to be deleted */ filter_debug = atoi((char*)datasv); @@ -1129,8 +1102,7 @@ filter_add(funcp, datasv) /* Delete most recently added instance of this filter function. */ void -filter_del(funcp) - filter_t funcp; +filter_del(filter_t funcp) { if (filter_debug) warn("filter_del func %p", funcp); @@ -1150,10 +1122,10 @@ filter_del(funcp) /* Invoke the n'th filter function for the current rsfp. */ I32 -filter_read(idx, buf_sv, maxlen) - int idx; - SV *buf_sv; - int maxlen; /* 0 = read one text line */ +filter_read(int idx, SV *buf_sv, int maxlen) + + + /* 0 = read one text line */ { filter_t funcp; SV *datasv = NULL; @@ -1208,10 +1180,7 @@ filter_read(idx, buf_sv, maxlen) } static char * -filter_gets(sv,fp, append) -register SV *sv; -register PerlIO *fp; -STRLEN append; +filter_gets(register SV *sv, register FILE *fp, STRLEN append) { if (rsfp_filters) { @@ -1236,7 +1205,7 @@ STRLEN append; EXT int yychar; /* last token */ int -yylex() +yylex(void) { dTHR; register char *s; @@ -3762,9 +3731,7 @@ yylex() } I32 -keyword(d, len) -register char *d; -I32 len; +keyword(register char *d, I32 len) { switch (*d) { case '_': @@ -4380,10 +4347,7 @@ I32 len; } static void -checkcomma(s,name,what) -register char *s; -char *name; -char *what; +checkcomma(register char *s, char *name, char *what) { char *w; @@ -4425,12 +4389,7 @@ char *what; } static char * -scan_word(s, dest, destlen, allow_package, slp) -register char *s; -char *dest; -STRLEN destlen; -int allow_package; -STRLEN *slp; +scan_word(register char *s, char *dest, STRLEN destlen, int allow_package, STRLEN *slp) { register char *d = dest; register char *e = d + destlen - 3; /* two-character token, ending NUL */ @@ -4457,12 +4416,7 @@ STRLEN *slp; } static char * -scan_ident(s, send, dest, destlen, ck_uni) -register char *s; -register char *send; -char *dest; -STRLEN destlen; -I32 ck_uni; +scan_ident(register char *s, register char *send, char *dest, STRLEN destlen, I32 ck_uni) { register char *d; register char *e; @@ -4578,9 +4532,7 @@ I32 ck_uni; return s; } -void pmflag(pmfl,ch) -U16* pmfl; -int ch; +void pmflag(U16 *pmfl, int ch) { if (ch == 'i') *pmfl |= PMf_FOLD; @@ -4599,8 +4551,7 @@ int ch; } static char * -scan_pat(start) -char *start; +scan_pat(char *start) { PMOP *pm; char *s; @@ -4626,8 +4577,7 @@ char *start; } static char * -scan_subst(start) -char *start; +scan_subst(char *start) { register char *s; register PMOP *pm; @@ -4692,8 +4642,7 @@ char *start; } void -hoistmust(pm) -register PMOP *pm; +hoistmust(register PMOP *pm) { dTHR; if (!pm->op_pmshort && pm->op_pmregexp->regstart && @@ -4733,14 +4682,13 @@ register PMOP *pm; } static char * -scan_trans(start) -char *start; +scan_trans(char *start) { register char* s; OP *o; short *tbl; I32 squash; - I32 delete; + I32 Delete; I32 complement; yylval.ival = OP_NULL; @@ -4769,17 +4717,17 @@ char *start; New(803,tbl,256,short); o = newPVOP(OP_TRANS, 0, (char*)tbl); - complement = delete = squash = 0; + complement = Delete = squash = 0; while (*s == 'c' || *s == 'd' || *s == 's') { if (*s == 'c') complement = OPpTRANS_COMPLEMENT; else if (*s == 'd') - delete = OPpTRANS_DELETE; + Delete = OPpTRANS_DELETE; else squash = OPpTRANS_SQUASH; s++; } - o->op_private = delete|squash|complement; + o->op_private = Delete|squash|complement; lex_op = o; yylval.ival = OP_TRANS; @@ -4787,8 +4735,7 @@ char *start; } static char * -scan_heredoc(s) -register char *s; +scan_heredoc(register char *s) { dTHR; SV *herewas; @@ -4914,8 +4861,7 @@ register char *s; } static char * -scan_inputsymbol(start) -char *start; +scan_inputsymbol(char *start) { register char *s = start; register char *d; @@ -4971,8 +4917,7 @@ char *start; } static char * -scan_str(start) -char *start; +scan_str(char *start) { dTHR; SV *sv; @@ -5068,8 +5013,7 @@ char *start; } char * -scan_num(start) -char *start; +scan_num(char *start) { register char *s = start; register char *d; @@ -5197,8 +5141,7 @@ char *start; } static char * -scan_formline(s) -register char *s; +scan_formline(register char *s) { dTHR; register char *eol; @@ -5268,7 +5211,7 @@ register char *s; } static void -set_csh() +set_csh(void) { #ifdef CSH if (!cshlen) @@ -5277,9 +5220,7 @@ set_csh() } I32 -start_subparse(is_format, flags) -I32 is_format; -U32 flags; +start_subparse(I32 is_format, U32 flags) { dTHR; I32 oldsavestack_ix = savestack_ix; @@ -5339,8 +5280,7 @@ U32 flags; } int -yywarn(s) -char *s; +yywarn(char *s) { dTHR; --error_count; @@ -5351,8 +5291,7 @@ char *s; } int -yyerror(s) -char *s; +yyerror(char *s) { dTHR; char *where = NULL; diff --git a/universal.c b/universal.c index d6689f8..9a86763 100644 --- a/universal.c +++ b/universal.c @@ -8,11 +8,7 @@ */ static SV * -isa_lookup(stash, name, len, level) -HV *stash; -char *name; -int len; -int level; +isa_lookup(HV *stash, char *name, int len, int level) { AV* av; GV* gv; @@ -75,9 +71,7 @@ int level; } bool -sv_derived_from(sv, name) -SV * sv ; -char * name ; +sv_derived_from(SV *sv, char *name) { SV *rv; char *type; @@ -203,7 +197,7 @@ XS(XS_UNIVERSAL_VERSION) } void -boot_core_UNIVERSAL() +boot_core_UNIVERSAL(void) { char *file = __FILE__; diff --git a/util.c b/util.c index 0d33863..d40f927 100644 --- a/util.c +++ b/util.c @@ -282,13 +282,7 @@ xstat() /* copy a string up to some (non-backslashed) delimiter, if any */ char * -delimcpy(to, toend, from, fromend, delim, retlen) -register char *to; -register char *toend; -register char *from; -register char *fromend; -register int delim; -I32 *retlen; +delimcpy(register char *to, register char *toend, register char *from, register char *fromend, register int delim, I32 *retlen) { register I32 tolen; for (tolen = 0; from < fromend; from++, tolen++) { @@ -317,9 +311,7 @@ I32 *retlen; /* This routine was donated by Corey Satten. */ char * -instr(big, little) -register char *big; -register char *little; +instr(register char *big, register char *little) { register char *s, *x; register I32 first; @@ -349,11 +341,7 @@ register char *little; /* same as instr but allow embedded nulls */ char * -ninstr(big, bigend, little, lend) -register char *big; -register char *bigend; -char *little; -char *lend; +ninstr(register char *big, register char *bigend, char *little, char *lend) { register char *s, *x; register I32 first = *little; @@ -382,11 +370,7 @@ char *lend; /* reverse of the above--find last substring */ char * -rninstr(big, bigend, little, lend) -register char *big; -char *bigend; -char *little; -char *lend; +rninstr(register char *big, char *bigend, char *little, char *lend) { register char *bigbeg; register char *s, *x; @@ -416,8 +400,7 @@ char *lend; * Set up for a new ctype locale. */ void -perl_new_ctype(newctype) - char *newctype; +perl_new_ctype(char *newctype) { #ifdef USE_LOCALE_CTYPE @@ -439,8 +422,7 @@ perl_new_ctype(newctype) * Set up for a new collation locale. */ void -perl_new_collate(newcoll) - char *newcoll; +perl_new_collate(char *newcoll) { #ifdef USE_LOCALE_COLLATE @@ -484,8 +466,7 @@ perl_new_collate(newcoll) * Set up for a new numeric locale. */ void -perl_new_numeric(newnum) - char *newnum; +perl_new_numeric(char *newnum) { #ifdef USE_LOCALE_NUMERIC @@ -510,7 +491,7 @@ perl_new_numeric(newnum) } void -perl_set_numeric_standard() +perl_set_numeric_standard(void) { #ifdef USE_LOCALE_NUMERIC @@ -524,7 +505,7 @@ perl_set_numeric_standard() } void -perl_set_numeric_local() +perl_set_numeric_local(void) { #ifdef USE_LOCALE_NUMERIC @@ -542,8 +523,7 @@ perl_set_numeric_local() * Initialize locale awareness. */ int -perl_init_i18nl10n(printwarn) - int printwarn; +perl_init_i18nl10n(int printwarn) { int ok = 1; /* returns @@ -772,8 +752,7 @@ perl_init_i18nl10n(printwarn) /* Backwards compatibility. */ int -perl_init_i18nl14n(printwarn) - int printwarn; +perl_init_i18nl14n(int printwarn) { return perl_init_i18nl10n(printwarn); } @@ -788,10 +767,7 @@ perl_init_i18nl14n(printwarn) * Please see sv_collxfrm() to see how this is used. */ char * -mem_collxfrm(s, len, xlen) - const char *s; - STRLEN len; - STRLEN *xlen; +mem_collxfrm(const char *s, STRLEN len, STRLEN *xlen) { char *xbuf; STRLEN xalloc, xin, xout; @@ -841,8 +817,7 @@ mem_collxfrm(s, len, xlen) #endif /* USE_LOCALE_COLLATE */ void -fbm_compile(sv) -SV *sv; +fbm_compile(SV *sv) { register unsigned char *s; register unsigned char *table; @@ -883,10 +858,7 @@ SV *sv; } char * -fbm_instr(big, bigend, littlestr) -unsigned char *big; -register unsigned char *bigend; -SV *littlestr; +fbm_instr(unsigned char *big, register unsigned char *bigend, SV *littlestr) { register unsigned char *s; register I32 tmp; @@ -959,9 +931,7 @@ SV *littlestr; } char * -screaminstr(bigstr, littlestr) -SV *bigstr; -SV *littlestr; +screaminstr(SV *bigstr, SV *littlestr) { register unsigned char *s, *x; register unsigned char *big; @@ -1020,9 +990,7 @@ SV *littlestr; } I32 -ibcmp(s1, s2, len) -char *s1, *s2; -register I32 len; +ibcmp(char *s1, char *s2, register I32 len) { register U8 *a = (U8 *)s1; register U8 *b = (U8 *)s2; @@ -1035,9 +1003,7 @@ register I32 len; } I32 -ibcmp_locale(s1, s2, len) -char *s1, *s2; -register I32 len; +ibcmp_locale(char *s1, char *s2, register I32 len) { register U8 *a = (U8 *)s1; register U8 *b = (U8 *)s2; @@ -1052,8 +1018,7 @@ register I32 len; /* copy a string to a safe spot */ char * -savepv(sv) -char *sv; +savepv(char *sv) { register char *newaddr; @@ -1065,9 +1030,7 @@ char *sv; /* same thing but with a known length */ char * -savepvn(sv, len) -char *sv; -register I32 len; +savepvn(char *sv, register I32 len) { register char *newaddr; @@ -1080,7 +1043,7 @@ register I32 len; /* the SV for form() and mess() is not kept in an arena */ static SV * -mess_alloc() +mess_alloc(void) { SV *sv; XPVMG *any; @@ -1119,9 +1082,7 @@ form(pat, va_alist) } char * -mess(pat, args) - const char *pat; - va_list *args; +mess(const char *pat, va_list *args) { SV *sv; static char dgd[] = " during global destruction.\n"; @@ -1350,8 +1311,7 @@ warn(pat,va_alist) #ifndef VMS /* VMS' my_setenv() is in VMS.c */ #ifndef WIN32 void -my_setenv(nam,val) -char *nam, *val; +my_setenv(char *nam, char *val) { register I32 i=setenv_getix(nam); /* where does it go? */ @@ -1465,8 +1425,7 @@ char *nam, *val; #endif /* WIN32 */ I32 -setenv_getix(nam) -char *nam; +setenv_getix(char *nam) { register I32 i, len = strlen(nam); @@ -1754,12 +1713,10 @@ VTOH(vtohl,long) /* VMS' my_popen() is in VMS.c, same with OS/2. */ #if (!defined(DOSISH) || defined(HAS_FORK) || defined(AMIGAOS)) && !defined(VMS) PerlIO * -my_popen(cmd,mode) -char *cmd; -char *mode; +my_popen(char *cmd, char *mode) { int p[2]; - register I32 this, that; + register I32 This, that; register I32 pid; SV *sv; I32 doexec = strNE(cmd,"-"); @@ -1771,15 +1728,15 @@ char *mode; #endif if (pipe(p) < 0) return Nullfp; - this = (*mode == 'w'); - that = !this; + This = (*mode == 'w'); + that = !This; if (doexec && tainting) { taint_env(); taint_proper("Insecure %s%s", "EXEC"); } while ((pid = (doexec?vfork():fork())) < 0) { if (errno != EAGAIN) { - close(p[this]); + close(p[This]); if (!doexec) croak("Can't fork"); return Nullfp; @@ -1790,7 +1747,7 @@ char *mode; GV* tmpgv; #define THIS that -#define THAT this +#define THAT This close(p[THAT]); if (p[THIS] != (*mode == 'r')) { dup2(p[THIS], *mode == 'r'); @@ -1820,16 +1777,16 @@ char *mode; } do_execfree(); /* free any memory malloced by child on vfork */ close(p[that]); - if (p[that] < p[this]) { - dup2(p[this], p[that]); - close(p[this]); - p[this] = p[that]; + if (p[that] < p[This]) { + dup2(p[This], p[that]); + close(p[This]); + p[This] = p[that]; } - sv = *av_fetch(fdpid,p[this],TRUE); + sv = *av_fetch(fdpid,p[This],TRUE); (void)SvUPGRADE(sv,SVt_IV); SvIVX(sv) = pid; forkprocess = pid; - return PerlIO_fdopen(p[this], mode); + return PerlIO_fdopen(p[This], mode); } #else #if defined(atarist) || defined(DJGPP) @@ -1903,9 +1860,7 @@ int newfd; #ifdef HAS_SIGACTION Sighandler_t -rsignal(signo, handler) -int signo; -Sighandler_t handler; +rsignal(int signo, Sighandler_t handler) { struct sigaction act, oact; @@ -1922,8 +1877,7 @@ Sighandler_t handler; } Sighandler_t -rsignal_state(signo) -int signo; +rsignal_state(int signo) { struct sigaction oact; @@ -1934,10 +1888,7 @@ int signo; } int -rsignal_save(signo, handler, save) -int signo; -Sighandler_t handler; -Sigsave_t *save; +rsignal_save(int signo, Sighandler_t handler, Sigsave_t *save) { struct sigaction act; @@ -1951,9 +1902,7 @@ Sigsave_t *save; } int -rsignal_restore(signo, save) -int signo; -Sigsave_t *save; +rsignal_restore(int signo, Sigsave_t *save) { return sigaction(signo, save, (struct sigaction *)NULL); } @@ -2015,8 +1964,7 @@ Sigsave_t *save; /* VMS' my_pclose() is in VMS.c; same with OS/2 */ #if (!defined(DOSISH) || defined(HAS_FORK) || defined(AMIGAOS)) && !defined(VMS) I32 -my_pclose(ptr) -PerlIO *ptr; +my_pclose(FILE *ptr) { Sigsave_t hstat, istat, qstat; int status; @@ -2065,10 +2013,7 @@ PerlIO *ptr; #if !defined(DOSISH) || defined(OS2) I32 -wait4pid(pid,statusp,flags) -int pid; -int *statusp; -int flags; +wait4pid(int pid, int *statusp, int flags) { SV *sv; SV** svp; @@ -2128,9 +2073,7 @@ int flags; void /*SUPPRESS 590*/ -pidgone(pid,status) -int pid; -int status; +pidgone(int pid, int status) { register SV *sv; char spid[TYPE_CHARS(int)]; @@ -2163,11 +2106,7 @@ PerlIO *ptr; #endif void -repeatcpy(to,from,len,count) -register char *to; -register char *from; -I32 len; -register I32 count; +repeatcpy(register char *to, register char *from, I32 len, register I32 count) { register I32 todo; register char *frombase = from; @@ -2301,10 +2240,7 @@ char *b; #endif /* !HAS_RENAME */ UV -scan_oct(start, len, retlen) -char *start; -I32 len; -I32 *retlen; +scan_oct(char *start, I32 len, I32 *retlen) { register char *s = start; register UV retval = 0; @@ -2326,10 +2262,7 @@ I32 *retlen; } UV -scan_hex(start, len, retlen) -char *start; -I32 len; -I32 *retlen; +scan_hex(char *start, I32 len, I32 *retlen) { register char *s = start; register UV retval = 0; @@ -2441,8 +2374,7 @@ getTHR _((void)) #endif /* OLD_PTHREADS_API */ MAGIC * -condpair_magic(sv) -SV *sv; +condpair_magic(SV *sv) { MAGIC *mg; @@ -2487,7 +2419,7 @@ SV *sv; * Needed for SunOS with Sun's 'acc' for example. */ double -Perl_huge() +Perl_huge(void) { return HUGE_VAL; }