1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-28 23:42:10 +03:00

Fix up several contrib modules that were using varlena datatypes in not-so-obvious

ways.  I'm not totally sure that I caught everything, but at least now they pass
their regression tests with VARSIZE/SET_VARSIZE defined to reverse byte order.
This commit is contained in:
Tom Lane
2007-02-28 22:44:38 +00:00
parent d1ce4f7396
commit 9f652d430f
24 changed files with 152 additions and 147 deletions

View File

@ -215,8 +215,8 @@ _ltree_extract_isparent(PG_FUNCTION_ARGS)
PG_RETURN_NULL();
}
item = (ltree *) palloc(found->len);
memcpy(item, found, found->len);
item = (ltree *) palloc(VARSIZE(found));
memcpy(item, found, VARSIZE(found));
PG_FREE_IF_COPY(la, 0);
PG_FREE_IF_COPY(query, 1);
@ -238,8 +238,8 @@ _ltree_extract_risparent(PG_FUNCTION_ARGS)
PG_RETURN_NULL();
}
item = (ltree *) palloc(found->len);
memcpy(item, found, found->len);
item = (ltree *) palloc(VARSIZE(found));
memcpy(item, found, VARSIZE(found));
PG_FREE_IF_COPY(la, 0);
PG_FREE_IF_COPY(query, 1);
@ -261,8 +261,8 @@ _ltq_extract_regex(PG_FUNCTION_ARGS)
PG_RETURN_NULL();
}
item = (ltree *) palloc(found->len);
memcpy(item, found, found->len);
item = (ltree *) palloc(VARSIZE(found));
memcpy(item, found, VARSIZE(found));
PG_FREE_IF_COPY(la, 0);
PG_FREE_IF_COPY(query, 1);
@ -284,8 +284,8 @@ _ltxtq_extract_exec(PG_FUNCTION_ARGS)
PG_RETURN_NULL();
}
item = (ltree *) palloc(found->len);
memcpy(item, found, found->len);
item = (ltree *) palloc(VARSIZE(found));
memcpy(item, found, VARSIZE(found));
PG_FREE_IF_COPY(la, 0);
PG_FREE_IF_COPY(query, 1);