1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-11 20:28:21 +03:00

Dodge a macro-name conflict with Perl.

Some versions of Perl export a macro named HS_KEY.  This creates a
conflict in contrib/hstore_plperl against hstore's macro of the same
name.  The most future-proof solution seems to be to rename our macro;
I chose HSTORE_KEY.  For consistency, rename HS_VAL and related macros
similarly.

Back-patch to 9.5.  contrib/hstore_plperl doesn't exist before that
so there is no need to worry about the conflict in older releases.

Per reports from Marco Atzeri and Mike Blackwell.
This commit is contained in:
Tom Lane
2015-11-19 14:54:05 -05:00
parent db135e834a
commit 68c1d7d42e
8 changed files with 151 additions and 127 deletions

View File

@ -129,11 +129,13 @@ ghstore_compress(PG_FUNCTION_ARGS)
{
int h;
h = crc32_sz((char *) HS_KEY(hsent, ptr, i), HS_KEYLEN(hsent, i));
h = crc32_sz((char *) HSTORE_KEY(hsent, ptr, i),
HSTORE_KEYLEN(hsent, i));
HASH(GETSIGN(res), h);
if (!HS_VALISNULL(hsent, i))
if (!HSTORE_VALISNULL(hsent, i))
{
h = crc32_sz((char *) HS_VAL(hsent, ptr, i), HS_VALLEN(hsent, i));
h = crc32_sz((char *) HSTORE_VAL(hsent, ptr, i),
HSTORE_VALLEN(hsent, i));
HASH(GETSIGN(res), h);
}
}
@ -524,13 +526,15 @@ ghstore_consistent(PG_FUNCTION_ARGS)
for (i = 0; res && i < count; ++i)
{
int crc = crc32_sz((char *) HS_KEY(qe, qv, i), HS_KEYLEN(qe, i));
int crc = crc32_sz((char *) HSTORE_KEY(qe, qv, i),
HSTORE_KEYLEN(qe, i));
if (GETBIT(sign, HASHVAL(crc)))
{
if (!HS_VALISNULL(qe, i))
if (!HSTORE_VALISNULL(qe, i))
{
crc = crc32_sz((char *) HS_VAL(qe, qv, i), HS_VALLEN(qe, i));
crc = crc32_sz((char *) HSTORE_VAL(qe, qv, i),
HSTORE_VALLEN(qe, i));
if (!GETBIT(sign, HASHVAL(crc)))
res = false;
}