The problem described in 20010514.031 still wasn't
[p5sagit/p5-mst-13.2.git] / perl.h
diff --git a/perl.h b/perl.h
index ab7a8e8..9f135b1 100644 (file)
--- a/perl.h
+++ b/perl.h
@@ -1028,6 +1028,13 @@ typedef struct perl_mstats perl_mstats_t;
 #undef UV
 #endif
 
+/* Configure gets this right but the UTS compiler gets it wrong.
+   -- Hal Morris <hom00@utsglobal.com> */
+#ifdef UTS
+#  undef  UVTYPE
+#  define UVTYPE unsigned
+#endif
+
 /*
     The IV type is supposed to be long enough to hold any integral
     value or a pointer.
@@ -1086,6 +1093,25 @@ typedef UVTYPE UV;
 #  endif
 #endif
 
+/*
+  I've tracked down a weird bug in Perl5.6.1 to the UTS compiler's
+  mishandling of MY_UV_MAX in util.c.  It is defined as
+    #ifndef MY_UV_MAX
+    #  define MY_UV_MAX ((UV)IV_MAX * (UV)2 + (UV)1)
+    #endif
+  The compiler handles {double floating point value} >= MY_UV_MAX as if
+  MY_UV_MAX were the signed integer -1.  In fact it will do the same
+  thing with (UV)(0xffffffff), in place of MY_UV_MAX, though 0xffffffff
+  *without* the typecast to UV works fine.
+
+  hom00@utsglobal.com (Hal Morris) 2001-05-02
+
+  */
+
+#ifdef UTS
+#  define MY_UV_MAX 0xffffffff 
+#endif
+
 #define IV_DIG (BIT_DIGITS(IVSIZE * 8))
 #define UV_DIG (BIT_DIGITS(UVSIZE * 8))
 
@@ -1842,10 +1868,12 @@ typedef pthread_key_t   perl_key;
 #endif
 
 /* This defines a way to flush all output buffers.  This may be a
- * performance issue, so we allow people to disable it.
+ * performance issue, so we allow people to disable it.  Also, if
+ * we are using stdio, there are broken implementations of fflush(NULL)
+ * out there, Solaris being the most prominent.
  */
 #ifndef PERL_FLUSHALL_FOR_CHILD
-# if defined(FFLUSH_NULL) || defined(USE_SFIO)
+# if defined(USE_PERLIO) || defined(FFLUSH_NULL) || defined(USE_SFIO)
 #  define PERL_FLUSHALL_FOR_CHILD      PerlIO_flush((PerlIO*)NULL)
 # else
 #  ifdef FFLUSH_ALL
@@ -2355,7 +2383,7 @@ END_EXTERN_C
 #  if defined(NeXT) || defined(__NeXT__) /* or whatever catches all NeXTs */
 char *crypt ();       /* Maybe more hosts will need the unprototyped version */
 #  else
-#    if !defined(WIN32)
+#    if !defined(WIN32) && !defined(VMS)
 char *crypt (const char*, const char*);
 #    endif /* !WIN32 */
 #  endif /* !NeXT && !__NeXT__ */
@@ -2812,7 +2840,6 @@ enum {            /* pass one of these to get_vtbl */
 #define HINT_FILETEST_ACCESS   0x00400000
 #define HINT_UTF8              0x00800000
 #define HINT_UTF8_DISTINCT     0x01000000
-#define HINT_RE_ASCIIR         0x02000000
 
 /* Various states of an input record separator SV (rs, nrs) */
 #define RsSNARF(sv)   (! SvOK(sv))
@@ -3334,7 +3361,7 @@ typedef struct am_table_short AMTS;
 
 #define IS_NUMERIC_RADIX(s)    \
        ((PL_hints & HINT_LOCALE) && \
-         PL_numeric_radix && memEQ(s, SvPVX(PL_numeric_radix), SvCUR(PL_numeric_radix)))
+         PL_numeric_radix_sv && memEQ(s, SvPVX(PL_numeric_radix_sv), SvCUR(PL_numeric_radix_sv)))
 
 #define STORE_NUMERIC_LOCAL_SET_STANDARD() \
        bool was_local = (PL_hints & HINT_LOCALE) && PL_numeric_local; \
@@ -3483,17 +3510,21 @@ typedef struct am_table_short AMTS;
  * nice_chunk and nice_chunk size need to be set
  * and queried under the protection of sv_mutex
  */
-#define offer_nice_chunk(chunk, chunk_size) do {       \
-       LOCK_SV_MUTEX;                                  \
-       if (!PL_nice_chunk) {                           \
-           PL_nice_chunk = (char*)(chunk);             \
-           PL_nice_chunk_size = (chunk_size);          \
-       }                                               \
-       else {                                          \
-           Safefree(chunk);                            \
-       }                                               \
-       UNLOCK_SV_MUTEX;                                \
-    } while (0)
+#define offer_nice_chunk(chunk, chunk_size) STMT_START {  \
+       void *new_chunk;                                   \
+       U32 new_chunk_size;                                \
+       LOCK_SV_MUTEX;                                     \
+       new_chunk = (void *)(chunk);                       \
+       new_chunk_size = (chunk_size);                     \
+       if (new_chunk_size > PL_nice_chunk_size) {         \
+           if (PL_nice_chunk) Safefree(PL_nice_chunk);    \
+           PL_nice_chunk = new_chunk;                     \
+           PL_nice_chunk_size = new_chunk_size;           \
+       } else {                                           \
+           Safefree(chunk);                               \
+       }                                                  \
+       UNLOCK_SV_MUTEX;                                   \
+   } STMT_END
 
 #ifdef HAS_SEM
 #   include <sys/ipc.h>
@@ -3554,6 +3585,9 @@ typedef struct am_table_short AMTS;
 #ifdef IAMSUID
 
 #ifdef I_SYS_STATVFS
+#   if defined(PERL_SCO) && !defined(_SVID3)
+#       define _SVID3
+#   endif
 #   include <sys/statvfs.h>     /* for f?statvfs() */
 #endif
 #ifdef I_SYS_MOUNT