#define PERL_IN_PP_PACK_C
#include "perl.h"
+/* Types used by pack/unpack */
+typedef enum {
+ e_no_len, /* no length */
+ e_number, /* number, [] */
+ e_star /* asterisk */
+} howlen_t;
+
+typedef struct tempsym {
+ const char* patptr; /* current template char */
+ const char* patend; /* one after last char */
+ const char* grpbeg; /* 1st char of ()-group */
+ const char* grpend; /* end of ()-group */
+ I32 code; /* template code (!<>) */
+ I32 length; /* length/repeat count */
+ howlen_t howlen; /* how length is given */
+ int level; /* () nesting level */
+ U32 flags; /* /=4, comma=2, pack=1 */
+ /* and group modifiers */
+ STRLEN strbeg; /* offset of group start */
+ struct tempsym *previous; /* previous group */
+} tempsym_t;
+
+#define TEMPSYM_INIT(symptr, p, e, f) \
+ STMT_START { \
+ (symptr)->patptr = (p); \
+ (symptr)->patend = (e); \
+ (symptr)->grpbeg = NULL; \
+ (symptr)->grpend = NULL; \
+ (symptr)->grpend = NULL; \
+ (symptr)->code = 0; \
+ (symptr)->length = 0; \
+ (symptr)->howlen = 0; \
+ (symptr)->level = 0; \
+ (symptr)->flags = (f); \
+ (symptr)->strbeg = 0; \
+ (symptr)->previous = NULL; \
+ } STMT_END
+
#if PERL_VERSION >= 9
# define PERL_PACK_CAN_BYTEORDER
# define PERL_PACK_CAN_SHRIEKSIGN
STRLEN len;
char *s = SvPV(sv, len);
char *t;
- U32 i = 0;
if (!strnEQ(s, "0000", 4)) { /* need to grow sv */
SV *tmpNew = newSVpvn("0000000000", 10);
while (!*t) /* trailing '\0'? */
t--;
while (t > s) {
- i = ((*t - '0') << 7) + m;
+ const U32 i = ((*t - '0') << 7) + m;
*(t--) = '0' + (char)(i % 10);
m = (char)(i / 10);
}
#endif
STATIC U8
-uni_to_byte(pTHX_ char **s, const char *end, I32 datumtype)
+uni_to_byte(pTHX_ const char **s, const char *end, I32 datumtype)
{
UV val;
STRLEN retlen;
*(U8 *)(s)++)
STATIC bool
-uni_to_bytes(pTHX_ char **s, char *end, char *buf, int buf_len, I32 datumtype)
+uni_to_bytes(pTHX_ const char **s, const char *end, const char *buf, int buf_len, I32 datumtype)
{
UV val;
STRLEN retlen;
- char *from = *s;
+ const char *from = *s;
int bad = 0;
- U32 flags = ckWARN(WARN_UTF8) ?
+ const U32 flags = ckWARN(WARN_UTF8) ?
UTF8_CHECK_ONLY : (UTF8_CHECK_ONLY | UTF8_ALLOW_ANY);
for (;buf_len > 0; buf_len--) {
if (from >= end) return FALSE;
if (bad) {
if (bad & 1) {
/* Rewalk the string fragment while warning */
- char *ptr;
+ const char *ptr;
const int flags = ckWARN(WARN_UTF8) ? 0 : UTF8_ALLOW_ANY;
for (ptr = *s; ptr < from; ptr += UTF8SKIP(ptr)) {
if (ptr >= end) break;
}
STATIC bool
-next_uni_uu(pTHX_ char **s, const char *end, I32 *out)
+next_uni_uu(pTHX_ const char **s, const char *end, I32 *out)
{
UV val;
STRLEN retlen;
}
STATIC void
-bytes_to_uni(pTHX_ U8 *start, STRLEN len, char **dest) {
+bytes_to_uni(pTHX_ const U8 *start, STRLEN len, char **dest) {
U8 buffer[UTF8_MAXLEN];
- U8 *end = start + len;
+ const U8 *end = start + len;
char *d = *dest;
while (start < end) {
- int length =
+ const int length =
uvuni_to_utf8_flags(buffer, NATIVE_TO_UNI(*start), 0) - buffer;
switch(length) {
case 1:
#define PUSH_GROWING_BYTES(utf8, cat, start, cur, buf, in_len) \
STMT_START { \
- STRLEN glen = (in_len); \
+ const STRLEN glen = (in_len); \
STRLEN gl = glen; \
if (utf8) gl *= UTF8_EXPAND; \
if ((cur) + gl >= (start) + SvLEN(cat)) { \
#define PUSH_BYTE(utf8, s, byte) \
STMT_START { \
if (utf8) { \
- U8 au8 = (byte); \
+ const U8 au8 = (byte); \
bytes_to_uni(aTHX_ &au8, 1, &(s)); \
} else *(U8 *)(s)++ = (byte); \
} STMT_END
str += retlen; \
} STMT_END
+static const char *_action( const tempsym_t* symptr )
+{
+ return ( symptr->flags & FLAG_PACK ) ? "pack" : "unpack";
+}
+
/* Returns the sizeof() struct described by pat */
STATIC I32
S_measure_struct(pTHX_ tempsym_t* symptr)
while (next_symbol(symptr)) {
I32 len;
- int star, size;
+ int size;
switch (symptr->howlen) {
case e_star:
Perl_croak(aTHX_ "Within []-length '*' not allowed in %s",
- symptr->flags & FLAG_PACK ? "pack" : "unpack" );
+ _action( symptr ) );
break;
default:
/* e_no_len and e_number */
size = packprops[TYPE_NO_ENDIANNESS(symptr->code)] & PACK_SIZE_MASK;
if (!size) {
+ int star;
/* endianness doesn't influence the size of a type */
switch(TYPE_NO_ENDIANNESS(symptr->code)) {
default:
Perl_croak(aTHX_ "Invalid type '%c' in %s",
(int)TYPE_NO_MODIFIERS(symptr->code),
- symptr->flags & FLAG_PACK ? "pack" : "unpack" );
+ _action( symptr ) );
#ifdef PERL_PACK_CAN_SHRIEKSIGN
case '.' | TYPE_IS_SHRIEKING:
case '@' | TYPE_IS_SHRIEKING:
case 'u':
Perl_croak(aTHX_ "Within []-length '%c' not allowed in %s",
(int) TYPE_NO_MODIFIERS(symptr->code),
- symptr->flags & FLAG_PACK ? "pack" : "unpack" );
+ _action( symptr ) );
case '%':
size = 0;
break;
case 'X':
size = -1;
if (total < len)
- Perl_croak(aTHX_ "'X' outside of string in %s",
- symptr->flags & FLAG_PACK ? "pack" : "unpack" );
+ Perl_croak(aTHX_ "'X' outside of string in %s", _action( symptr ) );
break;
case 'x' | TYPE_IS_SHRIEKING:
if (!len) /* Avoid division by 0 */
/* locate matching closing parenthesis or bracket
* returns char pointer to char after match, or NULL
*/
-STATIC char *
-S_group_end(pTHX_ register char *patptr, register char *patend, char ender)
+STATIC const char *
+S_group_end(pTHX_ register const char *patptr, register const char *patend, char ender)
{
while (patptr < patend) {
- char c = *patptr++;
+ const char c = *patptr++;
if (isSPACE(c))
continue;
* Expects a pointer to the first digit and address of length variable
* Advances char pointer to 1st non-digit char and returns number
*/
-STATIC char *
-S_get_num(pTHX_ register char *patptr, I32 *lenptr )
+STATIC const char *
+S_get_num(pTHX_ register const char *patptr, I32 *lenptr )
{
I32 len = *patptr++ - '0';
while (isDIGIT(*patptr)) {
STATIC bool
S_next_symbol(pTHX_ tempsym_t* symptr )
{
- char* patptr = symptr->patptr;
- char* patend = symptr->patend;
+ const char* patptr = symptr->patptr;
+ const char* patend = symptr->patend;
const char *allowed = "";
symptr->flags &= ~FLAG_SLASH;
if (((symptr->flags & FLAG_COMMA) == 0) && ckWARN(WARN_UNPACK)){
symptr->flags |= FLAG_COMMA;
Perl_warner(aTHX_ packWARN(WARN_UNPACK),
- "Invalid type ',' in %s",
- symptr->flags & FLAG_PACK ? "pack" : "unpack" );
+ "Invalid type ',' in %s", _action( symptr ) );
}
continue;
}
if (code == '(') {
if( isDIGIT(*patptr) || *patptr == '*' || *patptr == '[' )
Perl_croak(aTHX_ "()-group starts with a count in %s",
- symptr->flags & FLAG_PACK ? "pack" : "unpack" );
+ _action( symptr ) );
symptr->grpbeg = patptr;
patptr = 1 + ( symptr->grpend = group_end(patptr, patend, ')') );
if( symptr->level >= MAX_SUB_TEMPLATE_LEVEL )
Perl_croak(aTHX_ "Too deeply nested ()-groups in %s",
- symptr->flags & FLAG_PACK ? "pack" : "unpack" );
+ _action( symptr ) );
}
/* look for group modifiers to inherit */
if (!strchr(allowed, TYPE_NO_MODIFIERS(code)))
Perl_croak(aTHX_ "'%c' allowed only after types %s in %s", *patptr,
- allowed, symptr->flags & FLAG_PACK ? "pack" : "unpack" );
+ allowed, _action( symptr ) );
if (TYPE_ENDIANNESS(code | modifier) == TYPE_ENDIANNESS_MASK)
Perl_croak(aTHX_ "Can't use both '<' and '>' after type '%c' in %s",
- (int) TYPE_NO_MODIFIERS(code),
- symptr->flags & FLAG_PACK ? "pack" : "unpack" );
+ (int) TYPE_NO_MODIFIERS(code), _action( symptr ) );
else if (TYPE_ENDIANNESS(code | modifier | inherited_modifiers) ==
TYPE_ENDIANNESS_MASK)
Perl_croak(aTHX_ "Can't use '%c' in a group with different byte-order in %s",
- *patptr, symptr->flags & FLAG_PACK ? "pack" : "unpack" );
+ *patptr, _action( symptr ) );
if (ckWARN(WARN_UNPACK)) {
if (code & modifier)
Perl_warner(aTHX_ packWARN(WARN_UNPACK),
"Duplicate modifier '%c' after '%c' in %s",
*patptr, (int) TYPE_NO_MODIFIERS(code),
- symptr->flags & FLAG_PACK ? "pack" : "unpack" );
+ _action( symptr ) );
}
code |= modifier;
symptr->howlen = e_star;
} else if (*patptr == '[') {
- char* lenptr = ++patptr;
+ const char* lenptr = ++patptr;
symptr->howlen = e_number;
patptr = group_end( patptr, patend, ']' ) + 1;
/* what kind of [] is it? */
lenptr = get_num( lenptr, &symptr->length );
if( *lenptr != ']' )
Perl_croak(aTHX_ "Malformed integer in [] in %s",
- symptr->flags & FLAG_PACK ? "pack" : "unpack");
+ _action( symptr ) );
} else {
tempsym_t savsym = *symptr;
symptr->patend = patptr-1;
if (patptr < patend &&
(isDIGIT(*patptr) || *patptr == '*' || *patptr == '['))
Perl_croak(aTHX_ "'/' does not take a repeat count in %s",
- symptr->flags & FLAG_PACK ? "pack" : "unpack" );
+ _action( symptr ) );
}
break;
}
version of the string. Users are advised to upgrade their pack string
themselves if they need to do a lot of unpacks like this on it
*/
+/* XXX These can be const */
STATIC bool
need_utf8(const char *pat, const char *patend)
{
while (pat < patend) {
if (pat[0] == '#') {
pat++;
- pat = (char *) memchr(pat, '\n', patend-pat);
+ pat = (const char *) memchr(pat, '\n', patend-pat);
if (!pat) return FALSE;
} else if (pat[0] == 'U') {
if (first || pat[1] == '0') return TRUE;
while (pat < patend) {
if (pat[0] != '#') return pat[0];
pat++;
- pat = (char *) memchr(pat, '\n', patend-pat);
+ pat = (const char *) memchr(pat, '\n', patend-pat);
if (!pat) return 0;
pat++;
}
=cut */
I32
-Perl_unpack_str(pTHX_ char *pat, char *patend, char *s, char *strbeg, char *strend, char **new_s, I32 ocnt, U32 flags)
+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 = { NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0, 0, NULL };
+ tempsym_t sym;
(void)strbeg;
(void)new_s;
(void)ocnt;
if (first_symbol(pat, patend) != 'U' && (flags & FLAG_DO_UTF8))
flags |= FLAG_PARSE_UTF8;
- sym.patptr = pat;
- sym.patend = patend;
- sym.flags = flags;
+ TEMPSYM_INIT(&sym, pat, patend, flags);
return unpack_rec(&sym, s, s, strend, NULL );
}
=cut */
I32
-Perl_unpackstring(pTHX_ char *pat, char *patend, char *s, char *strend, U32 flags)
+Perl_unpackstring(pTHX_ const char *pat, const char *patend, const char *s, const char *strend, U32 flags)
{
- tempsym_t sym = { NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0, 0, NULL };
+ tempsym_t sym;
if (flags & FLAG_DO_UTF8) flags |= FLAG_WAS_UTF8;
else if (need_utf8(pat, patend)) {
if (first_symbol(pat, patend) != 'U' && (flags & FLAG_DO_UTF8))
flags |= FLAG_PARSE_UTF8;
- sym.patptr = pat;
- sym.patend = patend;
- sym.flags = flags;
+ TEMPSYM_INIT(&sym, pat, patend, flags);
return unpack_rec(&sym, s, s, strend, NULL );
}
STATIC
I32
-S_unpack_rec(pTHX_ tempsym_t* symptr, char *s, char *strbeg, char *strend, char **new_s )
+S_unpack_rec(pTHX_ tempsym_t* symptr, const char *s, const char *strbeg, const char *strend, const char **new_s )
{
dVAR; dSP;
SV *sv;
- I32 start_sp_offset = SP - PL_stack_base;
+ const I32 start_sp_offset = SP - PL_stack_base;
howlen_t howlen;
I32 checksum = 0;
if (!len) /* Avoid division by 0 */
len = 1;
if (utf8) {
- char *hop, *last;
+ const char *hop, *last;
I32 l = len;
hop = last = strbeg;
while (hop < s) {
}
if (utf8) {
I32 l;
- char *hop;
+ const char *hop;
for (l=len, hop=s; l>0; l--, hop += UTF8SKIP(hop)) {
if (hop >= strend) {
if (hop > strend)
if (datumtype == 'Z') {
/* 'Z' strips stuff after first null */
- char *ptr, *end;
+ const char *ptr, *end;
end = s + len;
for (ptr = s; ptr < end; ptr++) if (*ptr == 0) break;
sv = newSVpvn(s, ptr-s);
len = ptr-s + (ptr != strend ? 1 : 0);
} else if (datumtype == 'A') {
/* 'A' strips both nulls and spaces */
- char *ptr;
+ const char *ptr;
if (utf8 && (symptr->flags & FLAG_WAS_UTF8)) {
for (ptr = s+len-1; ptr >= s; ptr--)
if (*ptr != 0 && !UTF8_IS_CONTINUATION(*ptr) &&
str = SvPVX(sv);
if (datumtype == 'b') {
U8 bits = 0;
- I32 ai32 = len;
+ const I32 ai32 = len;
for (len = 0; len < ai32; len++) {
if (len & 7) bits >>= 1;
else if (utf8) {
}
} else {
U8 bits = 0;
- I32 ai32 = len;
+ const I32 ai32 = len;
for (len = 0; len < ai32; len++) {
if (len & 7) bits <<= 1;
else if (utf8) {
}
} else {
U8 bits = 0;
- I32 ai32 = len;
+ const I32 ai32 = len;
for (len = 0; len < ai32; len++) {
if (len & 1) bits <<= 4;
else if (utf8) {
(symptr->flags & FLAG_DO_UTF8) &&
!(symptr->flags & FLAG_WAS_UTF8) : utf8) {
while (len-- > 0 && s < strend) {
- UV val;
STRLEN retlen;
- val = utf8n_to_uvchr((U8 *) s, strend-s, &retlen,
+ const UV val = utf8n_to_uvchr((U8 *) s, strend-s, &retlen,
ckWARN(WARN_UTF8) ? 0 : UTF8_ALLOW_ANY);
if (retlen == (STRLEN) -1 || retlen == 0)
Perl_croak(aTHX_ "Malformed UTF-8 string in unpack");
}
} else if (!checksum)
while (len-- > 0) {
- U8 ch = *(U8 *) s++;
+ const U8 ch = *(U8 *) s++;
PUSHs(sv_2mortal(newSVuv((UV) ch)));
}
else if (checksum > bits_in_uv)
UV auv;
if (utf8) {
U8 result[UTF8_MAXLEN];
- char *ptr;
+ const char *ptr = s;
STRLEN len;
- ptr = s;
/* Bug: warns about bad utf8 even if we are short on bytes
and will break out of the loop */
if (!uni_to_bytes(aTHX_ &ptr, strend, (char *) result, 1,
#endif /* PERL_PACK_CAN_SHRIEKSIGN */
case 'p':
while (len-- > 0) {
- char *aptr;
+ const char *aptr;
SHIFT_VAR(utf8, s, strend, aptr, datumtype);
DO_BO_UNPACK_PC(aptr);
/* newSVpv generates undef if aptr is NULL */
PL_uudmap[' '] = 0;
}
{
- STRLEN l = (STRLEN) (strend - s) * 3 / 4;
+ const STRLEN l = (STRLEN) (strend - s) * 3 / 4;
sv = sv_2mortal(NEWSV(42, l));
if (l) SvPOK_on(sv);
}
len -= 3;
}
if (s < strend) {
- if (*s == '\n') s++;
+ if (*s == '\n') {
+ s++;
+ }
else {
/* possible checksum byte */
- char *skip = s+UTF8SKIP(s);
- if (skip < strend && *skip == '\n') s = skip+1;
+ const char *skip = s+UTF8SKIP(s);
+ if (skip < strend && *skip == '\n')
+ s = skip+1;
}
}
}
I32 gimme = GIMME_V;
STRLEN llen;
STRLEN rlen;
- char *pat = SvPV(left, llen);
- char *s = SvPV(right, rlen);
- char *strend = s + rlen;
- char *patend = pat + llen;
+ const char *pat = SvPV(left, llen);
+ const char *s = SvPV(right, rlen);
+ const char *strend = s + rlen;
+ const char *patend = pat + llen;
I32 cnt;
PUTBACK;
}
STATIC U8 *
-doencodes(U8 *h, char *s, I32 len)
+doencodes(U8 *h, const char *s, I32 len)
{
*h++ = PL_uuemap[len];
while (len > 2) {
len -= 3;
}
if (len > 0) {
- char r = (len > 1 ? s[1] : '\0');
+ const char r = (len > 1 ? s[1] : '\0');
*h++ = PL_uuemap[(077 & (s[0] >> 2))];
*h++ = PL_uuemap[(077 & (((s[0] << 4) & 060) | ((r >> 4) & 017)))];
*h++ = PL_uuemap[(077 & ((r << 2) & 074))];
}
STATIC SV *
-S_is_an_int(pTHX_ char *s, STRLEN l)
+S_is_an_int(pTHX_ const char *s, STRLEN l)
{
STRLEN n_a;
SV *result = newSVpvn(s, l);
*done = 1;
while (*t) {
- int i;
-
- i = m * 10 + (*t - '0');
+ const int i = m * 10 + (*t - '0');
m = i & 0x7F;
r = (i >> 7); /* r < 10 */
if (r) {
return (m);
}
-#define TEMPSYM_INIT(symptr, p, e) \
- STMT_START { \
- (symptr)->patptr = p; \
- (symptr)->patend = e; \
- (symptr)->grpbeg = NULL; \
- (symptr)->grpend = NULL; \
- (symptr)->grpend = NULL; \
- (symptr)->code = 0; \
- (symptr)->length = 0; \
- (symptr)->howlen = 0; \
- (symptr)->level = 0; \
- (symptr)->flags = FLAG_PACK; \
- (symptr)->strbeg = 0; \
- (symptr)->previous = NULL; \
- } STMT_END
-
/*
=for apidoc pack_cat
void
-Perl_pack_cat(pTHX_ SV *cat, char *pat, register char *patend, register SV **beglist, SV **endlist, SV ***next_in_list, U32 flags)
+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;
- TEMPSYM_INIT(&sym, pat, patend);
+ TEMPSYM_INIT(&sym, pat, patend, FLAG_PACK);
(void)pack_rec( cat, &sym, beglist, endlist );
}
void
-Perl_packlist(pTHX_ SV *cat, char *pat, register char *patend, register SV **beglist, SV **endlist )
+Perl_packlist(pTHX_ SV *cat, const char *pat, const char *patend, register SV **beglist, SV **endlist )
{
STRLEN no_len;
tempsym_t sym;
- TEMPSYM_INIT(&sym, pat, patend);
+ TEMPSYM_INIT(&sym, pat, patend, FLAG_PACK);
/* We're going to do changes through SvPVX(cat). Make sure it's valid.
Also make sure any UTF8 flag is loaded */
marked_upgrade(pTHX_ SV *sv, tempsym_t *sym_ptr) {
STRLEN len;
tempsym_t *group;
- char *from_ptr, *to_start, *to_ptr, **marks, **m, *from_start, *from_end;
+ const char *from_ptr, *from_start, *from_end, **marks, **m;
+ char *to_start, *to_ptr;
if (SvUTF8(sv)) return;
Copy(from_start, to_start, from_ptr-from_start, char);
to_ptr = to_start + (from_ptr-from_start);
- New('U', marks, sym_ptr->level+2, char *);
+ New('U', marks, sym_ptr->level+2, const char *);
for (group=sym_ptr; group; group = group->previous)
marks[group->level] = from_start + group->strbeg;
marks[sym_ptr->level+1] = from_end+1;
*/
STATIC char *
sv_exp_grow(pTHX_ SV *sv, STRLEN needed) {
- STRLEN cur = SvCUR(sv);
- STRLEN len = SvLEN(sv);
+ const STRLEN cur = SvCUR(sv);
+ const STRLEN len = SvLEN(sv);
STRLEN extend;
if (len - cur > needed) return SvPVX(sv);
extend = needed > len ? needed : len;
case 'A':
case 'Z':
case 'a': {
- char *aptr;
+ const char *aptr;
fromstr = NEXTFROM;
aptr = SvPV(fromstr, fromlen);
if (DO_UTF8(fromstr)) {
- char *end, *s;
+ const char *end, *s;
if (!utf8 && !SvUTF8(cat)) {
marked_upgrade(aTHX_ cat, symptr);
}
break;
case 'u': {
- char *aptr, *aend;
+ const char *aptr, *aend;
bool from_utf8;
fromstr = NEXTFROM;
dSP; dMARK; dORIGMARK; dTARGET;
register SV *cat = TARG;
STRLEN fromlen;
- register char *pat = SvPVx(*++MARK, fromlen);
- register char *patend = pat + fromlen;
+ register const char *pat = SvPVx(*++MARK, fromlen);
+ register const char *patend = pat + fromlen;
MARK++;
sv_setpvn(cat, "", 0);
PERL_CALLCONV void Perl_set_numeric_radix(pTHX);
PERL_CALLCONV void Perl_set_numeric_standard(pTHX);
PERL_CALLCONV void Perl_require_pv(pTHX_ const char* pv);
-PERL_CALLCONV void Perl_pack_cat(pTHX_ SV *cat, char *pat, char *patend, SV **beglist, SV **endlist, SV ***next_in_list, U32 flags);
-PERL_CALLCONV void Perl_packlist(pTHX_ SV *cat, char *pat, char *patend, SV **beglist, SV **endlist);
+PERL_CALLCONV void Perl_pack_cat(pTHX_ SV *cat, const char *pat, const char *patend, SV **beglist, SV **endlist, SV ***next_in_list, U32 flags);
+PERL_CALLCONV void Perl_packlist(pTHX_ SV *cat, const char *pat, const char *patend, SV **beglist, SV **endlist);
PERL_CALLCONV void Perl_pidgone(pTHX_ Pid_t pid, int status);
PERL_CALLCONV void Perl_pmflag(pTHX_ U32* pmfl, int ch);
PERL_CALLCONV OP* Perl_pmruntime(pTHX_ OP* pm, OP* expr, bool isreg);
#if defined(UNLINK_ALL_VERSIONS)
PERL_CALLCONV I32 Perl_unlnk(pTHX_ char* f);
#endif
-PERL_CALLCONV I32 Perl_unpack_str(pTHX_ char *pat, char *patend, char *s, char *strbeg, char *strend, char **new_s, I32 ocnt, U32 flags);
-PERL_CALLCONV I32 Perl_unpackstring(pTHX_ char *pat, char *patend, char *s, char *strend, U32 flags);
+PERL_CALLCONV 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);
+PERL_CALLCONV I32 Perl_unpackstring(pTHX_ const char *pat, const char *patend, const char *s, const char *strend, U32 flags);
PERL_CALLCONV void Perl_unsharepvn(pTHX_ const char* sv, I32 len, U32 hash);
PERL_CALLCONV void Perl_unshare_hek(pTHX_ HEK* hek);
PERL_CALLCONV void Perl_utilize(pTHX_ int aver, I32 floor, OP* version, OP* idop, OP* arg);
#endif
#if defined(PERL_IN_PP_PACK_C) || defined(PERL_DECL_PROT)
-STATIC I32 S_unpack_rec(pTHX_ tempsym_t* symptr, char *s, char *strbeg, char *strend, char **new_s);
-STATIC SV ** S_pack_rec(pTHX_ SV *cat, tempsym_t* symptr, SV **beglist, SV **endlist);
+STATIC I32 S_unpack_rec(pTHX_ struct tempsym* symptr, const char *s, const char *strbeg, const char *strend, const char **new_s);
+STATIC SV ** S_pack_rec(pTHX_ SV *cat, struct tempsym* symptr, SV **beglist, SV **endlist);
STATIC SV* S_mul128(pTHX_ SV *sv, U8 m);
-STATIC I32 S_measure_struct(pTHX_ tempsym_t* symptr);
-STATIC char * S_group_end(pTHX_ char *pat, char *patend, char ender);
-STATIC char * S_get_num(pTHX_ char *ppat, I32 *);
-STATIC bool S_next_symbol(pTHX_ tempsym_t* symptr);
-STATIC SV* S_is_an_int(pTHX_ char *s, STRLEN l);
+STATIC I32 S_measure_struct(pTHX_ struct tempsym* symptr);
+STATIC bool S_next_symbol(pTHX_ struct tempsym* symptr);
+STATIC SV* S_is_an_int(pTHX_ const char *s, STRLEN l);
STATIC int S_div128(pTHX_ SV *pnum, bool *done);
+STATIC const char * S_group_end(pTHX_ const char *pat, const char *patend, char ender);
+STATIC const char * S_get_num(pTHX_ const char *ppat, I32 *lenptr);
#endif
#if defined(PERL_IN_PP_CTL_C) || defined(PERL_DECL_PROT)
PERL_CALLCONV void Perl_pad_fixup_inner_anons(pTHX_ PADLIST *padlist, CV *old_cv, CV *new_cv);
PERL_CALLCONV void Perl_pad_push(pTHX_ PADLIST *padlist, int depth);
-PERL_CALLCONV HV* Perl_pad_compname_type(pTHX_ const PADOFFSET po);
+PERL_CALLCONV HV* Perl_pad_compname_type(pTHX_ PADOFFSET po);
#if defined(PERL_IN_PAD_C) || defined(PERL_DECL_PROT)
STATIC PADOFFSET S_pad_findlex(pTHX_ const char *name, const CV* cv, U32 seq, int warn, SV** out_capture, SV** out_name_sv, int *out_flags);