From: Charles McGarvey Date: Tue, 19 Apr 2022 19:29:09 +0000 (-0600) Subject: Add CowREFCNT as a utility function X-Git-Tag: v0.900~3 X-Git-Url: https://git.dogcows.com/gitweb?a=commitdiff_plain;h=dd4b4c4ad1d021d3cba6a46291795542cd5def4a;p=chaz%2Fp5-File-KDBX-XS Add CowREFCNT as a utility function --- 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 -