Inline regcomp.c:S_checkposixcc into its only caller
authorFather Chrysostomos <sprout@cpan.org>
Mon, 19 Nov 2012 00:11:20 +0000 (16:11 -0800)
committerFather Chrysostomos <sprout@cpan.org>
Mon, 19 Nov 2012 04:17:17 +0000 (20:17 -0800)
In the next commit, it will need to access other variables around its
call site.

embed.fnc
embed.h
proto.h
regcomp.c
t/lib/warnings/regcomp

index b0b1ce9..9fc591d 100644 (file)
--- a/embed.fnc
+++ b/embed.fnc
@@ -1982,7 +1982,6 @@ EsRn      |U32    |add_data       |NN struct RExC_state_t *pRExC_state|U32 n \
                                |NN const char *s
 rs     |void   |re_croak2      |NN const char* pat1|NN const char* pat2|...
 Es     |I32    |regpposixcc    |NN struct RExC_state_t *pRExC_state|I32 value
-Es     |void   |checkposixcc   |NN struct RExC_state_t *pRExC_state
 Es     |I32    |make_trie      |NN struct RExC_state_t *pRExC_state \
                                |NN regnode *startbranch|NN regnode *first \
                                |NN regnode *last|NN regnode *tail \
diff --git a/embed.h b/embed.h
index 2ecd3b3..de3b947 100644 (file)
--- a/embed.h
+++ b/embed.h
 #define add_cp_to_invlist(a,b) S_add_cp_to_invlist(aTHX_ a,b)
 #define add_data               S_add_data
 #define alloc_maybe_populate_EXACT(a,b,c,d,e)  S_alloc_maybe_populate_EXACT(aTHX_ a,b,c,d,e)
-#define checkposixcc(a)                S_checkposixcc(aTHX_ a)
 #define cl_and                 S_cl_and
 #define cl_anything            S_cl_anything
 #define cl_init                        S_cl_init
diff --git a/proto.h b/proto.h
index 3fd5447..ccde34d 100644 (file)
--- a/proto.h
+++ b/proto.h
@@ -6364,11 +6364,6 @@ PERL_STATIC_INLINE void  S_alloc_maybe_populate_EXACT(pTHX_ struct RExC_state_t *
 #define PERL_ARGS_ASSERT_ALLOC_MAYBE_POPULATE_EXACT    \
        assert(pRExC_state); assert(node); assert(flagp)
 
-STATIC void    S_checkposixcc(pTHX_ struct RExC_state_t *pRExC_state)
-                       __attribute__nonnull__(pTHX_1);
-#define PERL_ARGS_ASSERT_CHECKPOSIXCC  \
-       assert(pRExC_state)
-
 STATIC void    S_cl_and(struct regnode_charclass_class *cl, const struct regnode_charclass_class *and_with)
                        __attribute__nonnull__(1)
                        __attribute__nonnull__(2);
index 83e0530..831f8a9 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -11286,36 +11286,6 @@ S_regpposixcc(pTHX_ RExC_state_t *pRExC_state, I32 value)
     return namedclass;
 }
 
-STATIC void
-S_checkposixcc(pTHX_ RExC_state_t *pRExC_state)
-{
-    dVAR;
-
-    PERL_ARGS_ASSERT_CHECKPOSIXCC;
-
-    if (POSIXCC(UCHARAT(RExC_parse))) {
-       const char *s = RExC_parse;
-       const char  c = *s++;
-
-       while (isALNUM(*s))
-           s++;
-       if (*s && c == *s && s[1] == ']') {
-           ckWARN3reg(s+2,
-                      "POSIX syntax [%c %c] belongs inside character classes",
-                      c, c);
-
-           /* [[=foo=]] and [[.foo.]] are still future. */
-           if (POSIXCC_NOTYET(c)) {
-               /* adjust RExC_parse so the error shows after
-                  the class closes */
-               while (UCHARAT(RExC_parse) && UCHARAT(RExC_parse++) != ']')
-                   NOOP;
-               Simple_vFAIL3("POSIX syntax [%c %c] is reserved for future extensions", c, c);
-           }
-       }
-    }
-}
-
 /* Generate the code to add a full posix character <class> to the bracketed
  * character class given by <node>.  (<node> is needed only under locale rules)
  * destlist     is the inversion list for non-locale rules that this class is
@@ -11578,7 +11548,27 @@ S_regclass(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 depth)
     nextvalue = RExC_parse < RExC_end ? UCHARAT(RExC_parse) : 0;
 
     if (!SIZE_ONLY && POSIXCC(nextvalue))
-       checkposixcc(pRExC_state);
+    {
+       const char *s = RExC_parse;
+       const char  c = *s++;
+
+       while (isALNUM(*s))
+           s++;
+       if (*s && c == *s && s[1] == ']') {
+           ckWARN3reg(s+2,
+                      "POSIX syntax [%c %c] belongs inside character classes",
+                      c, c);
+
+           /* [[=foo=]] and [[.foo.]] are still future. */
+           if (POSIXCC_NOTYET(c)) {
+               /* adjust RExC_parse so the error shows after
+                  the class closes */
+               while (UCHARAT(RExC_parse) && UCHARAT(RExC_parse++) != ']')
+                   NOOP;
+               Simple_vFAIL3("POSIX syntax [%c %c] is reserved for future extensions", c, c);
+           }
+       }
+    }
 
     /* allow 1st char to be ] (allowing it to be - is dealt with later) */
     if (UCHARAT(RExC_parse) == ']')
index 15a658f..84d46fc 100644 (file)
   /%.127s/: Unrecognized escape \\%c passed through    [S_regatom] 
        $x = '\m' ; /$x/
 
-  POSIX syntax [%c %c] belongs inside character classes        [S_checkposixcc
+  POSIX syntax [%c %c] belongs inside character classes        [S_regclass
 
 
   Character class [:%.*s:] unknown     [S_regpposixcc]
 
-  Character class syntax [%c %c] belongs inside character classes [S_checkposixcc
+  Character class syntax [%c %c] belongs inside character classes [S_regclass
   
   /%.127s/: false [] range \"%*.*s\" in regexp [S_regclass]
 
@@ -76,7 +76,7 @@ Unescaped left brace in regex is deprecated, passed through in regex; marked by
 Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/a\b{ <-- HERE cde/ at - line 7.
 Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/a\B{ <-- HERE cde/ at - line 8.
 ########
-# regcomp.c [S_regpposixcc S_checkposixcc]
+# regcomp.c [S_regpposixcc S_regclass]
 #
 use warnings 'regexp' ;
 $_ = "" ;
@@ -89,7 +89,7 @@ EXPECT
 POSIX syntax [: :] belongs inside character classes in regex; marked by <-- HERE in m/[:alpha:] <-- HERE / at - line 5.
 POSIX syntax [: :] belongs inside character classes in regex; marked by <-- HERE in m/[:zog:] <-- HERE / at - line 6.
 ########
-# regcomp.c [S_checkposixcc]
+# regcomp.c [S_regclass]
 #
 use warnings 'regexp' ;
 $_ = "" ;