Skip to content

Commit

Permalink
Devel::PPPort: threads-shared needs SvREFCNT_dec_NN()
Browse files Browse the repository at this point in the history
and threads.xs no longer needs to define SvREFCNT_dec_NN()
  • Loading branch information
tonycoz committed Jul 11, 2024
1 parent d44f24a commit 9be4c52
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
9 changes: 7 additions & 2 deletions dist/Devel-PPPort/parts/inc/SvREFCNT
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ __UNDEFINED__
# endif
#endif

/* not as efficient as the real thing, but it works */
__UNDEFINED__ SvREFCNT_dec_NN(sv) SvREFCNT_dec(sv)

__UNDEFINED__ SvREFCNT_inc_simple_void(sv) STMT_START { if (sv) SvREFCNT(sv)++; } STMT_END
__UNDEFINED__ SvREFCNT_inc_simple_NN(sv) (++SvREFCNT(sv), (SV*)(sv))
__UNDEFINED__ SvREFCNT_inc_void_NN(sv) (void)(++SvREFCNT((SV*)(sv)))
Expand Down Expand Up @@ -110,13 +113,15 @@ SvREFCNT()
mXPUSHi(SvREFCNT(sv) == 8);
SvREFCNT_inc_simple_void_NN(sv);
mXPUSHi(SvREFCNT(sv) == 9);
SvREFCNT_dec_NN(sv);
mXPUSHi(SvREFCNT(sv) == 8);
while (SvREFCNT(sv) > 1)
SvREFCNT_dec(sv);
mXPUSHi(SvREFCNT(sv) == 1);
SvREFCNT_dec(sv);
XSRETURN(14);
XSRETURN(15);

=tests plan => 14
=tests plan => 15

for (Devel::PPPort::SvREFCNT()) {
ok(defined $_ and $_);
Expand Down
3 changes: 0 additions & 3 deletions dist/threads/threads.xs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
#ifndef sv_dup_inc
# define sv_dup_inc(s,t) SvREFCNT_inc(sv_dup(s,t))
#endif
#ifndef SvREFCNT_dec_NN
# define SvREFCNT_dec_NN(x) SvREFCNT_dec(x)
#endif
#ifndef PERL_UNUSED_RESULT
# if defined(__GNUC__) && defined(HASATTRIBUTE_WARN_UNUSED_RESULT)
# define PERL_UNUSED_RESULT(v) STMT_START { __typeof__(v) z = (v); (void)sizeof(z); } STMT_END
Expand Down

0 comments on commit 9be4c52

Please sign in to comment.