This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
infnan: grok_infnan now needs context
authorJarkko Hietaniemi <jhi@iki.fi>
Tue, 27 Jan 2015 03:13:56 +0000 (22:13 -0500)
committerJarkko Hietaniemi <jhi@iki.fi>
Wed, 28 Jan 2015 11:52:33 +0000 (06:52 -0500)
embed.fnc
embed.h
numeric.c
proto.h

index 61049a9..41b0087 100644 (file)
--- a/embed.fnc
+++ b/embed.fnc
@@ -813,7 +813,7 @@ EMsPR       |char*|form_short_octal_warning|NN const char * const s  \
                                |const STRLEN len
 #endif
 Apd    |UV     |grok_hex       |NN const char* start|NN STRLEN* len_p|NN I32* flags|NULLOK NV *result
-Apdn   |int    |grok_infnan    |NN const char** sp|NN const char *send
+Apd    |int    |grok_infnan    |NN const char** sp|NN const char *send
 Apd    |int    |grok_number    |NN const char *pv|STRLEN len|NULLOK UV *valuep
 Apd    |int    |grok_number_flags|NN const char *pv|STRLEN len|NULLOK UV *valuep|U32 flags
 ApdR   |bool   |grok_numeric_radix|NN const char **sp|NN const char *send
diff --git a/embed.h b/embed.h
index 76a3029..15fa37e 100644 (file)
--- a/embed.h
+++ b/embed.h
 #define grok_atou              Perl_grok_atou
 #define grok_bin(a,b,c,d)      Perl_grok_bin(aTHX_ a,b,c,d)
 #define grok_hex(a,b,c,d)      Perl_grok_hex(aTHX_ a,b,c,d)
-#define grok_infnan            Perl_grok_infnan
+#define grok_infnan(a,b)       Perl_grok_infnan(aTHX_ a,b)
 #define grok_number(a,b,c)     Perl_grok_number(aTHX_ a,b,c)
 #define grok_number_flags(a,b,c,d)     Perl_grok_number_flags(aTHX_ a,b,c,d)
 #define grok_numeric_radix(a,b)        Perl_grok_numeric_radix(aTHX_ a,b)
index c1a2488..99186dc 100644 (file)
--- a/numeric.c
+++ b/numeric.c
@@ -569,7 +569,7 @@ zero is returned, and the *sp will not move.
 */
 
 int
-Perl_grok_infnan(const char** sp, const char* send)
+Perl_grok_infnan(pTHX_ const char** sp, const char* send)
 {
     const char* s = *sp;
     int flags = 0;
@@ -986,7 +986,7 @@ Perl_grok_number_flags(pTHX_ const char *pv, STRLEN len, UV *valuep, U32 flags)
   if ((s + 2 < send) && strchr("inqs#", toFOLD(*s))) {
       /* Really detect inf/nan. Start at d, not s, since the above
        * code might have already consumed the "1." or "1". */
-      int infnan = Perl_grok_infnan(&d, send);
+      int infnan = Perl_grok_infnan(aTHX_ &d, send);
       if ((infnan & IS_NUMBER_INFINITY)) {
           return (numtype | infnan); /* Keep sign for infinity. */
       }
@@ -1229,7 +1229,7 @@ Perl_my_atof(pTHX_ const char* s)
 }
 
 static char*
-S_my_atof_infnan(const char* s, bool negative, const char* send, NV* value)
+S_my_atof_infnan(pTHX_ const char* s, bool negative, const char* send, NV* value)
 {
     const char *p0 = negative ? s - 1 : s;
     const char *p = p0;
@@ -1384,7 +1384,7 @@ Perl_my_atof2(pTHX_ const char* orig, NV* value)
 
     {
         const char* endp;
-        if ((endp = S_my_atof_infnan(s, negative, send, value)))
+        if ((endp = S_my_atof_infnan(aTHX_ s, negative, send, value)))
             return (char*)endp;
     }
 
diff --git a/proto.h b/proto.h
index 9f68fac..ca280b5 100644 (file)
--- a/proto.h
+++ b/proto.h
@@ -1359,9 +1359,9 @@ PERL_CALLCONV UV  Perl_grok_hex(pTHX_ const char* start, STRLEN* len_p, I32* flag
 #define PERL_ARGS_ASSERT_GROK_HEX      \
        assert(start); assert(len_p); assert(flags)
 
-PERL_CALLCONV int      Perl_grok_infnan(const char** sp, const char *send)
-                       __attribute__nonnull__(1)
-                       __attribute__nonnull__(2);
+PERL_CALLCONV int      Perl_grok_infnan(pTHX_ const char** sp, const char *send)
+                       __attribute__nonnull__(pTHX_1)
+                       __attribute__nonnull__(pTHX_2);
 #define PERL_ARGS_ASSERT_GROK_INFNAN   \
        assert(sp); assert(send)