From f53f474de293c75fd8398a65171eedbcb829a8cd Mon Sep 17 00:00:00 2001 From: "Meredith L. Patterson" <mlp@thesmartpolitenerd.com> Date: Fri, 6 Dec 2013 04:27:44 +0100 Subject: [PATCH] try to resolve missing bool/true/false problems with perl bindings --- src/bindings/perl/Makefile.PL | 2 +- src/bindings/perl/hammer.i | 3 ++- src/hammer.h | 2 -- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/bindings/perl/Makefile.PL b/src/bindings/perl/Makefile.PL index 4e457fcd..c9bf9db9 100644 --- a/src/bindings/perl/Makefile.PL +++ b/src/bindings/perl/Makefile.PL @@ -10,6 +10,6 @@ WriteMakefile( LIBS => ["-lhammer"], OBJECT => 'hammer_wrap.o', INC => '-I../..', - CCFLAGS => "$Config{ccflags} -DSWIG -std=gnu99", + CCFLAGS => "$Config{ccflags} -DSWIG -DHAMMER_INTERNAL__NO_STDARG_H -std=gnu99", ); diff --git a/src/bindings/perl/hammer.i b/src/bindings/perl/hammer.i index ff9d7f4e..eaf504d8 100644 --- a/src/bindings/perl/hammer.i +++ b/src/bindings/perl/hammer.i @@ -1,6 +1,7 @@ %module hammer; %begin %{ #include <unistd.h> +#include <stdbool.h> #include <stdint.h> %} @@ -36,7 +37,7 @@ SWIG_exception_fail(SWIG_TypeError, "Expected array ref"); AV* av = (AV*) SvRV($input); - size_t amax = av_top_index(av) + 1; // I want the length, not the top index... + size_t amax = av_len(av) + 1; // I want the length, not the top index... // TODO: is this array copied? $1 = malloc((amax+1) * sizeof(*$1)); $1[amax] = NULL; diff --git a/src/hammer.h b/src/hammer.h index 22f77f54..e536c0b1 100644 --- a/src/hammer.h +++ b/src/hammer.h @@ -35,9 +35,7 @@ extern "C" { #ifndef __cplusplus #ifndef HAMMER_INTERNAL__NO_STDARG_H -#ifndef SWIGPERL typedef int bool; -#endif // SWIGPERL #endif // HAMMER_INTERNAL__NO_STDARG_H #endif -- GitLab