[Xapian-discuss] FIXMEs in Search::Xapian

Olly Betts olly at survex.com
Wed Sep 29 03:52:26 BST 2010

On Tue, Sep 28, 2010 at 06:03:53PM +0100, Tim Brody wrote:
> On Tue, 2010-09-28 at 15:51 +0100, Tim Brody wrote:
> > There's something odd in perl/util.i:
> >       if ( ref( $item ) eq 'Search::Xapian::Query' ) {
> >           push(@arr, ref($item));
> >       } else {
> >           push(@arr, $item);
> >       }

Yes, the first branch will push the string 'Search::Xapian::Query' rather than
the object.

> After much faffing I've worked up a patch for the above segfault.
> The minimal change is to replace the XS typemap with the correct (?)
> SWIG typemap ... but I also simplified the code structure by passing an
> ARRAY rather than ** + len.

That looks good to me - I tweaked the whitespace (looks like you have
tab width 4, but we use tab width 8 in Xapian code), and fixed it to
reserve av_len() + 1 elements, and have applied it in trunk r15022.

And thanks for including a regression test - that's very much appreciated.

I also added the new testcase to the XS Search::Xapian too (r15023) -
thankfully it already passes there.

> Is there a list of SWIG macros c.f. perlapi?


Note that the way the Query constructors is handled isn't how you
typically do things in SWIG - this case is unusual as we want to handle
a "mixed" array.  Usually you just write a typemap for each parameter
type which SWIG doesn't already know how to handle.


More information about the Xapian-discuss mailing list