Skip to content

Commit

Permalink
Fix: use av_len in perl v5.32
Browse files Browse the repository at this point in the history
  • Loading branch information
cnangel committed Aug 17, 2023
1 parent 9da4be1 commit f8c4e49
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions Libconfig.xs
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,10 @@ set_array(config_setting_t *settings, AV *value, int *status)
SV *g_v = newSViv(2);

allStatus = 1;
#if PERL_API_REVISION >= 5 && PERL_API_VERSION >= 32
valueMaxIndex = (int)av_count(value) - 1;
#else
#if PERL_API_REVISION <= 5 && PERL_API_VERSION <= 32
valueMaxIndex = (int)av_len(value);
#else
valueMaxIndex = (int)av_count(value) - 1;
#endif
for (i = 0; i <= valueMaxIndex; i ++)
{
Expand Down Expand Up @@ -366,10 +366,10 @@ int sv2addarray(config_setting_t *parent_setting, char *key, config_setting_t *s
{
int ret = LIBCONFIG_OK;
AV *av = (AV *)SvRV(sv);
#if PERL_API_REVISION >= 5 && PERL_API_VERSION >= 32
int avlen = (int)av_count(av);
#else
#if PERL_API_REVISION <= 5 && PERL_API_VERSION <= 32
int avlen = (int)av_len(av) + 1;
#else
int avlen = (int)av_count(av);
#endif
if (avlen < 1)
{
Expand Down

0 comments on commit f8c4e49

Please sign in to comment.