aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/tsvector_op.c
diff options
context:
space:
mode:
authorNoah Misch <noah@leadboat.com>2017-03-12 19:35:31 -0400
committerNoah Misch <noah@leadboat.com>2017-03-12 19:35:31 -0400
commit2fd26b23b662dcb0cf649e983a58581cb911fc4b (patch)
tree2aac3510bbd79eb36b721277e9a1398fa3dfaef5 /src/backend/utils/adt/tsvector_op.c
parent9e0926468a1c41a31c09785787a737311dcd92c1 (diff)
downloadpostgresql-2fd26b23b662dcb0cf649e983a58581cb911fc4b.tar.gz
postgresql-2fd26b23b662dcb0cf649e983a58581cb911fc4b.zip
Assume deconstruct_array() outputs are untoasted.
In functions that issue a deconstruct_array() call, consistently use plain VARSIZE()/VARDATA() on the array elements. Prior practice was divided between those and VARSIZE_ANY_EXHDR()/VARDATA_ANY().
Diffstat (limited to 'src/backend/utils/adt/tsvector_op.c')
-rw-r--r--src/backend/utils/adt/tsvector_op.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/backend/utils/adt/tsvector_op.c b/src/backend/utils/adt/tsvector_op.c
index b0f0ce05c59..3dab84a887f 100644
--- a/src/backend/utils/adt/tsvector_op.c
+++ b/src/backend/utils/adt/tsvector_op.c
@@ -323,7 +323,7 @@ tsvector_setweight_by_filter(PG_FUNCTION_ARGS)
errmsg("lexeme array may not contain nulls")));
lex = VARDATA(dlexemes[i]);
- lex_len = VARSIZE_ANY_EXHDR(dlexemes[i]);
+ lex_len = VARSIZE(dlexemes[i]) - VARHDRSZ;
lex_pos = tsvector_bsearch(tsout, lex, lex_len);
if (lex_pos >= 0 && (j = POSDATALEN(tsout, entry + lex_pos)) != 0)
@@ -609,8 +609,8 @@ tsvector_delete_arr(PG_FUNCTION_ARGS)
(errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
errmsg("lexeme array may not contain nulls")));
- lex = VARDATA_ANY(dlexemes[i]);
- lex_len = VARSIZE_ANY_EXHDR(dlexemes[i]);
+ lex = VARDATA(dlexemes[i]);
+ lex_len = VARSIZE(dlexemes[i]) - VARHDRSZ;
lex_pos = tsvector_bsearch(tsin, lex, lex_len);
if (lex_pos >= 0)
@@ -793,7 +793,7 @@ array_to_tsvector(PG_FUNCTION_ARGS)
/* Calculate space needed for surviving lexemes. */
for (i = 0; i < nitems; i++)
- datalen += VARSIZE_ANY_EXHDR(dlexemes[i]);
+ datalen += VARSIZE(dlexemes[i]) - VARHDRSZ;
tslen = CALCDATASIZE(nitems, datalen);
/* Allocate and fill tsvector. */
@@ -805,8 +805,8 @@ array_to_tsvector(PG_FUNCTION_ARGS)
cur = STRPTR(tsout);
for (i = 0; i < nitems; i++)
{
- char *lex = VARDATA_ANY(dlexemes[i]);
- int lex_len = VARSIZE_ANY_EXHDR(dlexemes[i]);
+ char *lex = VARDATA(dlexemes[i]);
+ int lex_len = VARSIZE(dlexemes[i]) - VARHDRSZ;
memcpy(cur, lex, lex_len);
arrout[i].haspos = 0;