]> Dogcows Code - chaz/p5-File-KDBX-XS/commitdiff
Add CowREFCNT as a utility function
authorCharles McGarvey <ccm@cpan.org>
Tue, 19 Apr 2022 19:29:09 +0000 (13:29 -0600)
committerCharles McGarvey <ccm@cpan.org>
Tue, 19 Apr 2022 19:29:09 +0000 (13:29 -0600)
XS.xs

diff --git a/XS.xs b/XS.xs
index 251f26996f858a4a64a516ee4f01bba40c83fb19..e6b7b2266137600cb60dc522486e3b9dfd0d5833 100644 (file)
--- 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
-
This page took 0.024362 seconds and 4 git commands to generate.