[PATCH] perlcommunity.pod: add information about OSDC.fr
[p5sagit/p5-mst-13.2.git] / regcomp.c
index 8881f41..eb5f12f 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -477,15 +477,15 @@ static const scan_data_t zero_scan_data =
 
 #define        ckWARNreg(loc,m) STMT_START {                                   \
     const IV offset = loc - RExC_precomp;                              \
-    Perl_ck_warner(aTHX_ packWARN(WARN_REGEXP), "%s" REPORT_LOCATION,  \
-           m, (int)offset, RExC_precomp, RExC_precomp + offset);       \
+    Perl_ck_warner(aTHX_ packWARN(WARN_REGEXP), m REPORT_LOCATION,     \
+           (int)offset, RExC_precomp, RExC_precomp + offset);          \
 } STMT_END
 
 #define        ckWARNregdep(loc,m) STMT_START {                                \
     const IV offset = loc - RExC_precomp;                              \
-    Perl_ck_warner(aTHX_ packWARN2(WARN_DEPRECATED, WARN_REGEXP),      \
-           "%s" REPORT_LOCATION,                                       \
-           m, (int)offset, RExC_precomp, RExC_precomp + offset);       \
+    Perl_ck_warner_d(aTHX_ packWARN2(WARN_DEPRECATED, WARN_REGEXP),    \
+           m REPORT_LOCATION,                                          \
+           (int)offset, RExC_precomp, RExC_precomp + offset);          \
 } STMT_END
 
 #define        ckWARN2reg(loc, m, a1) STMT_START {                             \
@@ -2833,13 +2833,18 @@ S_study_chunk(pTHX_ RExC_state_t *pRExC_state, regnode **scanp,
                                 }
                             } else {
 /* 
-    Currently we assume that the trie can handle unicode and ascii
-    matches fold cased matches. If this proves true then the following
-    define will prevent tries in this situation. 
-    
-    #define TRIE_TYPE_IS_SAFE (UTF || optype==EXACT)
-*/
+    Currently we do not believe that the trie logic can
+    handle case insensitive matching properly when the
+    pattern is not unicode (thus forcing unicode semantics).
+
+    If/when this is fixed the following define can be swapped
+    in below to fully enable trie logic.
+
 #define TRIE_TYPE_IS_SAFE 1
+
+*/
+#define TRIE_TYPE_IS_SAFE (UTF || optype==EXACT)
+
                                 if ( last && TRIE_TYPE_IS_SAFE ) {
                                     make_trie( pRExC_state, 
                                             startbranch, first, cur, tail, count, 
@@ -6696,13 +6701,13 @@ S_reg_namedseq(pTHX_ RExC_state_t *pRExC_state, UV *valuep, I32 *flagp)
         sv_name = newSVpvn(name, endbrace - name);
         
         if (!table || !(PL_hints & HINT_LOCALIZE_HH)) {
-            vFAIL2("Constant(\\N{%s}) unknown: "
+            vFAIL2("Constant(\\N{%" SVf "}) unknown: "
                   "(possibly a missing \"use charnames ...\")",
-                  SvPVX(sv_name));
+                  SVfARG(sv_name));
         }
         if (!cvp || !SvOK(*cvp)) { /* when $^H{charnames} = undef; */
-            vFAIL2("Constant(\\N{%s}): "
-                  "$^H{charnames} is not defined",SvPVX(sv_name));
+            vFAIL2("Constant(\\N{%" SVf "}): "
+                  "$^H{charnames} is not defined", SVfARG(sv_name));
         }
         
         
@@ -6741,8 +6746,8 @@ S_reg_namedseq(pTHX_ RExC_state_t *pRExC_state, UV *valuep, I32 *flagp)
             LEAVE ;
             
             if ( !sv_str || !SvOK(sv_str) ) {
-                vFAIL2("Constant(\\N{%s}): Call to &{$^H{charnames}} "
-                      "did not return a defined value",SvPVX(sv_name));
+                vFAIL2("Constant(\\N{%" SVf "}): Call to &{$^H{charnames}} "
+                      "did not return a defined value", SVfARG(sv_name));
             }
             if (hv_store_ent( RExC_charnames, sv_name, sv_str, 0))
                 cached = 1;
@@ -6775,14 +6780,14 @@ S_reg_namedseq(pTHX_ RExC_state_t *pRExC_state, UV *valuep, I32 *flagp)
             }
             if (numlen<len && SIZE_ONLY) {
                 ckWARN2reg(RExC_parse,
-                          "Ignoring excess chars from \\N{%s} in character class",
-                          SvPVX(sv_name)
+                          "Ignoring excess chars from \\N{%" SVf "} in character class",
+                          SVfARG(sv_name)
                 );
             }        
         } else if (SIZE_ONLY) {
             ckWARN2reg(RExC_parse,
-                      "Ignoring zero length \\N{%s} in character class",
-                      SvPVX(sv_name)
+                      "Ignoring zero length \\N{%" SVf "} in character class",
+                      SVfARG(sv_name)
                 );
         }
         if (sv_name)    
@@ -9442,15 +9447,18 @@ Perl_pregfree2(pTHX_ REGEXP *rx)
     
     
 REGEXP *
-Perl_reg_temp_copy (pTHX_ REGEXP *rx)
+Perl_reg_temp_copy (pTHX_ REGEXP *ret_x, REGEXP *rx)
 {
-    REGEXP *ret_x = (REGEXP*) newSV_type(SVt_REGEXP);
-    struct regexp *ret = (struct regexp *)SvANY(ret_x);
+    struct regexp *ret;
     struct regexp *const r = (struct regexp *)SvANY(rx);
     register const I32 npar = r->nparens+1;
 
     PERL_ARGS_ASSERT_REG_TEMP_COPY;
 
+    if (!ret_x)
+       ret_x = (REGEXP*) newSV_type(SVt_REGEXP);
+    ret = (struct regexp *)SvANY(ret_x);
+    
     (void)ReREFCNT_inc(rx);
     /* We can take advantage of the existing "copied buffer" mechanism in SVs
        by pointing directly at the buffer, but flagging that the allocated