From b64d966deb12a54aa6e16aeab586977c374fb2c4 Mon Sep 17 00:00:00 2001 From: Heikki Linnakangas Date: Tue, 2 Dec 2008 11:30:53 +0000 Subject: [PATCH] Use PG_GETARG_TEXT_PP instead of PG_GETARG_TEXT_P in the new gin_cmp_tslexeme and gin_cmp_prefix functions. Should shave off a few cycles from GIN operations. --- src/backend/utils/adt/tsginidx.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/backend/utils/adt/tsginidx.c b/src/backend/utils/adt/tsginidx.c index a09c92eebe..087730b2d0 100644 --- a/src/backend/utils/adt/tsginidx.c +++ b/src/backend/utils/adt/tsginidx.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/adt/tsginidx.c,v 1.12 2008/05/16 16:31:01 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/tsginidx.c,v 1.13 2008/12/02 11:30:53 heikki Exp $ * *------------------------------------------------------------------------- */ @@ -22,13 +22,13 @@ Datum gin_cmp_tslexeme(PG_FUNCTION_ARGS) { - text *a = PG_GETARG_TEXT_P(0); - text *b = PG_GETARG_TEXT_P(1); + text *a = PG_GETARG_TEXT_PP(0); + text *b = PG_GETARG_TEXT_PP(1); int cmp; cmp = tsCompareString( - VARDATA(a), VARSIZE(a) - VARHDRSZ, - VARDATA(b), VARSIZE(b) - VARHDRSZ, + VARDATA_ANY(a), VARSIZE_ANY_EXHDR(a), + VARDATA_ANY(b), VARSIZE_ANY_EXHDR(b), false ); PG_FREE_IF_COPY(a,0); @@ -39,16 +39,16 @@ gin_cmp_tslexeme(PG_FUNCTION_ARGS) Datum gin_cmp_prefix(PG_FUNCTION_ARGS) { - text *a = PG_GETARG_TEXT_P(0); - text *b = PG_GETARG_TEXT_P(1); + text *a = PG_GETARG_TEXT_PP(0); + text *b = PG_GETARG_TEXT_PP(1); #ifdef NOT_USED StrategyNumber strategy = PG_GETARG_UINT16(2); #endif int cmp; cmp = tsCompareString( - VARDATA(a), VARSIZE(a) - VARHDRSZ, - VARDATA(b), VARSIZE(b) - VARHDRSZ, + VARDATA_ANY(a), VARSIZE_ANY_EXHDR(a), + VARDATA_ANY(b), VARSIZE_ANY_EXHDR(b), true ); if ( cmp < 0 )