From dd4b4c4ad1d021d3cba6a46291795542cd5def4a Mon Sep 17 00:00:00 2001 From: Charles McGarvey Date: Tue, 19 Apr 2022 13:29:09 -0600 Subject: [PATCH] Add CowREFCNT as a utility function --- XS.xs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/XS.xs b/XS.xs index 251f269..e6b7b22 100644 --- a/XS.xs +++ b/XS.xs @@ -6,6 +6,20 @@ #include "tomcrypt.h" +MODULE = File::KDBX::XS PACKAGE = File::KDBX::Util + +PROTOTYPES: DISABLE + +SV* +CowREFCNT(SV* sv) + CODE: +#ifdef SV_COW_REFCNT_MAX + if (SvIsCOW(sv)) XSRETURN_IV(0 < SvLEN(sv) ? CowREFCNT(sv) : 0); +#endif + XSRETURN_UNDEF; + OUTPUT: + RETVAL + MODULE = File::KDBX::XS PACKAGE = File::KDBX::KDF::AES PROTOTYPES: DISABLE @@ -31,4 +45,3 @@ _transform_half_xs(const char* key, const char* seed, unsigned int rounds) RETVAL = result; OUTPUT: RETVAL - -- 2.45.2