[Fwd: Patch for perl utf8-related bug]
Richard Hitt [Fri, 6 Dec 2002 16:47:42 +0000 (08:47 -0800)]
[perl #18932]

p4raw-id: //depot/perl@18312

embed.fnc
embed.h
global.sym
perl.h
proto.h
regcomp.c
scope.c
scope.h

index 00c6e94..c2bed8b 100644 (file)
--- a/embed.fnc
+++ b/embed.fnc
@@ -626,6 +626,7 @@ Ap  |void   |save_aelem     |AV* av|I32 idx|SV **sptr
 Ap     |I32    |save_alloc     |I32 size|I32 pad
 Ap     |void   |save_aptr      |AV** aptr
 Ap     |AV*    |save_ary       |GV* gv
+Ap     |void   |save_bool      |bool* boolp
 Ap     |void   |save_clearsv   |SV** svp
 Ap     |void   |save_delete    |HV* hv|char* key|I32 klen
 Ap     |void   |save_destructor|DESTRUCTORFUNC_NOCONTEXT_t f|void* p
diff --git a/embed.h b/embed.h
index 636dca9..34181b6 100644 (file)
--- a/embed.h
+++ b/embed.h
 #define save_alloc             Perl_save_alloc
 #define save_aptr              Perl_save_aptr
 #define save_ary               Perl_save_ary
+#define save_bool              Perl_save_bool
 #define save_clearsv           Perl_save_clearsv
 #define save_delete            Perl_save_delete
 #define save_destructor                Perl_save_destructor
 #define save_alloc(a,b)                Perl_save_alloc(aTHX_ a,b)
 #define save_aptr(a)           Perl_save_aptr(aTHX_ a)
 #define save_ary(a)            Perl_save_ary(aTHX_ a)
+#define save_bool(a)           Perl_save_bool(aTHX_ a)
 #define save_clearsv(a)                Perl_save_clearsv(aTHX_ a)
 #define save_delete(a,b,c)     Perl_save_delete(aTHX_ a,b,c)
 #define save_destructor(a,b)   Perl_save_destructor(aTHX_ a,b)
index 24f9e5c..9e3ddcd 100644 (file)
@@ -376,6 +376,7 @@ Perl_save_aelem
 Perl_save_alloc
 Perl_save_aptr
 Perl_save_ary
+Perl_save_bool
 Perl_save_clearsv
 Perl_save_delete
 Perl_save_destructor
diff --git a/perl.h b/perl.h
index bb2dc39..614d570 100644 (file)
--- a/perl.h
+++ b/perl.h
@@ -2173,6 +2173,7 @@ union any {
     I32                any_i32;
     IV         any_iv;
     long       any_long;
+    bool       any_bool;
     void       (*any_dptr) (void*);
     void       (*any_dxptr) (pTHX_ void*);
 };
diff --git a/proto.h b/proto.h
index 78841c2..182867d 100644 (file)
--- a/proto.h
+++ b/proto.h
@@ -661,6 +661,7 @@ PERL_CALLCONV void  Perl_save_aelem(pTHX_ AV* av, I32 idx, SV **sptr);
 PERL_CALLCONV I32      Perl_save_alloc(pTHX_ I32 size, I32 pad);
 PERL_CALLCONV void     Perl_save_aptr(pTHX_ AV** aptr);
 PERL_CALLCONV AV*      Perl_save_ary(pTHX_ GV* gv);
+PERL_CALLCONV void     Perl_save_bool(pTHX_ bool* boolp);
 PERL_CALLCONV void     Perl_save_clearsv(pTHX_ SV** svp);
 PERL_CALLCONV void     Perl_save_delete(pTHX_ HV* hv, char* key, I32 klen);
 PERL_CALLCONV void     Perl_save_destructor(pTHX_ DESTRUCTORFUNC_NOCONTEXT_t f, void* p);
index 4813261..20b6876 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -5058,7 +5058,7 @@ Perl_save_re_context(pTHX)
     SAVEVPTR(PL_reg_re);               /* from regexec.c */
     SAVEPPTR(PL_reg_ganch);            /* from regexec.c */
     SAVESPTR(PL_reg_sv);               /* from regexec.c */
-    SAVEI8(PL_reg_match_utf8);         /* from regexec.c */
+    SAVEBOOL(PL_reg_match_utf8);       /* from regexec.c */
     SAVEVPTR(PL_reg_magic);            /* from regexec.c */
     SAVEI32(PL_reg_oldpos);                    /* from regexec.c */
     SAVEVPTR(PL_reg_oldcurpm);         /* from regexec.c */
diff --git a/scope.c b/scope.c
index 8691057..0896bd4 100644 (file)
--- a/scope.c
+++ b/scope.c
@@ -391,6 +391,15 @@ Perl_save_long(pTHX_ long int *longp)
 }
 
 void
+Perl_save_bool(pTHX_ bool *boolp)
+{
+    SSCHECK(3);
+    SSPUSHBOOL(*boolp);
+    SSPUSHPTR(boolp);
+    SSPUSHINT(SAVEt_BOOL);
+}
+
+void
 Perl_save_I32(pTHX_ I32 *intp)
 {
     SSCHECK(3);
@@ -789,6 +798,10 @@ Perl_leave_scope(pTHX_ I32 base)
            ptr = SSPOPPTR;
            *(long*)ptr = (long)SSPOPLONG;
            break;
+       case SAVEt_BOOL:                        /* bool reference */
+           ptr = SSPOPPTR;
+           *(bool*)ptr = (bool)SSPOPBOOL;
+           break;
        case SAVEt_I32:                         /* I32 reference */
            ptr = SSPOPPTR;
            *(I32*)ptr = (I32)SSPOPINT;
diff --git a/scope.h b/scope.h
index b15e5f1..9a24ac9 100644 (file)
--- a/scope.h
+++ b/scope.h
@@ -45,6 +45,7 @@
 #define SAVEt_PADSV            35
 #define SAVEt_MORTALIZESV      36
 #define SAVEt_SHARED_PVREF     37
+#define SAVEt_BOOL             38
 
 #ifndef SCOPE_SAVES_SIGNAL_MASK
 #define SCOPE_SAVES_SIGNAL_MASK 0
 #define SSCHECK(need) if (PL_savestack_ix + need > PL_savestack_max) savestack_grow()
 #define SSPUSHINT(i) (PL_savestack[PL_savestack_ix++].any_i32 = (I32)(i))
 #define SSPUSHLONG(i) (PL_savestack[PL_savestack_ix++].any_long = (long)(i))
+#define SSPUSHBOOL(p) (PL_savestack[PL_savestack_ix++].any_bool = (p))
 #define SSPUSHIV(i) (PL_savestack[PL_savestack_ix++].any_iv = (IV)(i))
 #define SSPUSHPTR(p) (PL_savestack[PL_savestack_ix++].any_ptr = (void*)(p))
 #define SSPUSHDPTR(p) (PL_savestack[PL_savestack_ix++].any_dptr = (p))
 #define SSPUSHDXPTR(p) (PL_savestack[PL_savestack_ix++].any_dxptr = (p))
 #define SSPOPINT (PL_savestack[--PL_savestack_ix].any_i32)
 #define SSPOPLONG (PL_savestack[--PL_savestack_ix].any_long)
+#define SSPOPBOOL (PL_savestack[--PL_savestack_ix].any_bool)
 #define SSPOPIV (PL_savestack[--PL_savestack_ix].any_iv)
 #define SSPOPPTR (PL_savestack[--PL_savestack_ix].any_ptr)
 #define SSPOPDPTR (PL_savestack[--PL_savestack_ix].any_dptr)
@@ -116,6 +119,7 @@ Closing bracket on a callback.  See C<ENTER> and L<perlcall>.
 #define SAVEINT(i)     save_int(SOFT_CAST(int*)&(i))
 #define SAVEIV(i)      save_iv(SOFT_CAST(IV*)&(i))
 #define SAVELONG(l)    save_long(SOFT_CAST(long*)&(l))
+#define SAVEBOOL(b)    save_bool(SOFT_CAST(bool*)&(b))
 #define SAVESPTR(s)    save_sptr((SV**)&(s))
 #define SAVEPPTR(s)    save_pptr(SOFT_CAST(char**)&(s))
 #define SAVEVPTR(s)    save_vptr((void*)&(s))