summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--perl.h6
-rw-r--r--sv.c8
-rw-r--r--t/porting/diag.t1
3 files changed, 12 insertions, 3 deletions
diff --git a/perl.h b/perl.h
index accb96bdd7..8048b5633c 100644
--- a/perl.h
+++ b/perl.h
@@ -3212,6 +3212,12 @@ typedef pthread_key_t perl_key;
# define HEKf "2p"
#endif
+/* Not ideal, but we cannot easily include a number in an already-numeric
+ * format sequence. */
+#ifndef HEKf256
+# define HEKf256 "3p"
+#endif
+
#define HEKfARG(p) ((void*)(p))
#ifdef PERL_CORE
diff --git a/sv.c b/sv.c
index c8e3c02dff..158410dc6b 100644
--- a/sv.c
+++ b/sv.c
@@ -10175,7 +10175,8 @@ Perl_sv_vcatpvfn(pTHX_ SV *const sv, const char *const pat, const STRLEN patlen,
%-p (SVf) include an SV (previously %_)
%-<num>p include an SV with precision <num>
%2p include a HEK
- %<num>p (where num != 2) reserved for future
+ %3p include a HEK with precision of 256
+ %<num>p (where num != 2 or 3) reserved for future
extensions
Robin Barker 2005-07-14 (but modified since)
@@ -10200,12 +10201,13 @@ Perl_sv_vcatpvfn(pTHX_ SV *const sv, const char *const pat, const STRLEN patlen,
is_utf8 = TRUE;
goto string;
}
- else if (n==2) { /* HEKf */
+ else if (n==2 || n==3) { /* HEKf */
HEK * const hek = va_arg(*args, HEK *);
eptr = HEK_KEY(hek);
elen = HEK_LEN(hek);
if (HEK_UTF8(hek)) is_utf8 = TRUE;
- goto string; /* no modifiers supported */
+ if (n==3) precis = 256, has_precis = TRUE;
+ goto string;
}
else if (n) {
Perl_ck_warner_d(aTHX_ packWARN(WARN_INTERNAL),
diff --git a/t/porting/diag.t b/t/porting/diag.t
index 3a9dbab9e3..331b356828 100644
--- a/t/porting/diag.t
+++ b/t/porting/diag.t
@@ -142,6 +142,7 @@ my %specialformats = (IVdf => 'd',
NVef => 'f',
NVff => 'f',
NVgf => 'f',
+ HEKf256=>'s',
HEKf => 's',
SVf256=>'s',
SVf32=> 's',