Browse files

Made code C89 compliant

  • Loading branch information...
1 parent c5dd302 commit 622d0de79c21d5b47d29140a089a5b53b475f0d3 @Leont committed Apr 13, 2012
Showing with 6 additions and 3 deletions.
  1. +1 −0 Changes
  2. +5 −3 lib/PerlIO/text.xs
View
1 Changes
@@ -1,6 +1,7 @@
Revision history for PerlIO-text
{{$NEXT}}
+ Made code C89 compliant
0.006 2011-08-03 10:42:13 Europe/Amsterdam
Save errno sooner to avoid false negatives
View
8 lib/PerlIO/text.xs
@@ -5,23 +5,25 @@
#include "perliol.h"
static IV PerlIOText_pushed(pTHX_ PerlIO *f, const char *mode, SV *arg, PerlIO_funcs *tab) {
+ PerlIO_funcs *encoding, *crlf;
if (!arg || !SvOK(arg)) {
SETERRNO(EINVAL, LIB_INVARG);
return -1;
}
PerlIO_apply_layers(aTHX_ f, mode, ":raw");
- PerlIO_funcs* encoding = PerlIO_find_layer(aTHX_ "encoding", 8, 1);
+ encoding = PerlIO_find_layer(aTHX_ "encoding", 8, 1);
if (PerlIO_push(aTHX_ f, encoding, mode, arg) != f)
return -1;
#ifdef PERLIO_USING_CRLF
- PerlIO_funcs* crlf = PerlIO_find_layer(aTHX_ "crlf", 4, 0);
+ crlf = PerlIO_find_layer(aTHX_ "crlf", 4, 0);
if (PerlIO_push(aTHX_ f, crlf, mode, &PL_sv_undef) != f)
return -1;
#endif
return f ? 0 : -1;
}
static PerlIO* PerlIOText_open(pTHX_ PerlIO_funcs* self, PerlIO_list_t* layers, IV n, const char* mode, int fd, int imode, int perm, PerlIO* f, int narg, SV** args) {
+ PerlIO_funcs * tab;
#if defined(PERLIO_USING_CRLF) && PERL_VERSION < 14
/* This is to get around RT#38456 */
static int initialized = 0;
@@ -34,7 +36,7 @@ static PerlIO* PerlIOText_open(pTHX_ PerlIO_funcs* self, PerlIO_list_t* layers,
if (layers->array[n - 1].funcs == crlf)
layers->array[n - 1].funcs = perlio;
#endif
- PerlIO_funcs * const tab = PerlIO_layer_fetch(aTHX_ layers, n - 1, NULL);
+ tab = PerlIO_layer_fetch(aTHX_ layers, n - 1, NULL);
if (tab && tab->Open) {
PerlIO* ret = (*tab->Open)(aTHX_ tab, layers, n - 1, mode, fd, imode, perm, f, narg, args);
if (ret && PerlIO_push(aTHX_ ret, self, mode, PerlIOArg) == NULL) {

0 comments on commit 622d0de

Please sign in to comment.