This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perlapi: Remove per-thread section; move to real scns
[perl5.git] / vutil.h
diff --git a/vutil.h b/vutil.h
index e291408..61caf70 100644 (file)
--- a/vutil.h
+++ b/vutil.h
@@ -1,10 +1,6 @@
 /* This file is part of the "version" CPAN distribution.  Please avoid
    editing it in the perl core. */
 
-#ifndef PERL_CORE
-#  include "ppport.h"
-#endif
-
 /* The MUTABLE_*() macros cast pointers to the types shown, in such a way
  * (compiler permitting) that casting away const-ness will give a warning;
  * e.g.:
 #  else
 #    define MUTABLE_PTR(p) ((void *) (p))
 #  endif
+#endif
 
+#ifndef MUTABLE_AV
 #  define MUTABLE_AV(p)        ((AV *)MUTABLE_PTR(p))
+#endif
+#ifndef MUTABLE_CV
 #  define MUTABLE_CV(p)        ((CV *)MUTABLE_PTR(p))
+#endif
+#ifndef MUTABLE_GV
 #  define MUTABLE_GV(p)        ((GV *)MUTABLE_PTR(p))
+#endif
+#ifndef MUTABLE_HV
 #  define MUTABLE_HV(p)        ((HV *)MUTABLE_PTR(p))
+#endif
+#ifndef MUTABLE_IO
 #  define MUTABLE_IO(p)        ((IO *)MUTABLE_PTR(p))
+#endif
+#ifndef MUTABLE_SV
 #  define MUTABLE_SV(p)        ((SV *)MUTABLE_PTR(p))
 #endif
 
@@ -75,21 +83,12 @@ Perl_ck_warner(pTHX_ U32 err, const char* pat, ...)
 #  endif
 #endif
 
-#define PERL_VERSION_DECIMAL(r,v,s) (r*1000000 + v*1000 + s)
-#define PERL_DECIMAL_VERSION \
-       PERL_VERSION_DECIMAL(PERL_REVISION,PERL_VERSION,PERL_SUBVERSION)
-#define PERL_VERSION_LT(r,v,s) \
-       (PERL_DECIMAL_VERSION < PERL_VERSION_DECIMAL(r,v,s))
-#define PERL_VERSION_GE(r,v,s) \
-       (PERL_DECIMAL_VERSION >= PERL_VERSION_DECIMAL(r,v,s))
-
 #if PERL_VERSION_LT(5,15,4)
 #  define ISA_VERSION_OBJ(v) (sv_isobject(v) && sv_derived_from(v,"version"))
 #else
 #  define ISA_VERSION_OBJ(v) (sv_isobject(v) && sv_derived_from_pvn(v,"version",7,0))
 #endif
 
-
 #ifndef PERL_ARGS_ASSERT_CROAK_XS_USAGE
 #define PERL_ARGS_ASSERT_CROAK_XS_USAGE assert(cv); assert(params)
 
@@ -223,29 +222,43 @@ const char * Perl_prescan_version(pTHX_ const char *s, bool strict, const char**
 #endif
 
 
-#if PERL_VERSION_LT(5,19,0)
-# undef STORE_NUMERIC_LOCAL_SET_STANDARD
-# undef RESTORE_NUMERIC_LOCAL
-# ifdef USE_LOCALE
-#  define STORE_NUMERIC_LOCAL_SET_STANDARD()\
-       char *loc = savepv(setlocale(LC_NUMERIC, NULL)); \
-       SAVEFREEPV(loc); \
-       setlocale(LC_NUMERIC, "C");
-
-#  define RESTORE_NUMERIC_LOCAL()\
-       setlocale(LC_NUMERIC, loc);
-# else
-#  define STORE_NUMERIC_LOCAL_SET_STANDARD()
-#  define RESTORE_NUMERIC_LOCAL()
-# endif
+#if PERL_VERSION_LT(5,27,9)
+#  define LC_NUMERIC_LOCK(cond)
+#  define LC_NUMERIC_UNLOCK
+#  if PERL_VERSION_LT(5,19,0)
+#    undef STORE_LC_NUMERIC_SET_STANDARD
+#    undef RESTORE_LC_NUMERIC
+#    undef DECLARATION_FOR_LC_NUMERIC_MANIPULATION
+#    ifdef USE_LOCALE
+#      define DECLARATION_FOR_LC_NUMERIC_MANIPULATION char *loc
+#      define STORE_NUMERIC_SET_STANDARD()\
+        loc = savepv(setlocale(LC_NUMERIC, NULL));  \
+        SAVEFREEPV(loc); \
+        setlocale(LC_NUMERIC, "C");
+#      define RESTORE_LC_NUMERIC()\
+        setlocale(LC_NUMERIC, loc);
+#    else
+#      define DECLARATION_FOR_LC_NUMERIC_MANIPULATION
+#      define STORE_LC_NUMERIC_SET_STANDARD()
+#      define RESTORE_LC_NUMERIC()
+#    endif
+#  endif
 #endif
 
 #ifndef LOCK_NUMERIC_STANDARD
-#define LOCK_NUMERIC_STANDARD()
+#  define LOCK_NUMERIC_STANDARD()
 #endif
 
 #ifndef UNLOCK_NUMERIC_STANDARD
-#define UNLOCK_NUMERIC_STANDARD()
+#  define UNLOCK_NUMERIC_STANDARD()
+#endif
+
+/* The names of these changed in 5.28 */
+#ifndef LOCK_LC_NUMERIC_STANDARD
+#  define LOCK_LC_NUMERIC_STANDARD() LOCK_NUMERIC_STANDARD()
+#endif
+#ifndef UNLOCK_LC_NUMERIC_STANDARD
+#  define UNLOCK_LC_NUMERIC_STANDARD() UNLOCK_NUMERIC_STANDARD()
 #endif
 
 /* ex: set ro: */