On OS X to use perl's malloc need to USE_PERL_SBRK and emulate sbrk()
[p5sagit/p5-mst-13.2.git] / pp_pack.c
index 11a1ed6..a5e1c8e 100644 (file)
--- a/pp_pack.c
+++ b/pp_pack.c
@@ -1159,9 +1159,9 @@ I32
 Perl_unpack_str(pTHX_ const char *pat, const char *patend, const char *s, const char *strbeg, const char *strend, char **new_s, I32 ocnt, U32 flags)
 {
     tempsym_t sym;
-    (void)strbeg;
-    (void)new_s;
-    (void)ocnt;
+    PERL_UNUSED_ARG(strbeg);
+    PERL_UNUSED_ARG(new_s);
+    PERL_UNUSED_ARG(ocnt);
 
     if (flags & FLAG_DO_UTF8) flags |= FLAG_WAS_UTF8;
     else if (need_utf8(pat, patend)) {
@@ -2399,8 +2399,8 @@ void
 Perl_pack_cat(pTHX_ SV *cat, const char *pat, const char *patend, register SV **beglist, SV **endlist, SV ***next_in_list, U32 flags)
 {
     tempsym_t sym;
-    (void)next_in_list;
-    (void)flags;
+    PERL_UNUSED_ARG(next_in_list);
+    PERL_UNUSED_ARG(flags);
 
     TEMPSYM_INIT(&sym, pat, patend, FLAG_PACK);
 
@@ -2832,14 +2832,14 @@ S_pack_rec(pTHX_ SV *cat, tempsym_t* symptr, SV **beglist, SV **endlist )
        }
        case 'B':
        case 'b': {
-           char *str, *end;
+           const char *str, *end;
            I32 l, field_len;
            U8 bits;
            bool utf8_source;
            U32 utf8_flags;
 
            fromstr = NEXTFROM;
-           str = SvPV(fromstr, fromlen);
+           str = SvPV_const(fromstr, fromlen);
            end = str + fromlen;
            if (DO_UTF8(fromstr)) {
                utf8_source = TRUE;
@@ -3388,7 +3388,7 @@ S_pack_rec(pTHX_ SV *cat, tempsym_t* symptr, SV **beglist, SV **endlist )
 
                  w_string:
                    /* Copy string and check for compliance */
-                   from = SvPV(fromstr, len);
+                   from = SvPV_const(fromstr, len);
                    if ((norm = is_an_int(from, len)) == NULL)
                        Perl_croak(aTHX_ "Can only compress unsigned integers in pack");
 
@@ -3601,7 +3601,8 @@ PP(pp_pack)
     dSP; dMARK; dORIGMARK; dTARGET;
     register SV *cat = TARG;
     STRLEN fromlen;
-    register const char *pat = SvPVx_const(*++MARK, fromlen);
+    SV *pat_sv = *++MARK;
+    register const char *pat = SvPV_const(pat_sv, fromlen);
     register const char *patend = pat + fromlen;
 
     MARK++;