X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=perlio.c;h=df4ddc0e8a61f60671db826eb9bf11c23a2d4138;hb=89e33a0587050e7ef2e88ba45c87444d8506f821;hp=dae7f9bc890917e89c937dd9c1a46e51dbc5161f;hpb=954fb84efff0b08c3cc7311c30925dbc511e7c11;p=p5sagit%2Fp5-mst-13.2.git diff --git a/perlio.c b/perlio.c index dae7f9b..df4ddc0 100644 --- a/perlio.c +++ b/perlio.c @@ -163,6 +163,9 @@ perlsio_binmode(FILE *fp, int iotype, int mode) else return 0; # else + (void)fp; + (void)iotype; + (void)mode; return 1; # endif #endif @@ -245,6 +248,9 @@ int PerlIO_binmode(pTHX_ PerlIO *fp, int iotype, int mode, const char *names) { #ifdef USE_SFIO + (void)iotype; + (void)mode; + (void)names; return 1; #else return perlsio_binmode(fp, iotype, mode); @@ -264,7 +270,7 @@ PerlIO_fdupopen(pTHX_ PerlIO *f, CLONE_PARAMS *param, int flags) return win32_fdupopen(f); #else if (f) { - int fd = PerlLIO_dup(PerlIO_fileno(f)); + const int fd = PerlLIO_dup(PerlIO_fileno(f)); if (fd >= 0) { char mode[8]; int omode = fcntl(fd, F_GETFL); @@ -302,7 +308,7 @@ PerlIO_openn(pTHX_ const char *layers, const char *mode, int fd, if (*args == &PL_sv_undef) return PerlIO_tmpfile(); else { - const char *name = SvPV_nolen(*args); + const char *name = SvPV_nolen_const(*args); if (*mode == IoTYPE_NUMERIC) { fd = PerlLIO_open3(name, imode, perm); if (fd >= 0) @@ -328,7 +334,7 @@ XS(XS_PerlIO__Layer__find) if (items < 2) Perl_croak(aTHX_ "Usage class->find(name[,load])"); else { - const char *name = SvPV_nolen(ST(1)); + const char *name = SvPV_nolen_const(ST(1)); ST(0) = (strEQ(name, "crlf") || strEQ(name, "raw")) ? &PL_sv_yes : &PL_sv_undef; XSRETURN(1); @@ -478,7 +484,7 @@ PerlIO_debug(const char *fmt, ...) (IV) CopLINE(PL_curcop)); Perl_sv_vcatpvf(aTHX_ sv, fmt, &ap); - s = SvPV(sv, len); + s = SvPV_const(sv, len); PerlLIO_write(PL_perlio_debug_fd, s, len); SvREFCNT_dec(sv); #endif @@ -756,7 +762,8 @@ PerlIO_find_layer(pTHX_ const char *name, STRLEN len, int load) ENTER; SAVEINT(PL_in_load_module); if (cv) { - SAVESPTR(PL_warnhook); + SAVEGENERICSV(PL_warnhook); + (void)SvREFCNT_inc(cv); PL_warnhook = (SV *) cv; } PL_in_load_module++; @@ -837,7 +844,7 @@ XS(XS_io_MODIFY_SCALAR_ATTRIBUTES) Perl_warn(aTHX_ "attrib %" SVf, sv); for (i = 2; i < items; i++) { STRLEN len; - const char *name = SvPV(ST(i), len); + const char *name = SvPV_const(ST(i), len); SV *layer = PerlIO_find_layer(aTHX_ name, len, 1); if (layer) { av_push(av, SvREFCNT_inc(layer)); @@ -861,25 +868,25 @@ PerlIO_tab_sv(pTHX_ PerlIO_funcs *tab) return sv; } -static XS(XS_PerlIO__Layer__NoWarnings) +XS(XS_PerlIO__Layer__NoWarnings) { /* This is used as a %SIG{__WARN__} handler to supress warnings during loading of layers. */ dXSARGS; if (items) - PerlIO_debug("warning:%s\n",SvPV_nolen(ST(0))); + PerlIO_debug("warning:%s\n",SvPV_nolen_const(ST(0))); XSRETURN(0); } -static XS(XS_PerlIO__Layer__find) +XS(XS_PerlIO__Layer__find) { dXSARGS; if (items < 2) Perl_croak(aTHX_ "Usage class->find(name[,load])"); else { STRLEN len; - const char *name = SvPV(ST(1), len); + const char *name = SvPV_const(ST(1), len); const bool load = (items > 2) ? SvTRUE(ST(2)) : 0; PerlIO_funcs *layer = PerlIO_find_layer(aTHX_ name, len, load); ST(0) = @@ -1153,7 +1160,7 @@ PerlIO_push(pTHX_ PerlIO *f, PERLIO_FUNCS_DECL(*tab), const char *mode, SV *arg) Perl_croak(aTHX_ "Layer does not match this perl"); } if (tab->size) { - PerlIOl *l = NULL; + PerlIOl *l; if (tab->size < sizeof(PerlIOl)) { goto mismatch; } @@ -1381,7 +1388,7 @@ PerlIO_context_layers(pTHX_ const char *mode) SV *layers = PL_curcop->cop_io; if (layers) { STRLEN len; - type = SvPV(layers, len); + type = SvPV_const(layers, len); if (type && mode[0] != 'r') { /* * Skip to write part @@ -2436,7 +2443,7 @@ PerlIOUnix_open(pTHX_ PerlIO_funcs *self, PerlIO_list_t *layers, perm = 0666; } if (imode != -1) { - const char *path = SvPV_nolen(*args); + const char *path = SvPV_nolen_const(*args); fd = PerlLIO_open3(path, imode, perm); } } @@ -2500,7 +2507,7 @@ PerlIOUnix_read(pTHX_ PerlIO *f, void *vbuf, Size_t count) return 0; } while (1) { - SSize_t len = PerlLIO_read(fd, vbuf, count); + const SSize_t len = PerlLIO_read(fd, vbuf, count); if (len >= 0 || errno != EINTR) { if (len < 0) { if (errno != EAGAIN) { @@ -2515,6 +2522,7 @@ PerlIOUnix_read(pTHX_ PerlIO *f, void *vbuf, Size_t count) } PERL_ASYNC_CHECK(); } + /*NOTREACHED*/ } SSize_t @@ -2724,7 +2732,7 @@ PerlIOStdio_open(pTHX_ PerlIO_funcs *self, PerlIO_list_t *layers, { char tmode[8]; if (PerlIOValid(f)) { - const char *path = SvPV_nolen(*args); + const char *path = SvPV_nolen_const(*args); PerlIOStdio *s = PerlIOSelf(f, PerlIOStdio); FILE *stdio; PerlIOUnix_refcnt_dec(fileno(s->stdio)); @@ -2738,7 +2746,7 @@ PerlIOStdio_open(pTHX_ PerlIO_funcs *self, PerlIO_list_t *layers, } else { if (narg > 0) { - const char *path = SvPV_nolen(*args); + const char *path = SvPV_nolen_const(*args); if (*mode == IoTYPE_NUMERIC) { mode++; fd = PerlLIO_open3(path, imode, perm); @@ -2939,6 +2947,7 @@ PerlIOStdio_invalidate_fileno(pTHX_ FILE *f) */ # error "Don't know how to set FILE.fileno on your platform" #endif + (void)f; return 0; # endif } @@ -4823,7 +4832,7 @@ PerlIO_vprintf(PerlIO *f, const char *fmt, va_list ap) { dTHX; SV *sv = newSVpvn("", 0); - char *s; + const char *s; STRLEN len; SSize_t wrote; #ifdef NEED_VA_COPY @@ -4833,7 +4842,7 @@ PerlIO_vprintf(PerlIO *f, const char *fmt, va_list ap) #else sv_vcatpvf(sv, fmt, &ap); #endif - s = SvPV(sv, len); + s = SvPV_const(sv, len); wrote = PerlIO_write(f, s, len); SvREFCNT_dec(sv); return wrote; @@ -4885,7 +4894,7 @@ PerlIO_tmpfile(void) f = PerlIO_fdopen(fd, "w+"); if (f) PerlIOBase(f)->flags |= PERLIO_F_TEMP; - PerlLIO_unlink(SvPVX(sv)); + PerlLIO_unlink(SvPVX_const(sv)); SvREFCNT_dec(sv); } # else /* !HAS_MKSTEMP, fallback to stdio tmpfile(). */ @@ -5033,3 +5042,13 @@ PerlIO_sprintf(char *s, int n, const char *fmt, ...) return result; } #endif + +/* + * Local variables: + * c-indentation-style: bsd + * c-basic-offset: 4 + * indent-tabs-mode: t + * End: + * + * ex: set ts=8 sts=4 sw=4 noet: + */