Change 20957 by [EMAIL PROTECTED] on 2003/08/30 18:47:02

        Fewer naked char constants.

Affected files ...

... //depot/perl/doio.c#226 edit
... //depot/perl/perlio.c#239 edit
... //depot/perl/sv.h#146 edit

Differences ...

==== //depot/perl/doio.c#226 (text) ====
Index: perl/doio.c
--- perl/doio.c#225~20646~      Tue Aug 12 04:51:25 2003
+++ perl/doio.c Sat Aug 30 11:47:02 2003
@@ -179,7 +179,7 @@
                 (ismodifying & (O_CREAT|appendtrunc)))
                  TAINT_PROPER("sysopen");
        }
-       mode[ix++] = '#'; /* Marker to openn to use numeric "sysopen" */
+       mode[ix++] = IoTYPE_NUMERIC; /* Marker to openn to use numeric "sysopen" */
 
 #if defined(USE_64_BIT_RAWIO) && defined(O_LARGEFILE)
        rawmode |= O_LARGEFILE; /* Transparently largefiley. */
@@ -674,8 +674,8 @@
        if (IoTYPE(io) == IoTYPE_SOCKET
            || (IoTYPE(io) == IoTYPE_WRONLY && fd >= 0 && S_ISCHR(PL_statbuf.st_mode)) 
) {
            char *s = mode;
-           if (*s == 'I' || *s == '#')
-            s++;
+           if (*s == IoTYPE_IMPLICIT || *s == IoTYPE_NUMERIC)
+             s++;
            *s = 'w';
            if (!(IoOFP(io) = PerlIO_openn(aTHX_ type,s,fd,0,0,NULL,0,svp))) {
                PerlIO_close(fp);

==== //depot/perl/perlio.c#239 (text) ====
Index: perl/perlio.c
--- perl/perlio.c#238~20956~    Sat Aug 30 11:38:05 2003
+++ perl/perlio.c       Sat Aug 30 11:47:02 2003
@@ -288,7 +288,7 @@
            return PerlIO_tmpfile();
        else {
            char *name = SvPV_nolen(*args);
-           if (*mode == '#') {
+           if (*mode == IoTYPE_NUMERIC) {
                fd = PerlLIO_open3(name, imode, perm);
                if (fd >= 0)
                    return PerlIO_fdopen(fd, (char *) mode + 1);
@@ -1960,7 +1960,7 @@
     if (tab->Set_ptrcnt != NULL)
        l->flags |= PERLIO_F_FASTGETS;
     if (mode) {
-       if (*mode == '#' || *mode == 'I')
+       if (*mode == IoTYPE_NUMERIC || *mode == IoTYPE_IMPLICIT)
            mode++;
        switch (*mode++) {
        case 'r':
@@ -2276,7 +2276,7 @@
 PerlIOUnix_oflags(const char *mode)
 {
     int oflags = -1;
-    if (*mode == 'I' || *mode == '#')
+    if (*mode == IoTYPE_IMPLICIT || *mode == IoTYPE_NUMERIC)
        mode++;
     switch (*mode) {
     case 'r':
@@ -2408,7 +2408,7 @@
     }
     if (narg > 0) {
        char *path = SvPV_nolen(*args);
-       if (*mode == '#')
+       if (*mode == IoTYPE_NUMERIC)
            mode++;
        else {
            imode = PerlIOUnix_oflags(mode);
@@ -2419,7 +2419,7 @@
        }
     }
     if (fd >= 0) {
-       if (*mode == 'I')
+       if (*mode == IoTYPE_IMPLICIT)
            mode++;
        if (!f) {
            f = PerlIO_allocate(aTHX);
@@ -2707,7 +2707,7 @@
     else {
        if (narg > 0) {
            char *path = SvPV_nolen(*args);
-           if (*mode == '#') {
+           if (*mode == IoTYPE_NUMERIC) {
                mode++;
                fd = PerlLIO_open3(path, imode, perm);
            }
@@ -2743,7 +2743,7 @@
        if (fd >= 0) {
            FILE *stdio = NULL;
            int init = 0;
-           if (*mode == 'I') {
+           if (*mode == IoTYPE_IMPLICIT) {
                init = 1;
                mode++;
            }
@@ -3433,7 +3433,7 @@
     else {
        PerlIO_funcs *tab = PerlIO_layer_fetch(aTHX_ layers, n - 1, 
PerlIO_default_btm());
        int init = 0;
-       if (*mode == 'I') {
+       if (*mode == IoTYPE_IMPLICIT) {
            init = 1;
            /*
             * mode++;

==== //depot/perl/sv.h#146 (text) ====
Index: perl/sv.h
--- perl/sv.h#145~20941~        Fri Aug 29 22:37:13 2003
+++ perl/sv.h   Sat Aug 30 11:47:02 2003
@@ -788,14 +788,16 @@
 #define IoFLAGS(sv)    ((XPVIO*)  SvANY(sv))->xio_flags
 
 /* IoTYPE(sv) is a single character telling the type of I/O connection. */
-#define IoTYPE_RDONLY  '<'
-#define IoTYPE_WRONLY  '>'
-#define IoTYPE_RDWR    '+'
-#define IoTYPE_APPEND  'a'
-#define IoTYPE_PIPE    '|'
-#define IoTYPE_STD     '-'     /* stdin or stdout */
-#define IoTYPE_SOCKET  's'
-#define IoTYPE_CLOSED  ' '
+#define IoTYPE_RDONLY          '<'
+#define IoTYPE_WRONLY          '>'
+#define IoTYPE_RDWR            '+'
+#define IoTYPE_APPEND          'a'
+#define IoTYPE_PIPE            '|'
+#define IoTYPE_STD             '-'     /* stdin or stdout */
+#define IoTYPE_SOCKET          's'
+#define IoTYPE_CLOSED          ' '
+#define IoTYPE_IMPLICIT                'I'     /* stdin or stdout or stderr */
+#define IoTYPE_NUMERIC         '#'     /* fdopen */
 
 /*
 =for apidoc Am|bool|SvTAINTED|SV* sv
End of Patch.

Reply via email to