Re: question on how to correctly communicate with external library functions which return malloc()'ed strings

From: Vladimir Volovich <vvv(at)vsu(dot)ru>
To: Martijn van Oosterhout <kleptog(at)svana(dot)org>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: question on how to correctly communicate with external library functions which return malloc()'ed strings
Date: 2008-04-11 19:11:38
Message-ID: 87tzi82olx.fsf@external.prs-office.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"MvO" == Martijn van Oosterhout writes:

>> it worked fine with postgresql 8.2; with 8.3 it started segfaulting,
>> and it appeared that the reason is because in postgresql 8.3, the
>> "free" is a macro defined in snowball/header.h: #define free(a)
>> pfree(a)

MvO> It does seem wrong. Do you include that header file explicitly?
MvO> Because it shouldn't be necessary.

i needed some prototypes from snowball in the same source file, so i
included snowball/header.h; it appears that it is sufficient to use
#include <snowball/libstemmer/api.h>
instead of
#include <snowball/header.h>

but please remove the "#define free" from snowball/header.h because, as
you said, it's wrong.

Best,
v.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Oleg Bartunov 2008-04-11 19:13:24 Re: Index AM change proposals, redux
Previous Message Decibel! 2008-04-11 19:08:23 Re: Commit fest queue