File Coverage

SPLAddress.xs
Criterion Covered Total %
statement 6 6 100.0
branch 3 6 50.0
condition n/a
subroutine n/a
pod n/a
total 9 12 75.0


line stmt bran cond sub pod time code
1             #define PERL_NO_GET_CONTEXT
2             #include "EXTERN.h"
3             #include "perl.h"
4             #include "XSUB.h"
5              
6             #include "ppport.h"
7              
8              
9             int ge_frombytes_vartime(unsigned char *s);
10              
11             MODULE = Solana::SPLAddress PACKAGE = Solana::SPLAddress
12              
13             int
14             check_pub_address_is_ok(SV* address)
15             CODE:
16             {
17 1           unsigned char* tmp = NULL;
18 1           STRLEN len = 0;
19 1 50         if (SvOK(address)) {
20 1           tmp = (unsigned char*)SvPVbyte(address, len);
21             }
22 1 50         if (len != 32) croak("owner must be 32 bytes long");
23              
24 1 50         RETVAL = ge_frombytes_vartime(tmp) != -1;
25             }
26             OUTPUT:
27             RETVAL