From: Doug MacEachern Date: Sun, 18 Feb 2001 13:08:04 +0000 (-0800) Subject: [patch] -Wall cleanup round 2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8063af025e8b11a3a92c708534a72a8c4fe60322;p=p5sagit%2Fp5-mst-13.2.git [patch] -Wall cleanup round 2 Message-ID: p4raw-id: //depot/perl@8837 --- diff --git a/ext/B/B.xs b/ext/B/B.xs index 25d69e9..fc97c43 100644 --- a/ext/B/B.xs +++ b/ext/B/B.xs @@ -582,11 +582,12 @@ char * OP_name(o) B::OP o CODE: - ST(0) = sv_newmortal(); - sv_setpv(ST(0), PL_op_name[o->op_type]); + RETVAL = PL_op_name[o->op_type]; + OUTPUT: + RETVAL -char * +void OP_ppaddr(o) B::OP o PREINIT: @@ -656,11 +657,12 @@ LISTOP_children(o) OP * kid = NO_INIT int i = NO_INIT CODE: - ST(0) = sv_newmortal(); i = 0; for (kid = o->op_first; kid; kid = kid->op_sibling) i++; - sv_setiv(ST(0), i); + RETVAL = i; + OUTPUT: + RETVAL #define PMOP_pmreplroot(o) o->op_pmreplroot #define PMOP_pmreplstart(o) o->op_pmreplstart @@ -1278,7 +1280,7 @@ HvARRAY(hv) I32 len; (void)hv_iterinit(hv); EXTEND(sp, HvKEYS(hv) * 2); - while (sv = hv_iternextsv(hv, &key, &len)) { + while ((sv = hv_iternextsv(hv, &key, &len))) { PUSHs(newSVpvn(key, len)); PUSHs(make_sv_object(aTHX_ sv_newmortal(), sv)); } diff --git a/ext/Data/Dumper/Dumper.xs b/ext/Data/Dumper/Dumper.xs index d3cf292..25e72b1 100644 --- a/ext/Data/Dumper/Dumper.xs +++ b/ext/Data/Dumper/Dumper.xs @@ -805,7 +805,7 @@ Data_Dumper_Dumpxs(href, ...) if ((svp = av_fetch(namesav, i, TRUE))) sv_setsv(name, *svp); else - SvOK_off(name); + (void)SvOK_off(name); if (SvOK(name)) { if ((SvPVX(name))[0] == '*') { diff --git a/ext/Devel/DProf/DProf.xs b/ext/Devel/DProf/DProf.xs index e75e732..aba6de9 100644 --- a/ext/Devel/DProf/DProf.xs +++ b/ext/Devel/DProf/DProf.xs @@ -276,10 +276,6 @@ prof_mark(pTHX_ opcode ptype) { struct tms t; clock_t realtime, rdelta, udelta, sdelta; - char *name, *pv; - char *hvname; - STRLEN len; - SV *sv; U32 id; SV *Sub = GvSV(PL_DBsub); /* name of current sub */ @@ -472,8 +468,6 @@ prof_record(pTHX) /* Now that we know the runtimes, fill them in at the recorded location -JH */ - clock_t r, u, s; - if (g_SAVE_STACK) { prof_dump_until(aTHX_ g_profstack_ix); } @@ -542,6 +536,7 @@ XS(XS_DB_sub) prof_mark(aTHX_ OP_ENTERSUB); PUSHMARK(ORIGMARK); perl_call_sv(INT2PTR(SV*,SvIV(Sub)), GIMME | G_NODEBUG); + PL_curstash = oldstash; prof_mark(aTHX_ OP_LEAVESUB); g_depth--; } diff --git a/ext/Devel/Peek/Peek.xs b/ext/Devel/Peek/Peek.xs index 312f5f8..1e48149 100644 --- a/ext/Devel/Peek/Peek.xs +++ b/ext/Devel/Peek/Peek.xs @@ -82,8 +82,6 @@ DeadCode(pTHX) } } else if (SvTYPE(pad[j]) >= SVt_PV && SvLEN(pad[j])) { - int db_len = SvLEN(pad[j]); - SV *db_sv = pad[j]; levels++; levelm += SvLEN(pad[j])/SvREFCNT(pad[j]); /* Dump(pad[j],4); */ @@ -383,7 +381,7 @@ PPCODE: # PPCODE needed since by default it is void -SV * +void SvREFCNT_dec(sv) SV * sv PPCODE: diff --git a/ext/Fcntl/Fcntl.xs b/ext/Fcntl/Fcntl.xs index 21029b2..db4bff4 100644 --- a/ext/Fcntl/Fcntl.xs +++ b/ext/Fcntl/Fcntl.xs @@ -33,13 +33,6 @@ --AD October 16, 1995 */ -static int -not_here(char *s) -{ - croak("%s not implemented on this architecture", s); - return -1; -} - static IV constant(char *name) { diff --git a/ext/File/Glob/Glob.xs b/ext/File/Glob/Glob.xs index e01ae7e..a21fe84 100644 --- a/ext/File/Glob/Glob.xs +++ b/ext/File/Glob/Glob.xs @@ -4,16 +4,9 @@ #include "bsd_glob.h" +/* XXX: need some thread awareness */ static int GLOB_ERROR = 0; -static int -not_here(char *s) -{ - croak("%s not implemented on this architecture", s); - return -1; -} - - static double constant(char *name, int arg) { diff --git a/ext/Filter/Util/Call/Call.xs b/ext/Filter/Util/Call/Call.xs index c8105d0..6f55c8a 100644 --- a/ext/Filter/Util/Call/Call.xs +++ b/ext/Filter/Util/Call/Call.xs @@ -63,7 +63,7 @@ filter_call(pTHX_ int idx, SV *buf_sv, int maxlen) while (1) { /* anything left from last time */ - if (n = SvCUR(my_sv)) { + if ((n = SvCUR(my_sv))) { out_ptr = SvPVX(my_sv) + BUF_OFFSET(my_sv) ; @@ -86,7 +86,7 @@ filter_call(pTHX_ int idx, SV *buf_sv, int maxlen) } else { /* want lines */ - if (p = ninstr(out_ptr, out_ptr + n - 1, nl, nl)) { + if ((p = ninstr(out_ptr, out_ptr + n - 1, nl, nl))) { sv_catpvn(buf_sv, out_ptr, p - out_ptr + 1); diff --git a/ext/GDBM_File/GDBM_File.xs b/ext/GDBM_File/GDBM_File.xs index b4d3b3d..01ee84f 100644 --- a/ext/GDBM_File/GDBM_File.xs +++ b/ext/GDBM_File/GDBM_File.xs @@ -42,12 +42,14 @@ typedef datum datum_value ; typedef void (*FATALFUNC)(); +#ifndef GDBM_FAST static int not_here(char *s) { croak("GDBM_File::%s not implemented on this architecture", s); return -1; } +#endif /* GDBM allocates the datum with system malloc() and expects the user * to free() it. So we either have to free() it immediately, or have @@ -214,7 +216,7 @@ gdbm_TIEHASH(dbtype, name, read_write, mode, fatal_func = (FATALFUNC)croak) GDBM_FILE dbp ; RETVAL = NULL ; - if (dbp = gdbm_open(name, GDBM_BLOCKSIZE, read_write, mode, fatal_func)) { + if ((dbp = gdbm_open(name, GDBM_BLOCKSIZE, read_write, mode, fatal_func))) { RETVAL = (GDBM_File)safemalloc(sizeof(GDBM_File_type)) ; Zero(RETVAL, 1, GDBM_File_type) ; RETVAL->dbp = dbp ; diff --git a/ext/IO/IO.xs b/ext/IO/IO.xs index 13b198c..942a799 100644 --- a/ext/IO/IO.xs +++ b/ext/IO/IO.xs @@ -136,7 +136,7 @@ io_blocking(InputStream f, int block) MODULE = IO PACKAGE = IO::Seekable PREFIX = f -SV * +void fgetpos(handle) InputStream handle CODE: @@ -188,7 +188,7 @@ fsetpos(handle, pos) MODULE = IO PACKAGE = IO::File PREFIX = f -SV * +void new_tmpfile(packname = "IO::File") char * packname PREINIT: diff --git a/ext/IPC/SysV/SysV.xs b/ext/IPC/SysV/SysV.xs index 4a10eb9..c7985f9 100644 --- a/ext/IPC/SysV/SysV.xs +++ b/ext/IPC/SysV/SysV.xs @@ -194,7 +194,7 @@ PPCODE: MODULE=IPC::SysV PACKAGE=IPC::SysV -int +void ftok(path, id) char * path int id @@ -206,7 +206,7 @@ ftok(path, id) DIE(aTHX_ PL_no_func, "ftok"); #endif -int +void SHMLBA() CODE: #ifdef SHMLBA @@ -436,7 +436,7 @@ BOOT: char *name; int i; - for(i = 0 ; name = IPC__SysV__const[i].n ; i++) { + for(i = 0 ; (name = IPC__SysV__const[i].n) ; i++) { newCONSTSUB(stash,name, newSViv(IPC__SysV__const[i].v)); } } diff --git a/ext/Opcode/Opcode.xs b/ext/Opcode/Opcode.xs index e294059..6c58312 100644 --- a/ext/Opcode/Opcode.xs +++ b/ext/Opcode/Opcode.xs @@ -346,7 +346,7 @@ PPCODE: void opset(...) CODE: - int i, j; + int i; SV *bitspec, *opset; char *bitmap; STRLEN len, on; diff --git a/ext/POSIX/POSIX.xs b/ext/POSIX/POSIX.xs index a81f044..87475fe 100644 --- a/ext/POSIX/POSIX.xs +++ b/ext/POSIX/POSIX.xs @@ -3172,7 +3172,7 @@ localeconv() #ifdef HAS_LOCALECONV struct lconv *lcbuf; RETVAL = newHV(); - if (lcbuf = localeconv()) { + if ((lcbuf = localeconv())) { /* the strings */ if (lcbuf->decimal_point && *lcbuf->decimal_point) hv_store(RETVAL, "decimal_point", 13, @@ -3516,7 +3516,7 @@ SysRet nice(incr) int incr -int +void pipe() PPCODE: int fds[2]; @@ -3559,7 +3559,7 @@ tcsetpgrp(fd, pgrp_id) int fd pid_t pgrp_id -int +void uname() PPCODE: #ifdef HAS_UNAME @@ -3693,7 +3693,7 @@ strtoul(str, base = 0) PUSHs(&PL_sv_undef); } -SV * +void strxfrm(src) SV * src CODE: @@ -3828,7 +3828,10 @@ mktime(sec, min, hour, mday, mon, year, wday = 0, yday = 0, isdst = 0) OUTPUT: RETVAL -char * +#XXX: if $xsubpp::WantOptimize is always the default +# sv_setpv(TARG, ...) could be used rather than +# ST(0) = sv_2mortal(newSVpv(...)) +void strftime(fmt, sec, min, hour, mday, mon, year, wday = -1, yday = -1, isdst = -1) char * fmt int sec diff --git a/ext/SDBM_File/SDBM_File.xs b/ext/SDBM_File/SDBM_File.xs index a4b9045..859730b 100644 --- a/ext/SDBM_File/SDBM_File.xs +++ b/ext/SDBM_File/SDBM_File.xs @@ -57,7 +57,7 @@ sdbm_TIEHASH(dbtype, filename, flags, mode) DBM * dbp ; RETVAL = NULL ; - if (dbp = sdbm_open(filename,flags,mode) ) { + if ((dbp = sdbm_open(filename,flags,mode))) { RETVAL = (SDBM_File)safemalloc(sizeof(SDBM_File_type)) ; Zero(RETVAL, 1, SDBM_File_type) ; RETVAL->dbp = dbp ;