Change 24733 by [EMAIL PROTECTED] on 2005/06/07 15:10:38

        Simplify the implementation of SvPV*nolen functions

Affected files ...

... //depot/perl/sv.c#874 edit
... //depot/perl/sv.h#197 edit

Differences ...

==== //depot/perl/sv.c#874 (text) ====
Index: perl/sv.c
--- perl/sv.c#873~24732~        Tue Jun  7 07:57:35 2005
+++ perl/sv.c   Tue Jun  7 08:10:38 2005
@@ -3328,8 +3328,7 @@
 char *
 Perl_sv_2pv_nolen(pTHX_ register SV *sv)
 {
-    STRLEN n_a;
-    return sv_2pv(sv, &n_a);
+    return sv_2pv(sv, 0);
 }
 
 /* uiv_2buf(): private routine for use by sv_2pv_flags(): print an IV or
@@ -3394,6 +3393,12 @@
     SV *tsv, *origsv;
     char tbuf[64];     /* Must fit sprintf/Gconvert of longest IV/NV */
     char *tmpbuf = tbuf;
+    STRLEN n_a;
+
+    if (!lp) {
+       /* Saves needing to do lots of if (!lp) checks below  */
+       lp = &n_a;
+    }
 
     if (!sv) {
        *lp = 0;
@@ -3728,8 +3733,7 @@
 char *
 Perl_sv_2pvbyte_nolen(pTHX_ register SV *sv)
 {
-    STRLEN n_a;
-    return sv_2pvbyte(sv, &n_a);
+    return sv_2pvbyte(sv, 0);
 }
 
 /*
@@ -3765,8 +3769,7 @@
 char *
 Perl_sv_2pvutf8_nolen(pTHX_ register SV *sv)
 {
-    STRLEN n_a;
-    return sv_2pvutf8(sv, &n_a);
+    return sv_2pvutf8(sv, 0);
 }
 
 /*

==== //depot/perl/sv.h#197 (text) ====
Index: perl/sv.h
--- perl/sv.h#196~24732~        Tue Jun  7 07:57:35 2005
+++ perl/sv.h   Tue Jun  7 08:10:38 2005
@@ -1222,7 +1222,7 @@
 
 #define SvPV_nolen(sv) \
     ((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \
-     ? SvPVX(sv) : sv_2pv_nolen(sv))
+     ? SvPVX(sv) : sv_2pv_flags(sv, 0, SV_GMAGIC))
 
 #define SvPV_nomg(sv, lp) SvPV_flags(sv, lp, 0)
 
@@ -1239,7 +1239,7 @@
 
 #define SvPVutf8_nolen(sv) \
     ((SvFLAGS(sv) & (SVf_POK|SVf_UTF8)) == (SVf_POK|SVf_UTF8)\
-     ? SvPVX(sv) : sv_2pvutf8_nolen(sv))
+     ? SvPVX(sv) : sv_2pvutf8(sv, 0))
 
 /* ----*/
 
@@ -1253,7 +1253,7 @@
 
 #define SvPVbyte_nolen(sv) \
     ((SvFLAGS(sv) & (SVf_POK|SVf_UTF8)) == (SVf_POK)\
-     ? SvPVX(sv) : sv_2pvbyte_nolen(sv))
+     ? SvPVX(sv) : sv_2pvbyte(sv, 0))
 
 
     
End of Patch.

Reply via email to