summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2001-06-18 23:45:12 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2001-06-18 23:45:12 +0000
commitc46a0ec2e4dd739764813c48d759541d301ed265 (patch)
tree1165ff13bbf15360631c7e7c913c17aa0c2662f6 /ext
parentf6eb1a9681f0cdb7a59526670d656e4adf00188c (diff)
downloadperl-c46a0ec2e4dd739764813c48d759541d301ed265.tar.gz
gcc -Wall sweep.
p4raw-id: //depot/perl@10700
Diffstat (limited to 'ext')
-rw-r--r--ext/IO/IO.xs30
-rw-r--r--ext/Time/Piece/Piece.xs4
2 files changed, 23 insertions, 11 deletions
diff --git a/ext/IO/IO.xs b/ext/IO/IO.xs
index ef91a97792..6741905b7b 100644
--- a/ext/IO/IO.xs
+++ b/ext/IO/IO.xs
@@ -361,33 +361,47 @@ fflush(handle)
RETVAL
void
-setbuf(handle, buf)
+setbuf(handle, ...)
OutputStream handle
- char * buf = SvPOK(ST(1)) ? sv_grow(ST(1), BUFSIZ) : 0;
CODE:
if (handle)
#ifdef PERLIO_IS_STDIO
+ {
+ char *buf = items == 2 && SvPOK(ST(1)) ?
+ sv_grow(ST(1), BUFSIZ) : 0;
setbuf(handle, buf);
+ }
#else
not_here("IO::Handle::setbuf");
#endif
SysRet
-setvbuf(handle, buf, type, size)
- OutputStream handle
- char * buf = SvPOK(ST(1)) ? sv_grow(ST(1), SvIV(ST(3))) : 0;
- int type
- int size
+setvbuf(...)
CODE:
+ if (items != 4)
+ Perl_croak(aTHX_ "Usage: IO::Handle::setvbuf(handle, buf, type, size)");
#if defined(PERLIO_IS_STDIO) && defined(_IOFBF) && defined(HAS_SETVBUF)
+ {
+ OutputStream handle = 0;
+ char * buf = SvPOK(ST(1)) ? sv_grow(ST(1), SvIV(ST(3))) : 0;
+ int type;
+ int size;
+
+ if (items == 4) {
+ handle = IoOFP(sv_2io(ST(0)));
+ buf = SvPOK(ST(1)) ? sv_grow(ST(1), SvIV(ST(3))) : 0;
+ type = (int)SvIV(ST(2));
+ size = (int)SvIV(ST(3));
+ }
if (!handle) /* Try input stream. */
handle = IoIFP(sv_2io(ST(0)));
- if (handle)
+ if (items == 4 && handle)
RETVAL = setvbuf(handle, buf, type, size);
else {
RETVAL = -1;
errno = EINVAL;
}
+ }
#else
RETVAL = (SysRet) not_here("IO::Handle::setvbuf");
#endif
diff --git a/ext/Time/Piece/Piece.xs b/ext/Time/Piece/Piece.xs
index bae2d4c7bf..d888588dcb 100644
--- a/ext/Time/Piece/Piece.xs
+++ b/ext/Time/Piece/Piece.xs
@@ -32,9 +32,7 @@ __strftime(fmt, sec, min, hour, mday, mon, year, wday = -1, yday = -1, isdst = -
CODE:
#XXX: an sv_strftime() that can make use of the TARG would faster
buf = my_strftime(fmt, sec, min, hour, mday, mon, year, wday, yday, isdst);
- if (buf) {
- RETVAL = buf;
- }
+ RETVAL = buf;
OUTPUT:
RETVAL