From: Gurusamy Sarathy Date: Wed, 2 Jun 1999 00:48:50 +0000 (+0000) Subject: remove stray K&R-isms X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ba106d47906768b6e657462b9a484fe0c3a0f0d5;p=p5sagit%2Fp5-mst-13.2.git remove stray K&R-isms p4raw-id: //depot/perl@3515 --- diff --git a/ext/SDBM_File/sdbm/dba.c b/ext/SDBM_File/sdbm/dba.c index 9f987fd..7406776 100644 --- a/ext/SDBM_File/sdbm/dba.c +++ b/ext/SDBM_File/sdbm/dba.c @@ -11,8 +11,7 @@ char *progname; extern void oops(); int -main(argc, argv) -char **argv; +main(int argc, char **argv) { int n; char *p; @@ -40,8 +39,8 @@ char **argv; return 0; } -sdump(pagf) -int pagf; +void +sdump(int pagf) { register b; register n = 0; @@ -70,8 +69,8 @@ int pagf; oops("read failed: block %d", n); } -pagestat(pag) -char *pag; +int +pagestat(char *pag) { register n; register free; diff --git a/ext/SDBM_File/sdbm/dbd.c b/ext/SDBM_File/sdbm/dbd.c index f60f91a..0a58d9a 100644 --- a/ext/SDBM_File/sdbm/dbd.c +++ b/ext/SDBM_File/sdbm/dbd.c @@ -14,8 +14,7 @@ extern void oops(); #define empty(page) (((short *) page)[0] == 0) int -main(argc, argv) -char **argv; +main(int argc, char **argv) { int n; char *p; @@ -42,8 +41,8 @@ char **argv; return 0; } -sdump(pagf) -int pagf; +void +sdump(int pagf) { register r; register n = 0; @@ -68,8 +67,8 @@ int pagf; #ifdef OLD -dispage(pag) -char *pag; +int +dispage(char *pag) { register i, n; register off; @@ -90,8 +89,8 @@ char *pag; } } #else -dispage(pag) -char *pag; +void +dispage(char *pag) { register i, n; register off; diff --git a/ext/SDBM_File/sdbm/dbe.c b/ext/SDBM_File/sdbm/dbe.c index 9f44180..166e64e 100644 --- a/ext/SDBM_File/sdbm/dbe.c +++ b/ext/SDBM_File/sdbm/dbe.c @@ -52,10 +52,7 @@ char *optarg; /* Global argument pointer. */ #endif char -getopt(argc, argv, optstring) -int argc; -char **argv; -char *optstring; +getopt(int argc, char **argv, char *optstring) { register int c; register char *place; @@ -131,8 +128,7 @@ char *optstring; void -print_datum(db) -datum db; +print_datum(datum db) { int i; @@ -152,8 +148,7 @@ datum db; datum -read_datum(s) -char *s; +read_datum(char *s) { datum db; char *p; @@ -197,8 +192,7 @@ char *s; char * -key2s(db) -datum db; +key2s(datum db) { char *buf; char *p1, *p2; @@ -211,10 +205,8 @@ datum db; return buf; } - -main(argc, argv) -int argc; -char **argv; +int +main(int argc, char **argv) { typedef enum { YOW, FETCH, STORE, DELETE, SCAN, REGEXP diff --git a/ext/SDBM_File/sdbm/dbm.c b/ext/SDBM_File/sdbm/dbm.c index 1388230..dc47d70 100644 --- a/ext/SDBM_File/sdbm/dbm.c +++ b/ext/SDBM_File/sdbm/dbm.c @@ -27,8 +27,8 @@ static DBM *cur_db = NODB; static char no_db[] = "dbm: no open database\n"; -dbminit(file) - char *file; +int +dbminit(char *file) { if (cur_db != NODB) dbm_close(cur_db); @@ -43,8 +43,7 @@ dbminit(file) } long -forder(key) -datum key; +forder(datum key) { if (cur_db == NODB) { printf(no_db); @@ -54,8 +53,7 @@ datum key; } datum -fetch(key) -datum key; +fetch(datum key) { datum item; @@ -67,8 +65,8 @@ datum key; return (dbm_fetch(cur_db, key)); } -delete(key) -datum key; +int +delete(datum key) { if (cur_db == NODB) { printf(no_db); @@ -79,8 +77,8 @@ datum key; return (dbm_delete(cur_db, key)); } -store(key, dat) -datum key, dat; +int +store(datum key, datum dat) { if (cur_db == NODB) { printf(no_db); @@ -93,7 +91,7 @@ datum key, dat; } datum -firstkey() +firstkey(void) { datum item; @@ -106,8 +104,7 @@ firstkey() } datum -nextkey(key) -datum key; +nextkey(datum key) { datum item; diff --git a/ext/SDBM_File/sdbm/dbu.c b/ext/SDBM_File/sdbm/dbu.c index a3c0004..e68b78d 100644 --- a/ext/SDBM_File/sdbm/dbu.c +++ b/ext/SDBM_File/sdbm/dbu.c @@ -65,9 +65,7 @@ static cmd *parse(); static void badk(), doit(), prdatum(); int -main(argc, argv) -int argc; -char *argv[]; +main(int argc, char **argv) { int c; register cmd *act; @@ -98,9 +96,7 @@ char *argv[]; } static void -doit(act, file) -register cmd *act; -char *file; +doit(register cmd *act, char *file) { datum key; datum val; @@ -197,8 +193,7 @@ char *file; } static void -badk(word) -char *word; +badk(char *word) { register int i; @@ -214,8 +209,7 @@ char *word; } static cmd * -parse(str) -register char *str; +parse(register char *str) { register int i = CTABSIZ; register cmd *p; @@ -227,9 +221,7 @@ register char *str; } static void -prdatum(stream, d) -FILE *stream; -datum d; +prdatum(FILE *stream, datum d) { register int c; register char *p = d.dptr; diff --git a/mg.c b/mg.c index adfad7d..0f9710c 100644 --- a/mg.c +++ b/mg.c @@ -434,8 +434,7 @@ magic_len(SV *sv, MAGIC *mg) #if 0 static char * -printW(sv) -SV * sv ; +printW(SV *sv) { #if 1 return "" ; diff --git a/op.c b/op.c index 3914245..88cc607 100644 --- a/op.c +++ b/op.c @@ -3638,8 +3638,7 @@ cv_undef(CV *cv) #ifdef DEBUG_CLOSURES STATIC void -cv_dump(cv) -CV* cv; +cv_dump(CV *cv) { CV *outside = CvOUTSIDE(cv); AV* padlist = CvPADLIST(cv); diff --git a/pp_ctl.c b/pp_ctl.c index 9e78a31..44c2b52 100644 --- a/pp_ctl.c +++ b/pp_ctl.c @@ -3591,10 +3591,7 @@ STATIC void #ifdef PERL_OBJECT qsortsv(SV ** array, size_t num_elts, SVCOMPARE compare) #else -qsortsv( - SV ** array, - size_t num_elts, - I32 (*compare)(SV *a, SV *b)) +qsortsv(SV ** array, size_t num_elts, I32 (*compare)(SV *a, SV *b)) #endif { register SV * temp; diff --git a/pp_sys.c b/pp_sys.c index 1d1c849..c5344df 100644 --- a/pp_sys.c +++ b/pp_sys.c @@ -228,7 +228,8 @@ static char zero_but_true[ZBTLEN + 1] = "0 but true"; || defined(HAS_SETREGID) || defined(HAS_SETRESGID)) /* The Hard Way. */ STATIC int -emulate_eaccess (const char* path, int mode) { +emulate_eaccess (const char* path, int mode) +{ Uid_t ruid = getuid(); Uid_t euid = geteuid(); Gid_t rgid = getgid(); @@ -292,7 +293,8 @@ emulate_eaccess (const char* path, int mode) { #if !defined(PERL_EFF_ACCESS_R_OK) STATIC int -emulate_eaccess (const char* path, int mode) { +emulate_eaccess (const char* path, int mode) +{ croak("switching effective uid is not implemented"); /*NOTREACHED*/ return -1; @@ -3173,10 +3175,8 @@ PP(pp_readlink) } #if !defined(HAS_MKDIR) || !defined(HAS_RMDIR) -static int -dooneliner(cmd, filename) -char *cmd; -char *filename; +STATIC int +dooneliner(char *cmd, char *filename) { char *save_filename = filename; char *cmdline; @@ -4958,10 +4958,8 @@ fcntl_emulate_flock(int fd, int operation) # define F_TEST 3 /* Test a region for other processes locks */ # endif -static int -lockf_emulate_flock (fd, operation) -int fd; -int operation; +STATIC int +lockf_emulate_flock (int fd, int operation) { int i; int save_errno; diff --git a/sv.c b/sv.c index d616b8e..9cec787 100644 --- a/sv.c +++ b/sv.c @@ -116,9 +116,8 @@ static I32 registry_size; #define REG_ADD(sv) REG_REPLACE(sv,Nullsv,sv) #define REG_REMOVE(sv) REG_REPLACE(sv,sv,Nullsv) -static void -reg_add(sv) -SV* sv; +STATIC void +reg_add(SV *sv) { if (PL_sv_count >= (registry_size >> 1)) { @@ -144,17 +143,15 @@ SV* sv; ++PL_sv_count; } -static void -reg_remove(sv) -SV* sv; +STATIC void +reg_remove(SV *sv) { REG_REMOVE(sv); --PL_sv_count; } -static void -visit(f) -SVFUNC f; +STATIC void +visit(SVFUNC f) { I32 i; @@ -166,10 +163,7 @@ SVFUNC f; } void -sv_add_arena(ptr, size, flags) -char* ptr; -U32 size; -U32 flags; +sv_add_arena(char *ptr, U32 size, U32 flags) { if (!(flags & SVf_FAKE)) Safefree(ptr); diff --git a/toke.c b/toke.c index 1ac96a1..bde8092 100644 --- a/toke.c +++ b/toke.c @@ -504,7 +504,8 @@ skipspace(register char *s) } STATIC void -check_uni(void) { +check_uni(void) +{ char *s; char ch; char *t; diff --git a/util.c b/util.c index 0c2b052..1fcc82b 100644 --- a/util.c +++ b/util.c @@ -1797,8 +1797,7 @@ setenv_getix(char *nam) #ifdef UNLINK_ALL_VERSIONS I32 -unlnk(f) /* unlink all versions of a file */ -char *f; +unlnk(char *f) /* unlink all versions of a file */ { I32 i; @@ -1983,8 +1982,7 @@ my_ntohl(long l) #define HTOV(name,type) \ type \ - name (n) \ - register type n; \ + name (register type n) \ { \ union { \ type value; \ @@ -2000,8 +1998,7 @@ my_ntohl(long l) #define VTOH(name,type) \ type \ - name (n) \ - register type n; \ + name (register type n) \ { \ union { \ type value; \ @@ -2183,9 +2180,7 @@ dump_fds(char *s) #ifndef HAS_DUP2 int -dup2(oldfd,newfd) -int oldfd; -int newfd; +dup2(int oldfd, int newfd) { #if defined(HAS_FCNTL) && defined(F_DUPFD) if (oldfd == newfd) @@ -2457,12 +2452,11 @@ int pclose(); #ifdef HAS_FORK int /* Cannot prototype with I32 in os2ish.h. */ -my_syspclose(ptr) +my_syspclose(PerlIO *ptr) #else I32 -my_pclose(ptr) +my_pclose(PerlIO *ptr) #endif -PerlIO *ptr; { /* Needs work for PerlIO ! */ FILE *f = PerlIO_findFILE(ptr); diff --git a/win32/win32.c b/win32/win32.c index 3bf6bc6..49a487e 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -127,12 +127,14 @@ static char crypt_buffer[30]; #endif int -IsWin95(void) { +IsWin95(void) +{ return (os_id() == VER_PLATFORM_WIN32_WINDOWS); } int -IsWinNT(void) { +IsWinNT(void) +{ return (os_id() == VER_PLATFORM_WIN32_NT); } diff --git a/x2p/hash.c b/x2p/hash.c index f11f7df..77b9ad8 100644 --- a/x2p/hash.c +++ b/x2p/hash.c @@ -89,9 +89,7 @@ hstore(register HASH *tb, char *key, STR *val) #ifdef NOTUSED bool -hdelete(tb,key) -register HASH *tb; -char *key; +hdelete(register HASH *tb, char *key) { register char *s; register int i; @@ -178,8 +176,7 @@ hnew(void) } #ifdef NOTUSED -hshow(tb) -register HASH *tb; +hshow(register HASH *tb) { fprintf(stderr,"%5d %4d (%2d%%)\n", tb->tbl_max+1,