Обсуждение: Changes to C interface from 7.0 to 7.1

Поиск
Список
Период
Сортировка

Changes to C interface from 7.0 to 7.1

От
"Dr. Evil"
Дата:
I have a function like this:

 VARSIZE(result) = result_size - 1;
  sha1_init(C);
  sha1_write(C, VARDATA(arg), VARSIZE(arg)-VARHDRSZ);

anyway, the problem is that VARSIZE is no longer defined in a way that
I can make assignments to in 7.1.  Does anyone have any sugestions?

Also, if there is an SHA1 function built in, I might as well use that,
but I still need to have my own user-defined C for other things.  For
instance, I have a challenge-response function that works with the
CryptoCard token, linked directly into PG, which I need to recompile
for 7.1.

Thanks

Re: Changes to C interface from 7.0 to 7.1

От
Tom Lane
Дата:
"Dr. Evil" <drevil@sidereal.kz> writes:
> anyway, the problem is that VARSIZE is no longer defined in a way that
> I can make assignments to in 7.1.  Does anyone have any sugestions?

Use VARATT_SIZEP.

src/backend/utils/adt/ is a rich source of examples to follow when you
have questions like this ...

            regards, tom lane

More.. Re: Changes to C interface from 7.0 to 7.1

От
"Dr. Evil"
Дата:
> "Dr. Evil" <drevil@sidereal.kz> writes:
> > anyway, the problem is that VARSIZE is no longer defined in a way that
> > I can make assignments to in 7.1.  Does anyone have any sugestions?
>
> Use VARATT_SIZEP.
>
> src/backend/utils/adt/ is a rich source of examples to follow when you
> have questions like this ...

Thanks for the tip on that.  That helps, but the documentation is
still incomplete.  I was reading the docs, and those files in
src/backend/utils/adt/, and they all include "postgres.h" and
"fmgr.h", from src/include.  Do I need to include anything from
/usr/local/pgsql/include?  If not, shouldn't the postgres.h and fmgr.h
files be somewhere in /usr/local/pgsql/include?

After I changed the macros I was using to the V1 style, and included
postgres.h and fmgr.h, it worked, and now I can get my SHA1 hashes
again, but I want to understand what I'm doing.

Slightly confused by the new C interface...

Now if only I could also link in gpg I would have everything...

Re: More.. Re: Changes to C interface from 7.0 to 7.1

От
Tom Lane
Дата:
"Dr. Evil" <drevil@sidereal.kz> writes:
> ... shouldn't the postgres.h and fmgr.h
> files be somewhere in /usr/local/pgsql/include?

make install-all-headers is needed if you want to do backend-side
code development using the installed headers.  By default, only
headers for client programming are installed.

            regards, tom lane