summaryrefslogtreecommitdiff
path: root/proto.h
diff options
context:
space:
mode:
authorYves Orton <demerphq@gmail.com>2010-08-29 20:47:16 +0200
committerYves Orton <demerphq@gmail.com>2010-08-30 00:42:05 +0200
commit05c0d6bbe3ec5cc9af99d105b8648ad02ed7cc95 (patch)
treeb9515e9cdc9550668ed574dc10948665a2e22c2f /proto.h
parentdcab73c98b3631cbd98acc628309c400cf7b5ad2 (diff)
downloadperl-05c0d6bbe3ec5cc9af99d105b8648ad02ed7cc95.tar.gz
add sv_reftype_len() and make sv_reftype() be a wrapper for it
sv_reftype() mostly returns strings whose length is known at compile time, so we can avoid a strlen() call if we return the length. Additionally, the non-length interface is potentially buggy in the face of class names which contain "\0", therefore providing a way to obtain the true length allows us to avoid any trickyness.
Diffstat (limited to 'proto.h')
-rw-r--r--proto.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/proto.h b/proto.h
index 2c5df53f8f..3e2d3dd6d5 100644
--- a/proto.h
+++ b/proto.h
@@ -3491,6 +3491,13 @@ PERL_CALLCONV bool Perl_sv_cat_decode(pTHX_ SV* dsv, SV *encoding, SV *ssv, int
#define PERL_ARGS_ASSERT_SV_CAT_DECODE \
assert(dsv); assert(encoding); assert(ssv); assert(offset); assert(tstr)
+PERL_CALLCONV const char* Perl_sv_reftype_len(pTHX_ const SV *const sv, const int ob, STRLEN *const ret_len)
+ __attribute__warn_unused_result__
+ __attribute__nonnull__(pTHX_1)
+ __attribute__nonnull__(pTHX_3);
+#define PERL_ARGS_ASSERT_SV_REFTYPE_LEN \
+ assert(sv); assert(ret_len)
+
PERL_CALLCONV const char* Perl_sv_reftype(pTHX_ const SV *const sv, const int ob)
__attribute__warn_unused_result__
__attribute__nonnull__(pTHX_1);