1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-11 10:01:57 +03:00
WARNING: This is actually broken - we have self-deadlocks
	         due to concurrent changes in buffer management.
			 Vadim and me are working on it.

Jan
This commit is contained in:
Jan Wieck
2000-07-03 23:10:14 +00:00
parent ef5bea51e1
commit 57d8080a40
43 changed files with 1638 additions and 445 deletions

View File

@ -1,7 +1,7 @@
/* ----------
* pg_lzcompress.c -
*
* $Header: /cvsroot/pgsql/src/backend/utils/adt/pg_lzcompress.c,v 1.5 2000/05/30 00:49:53 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/pg_lzcompress.c,v 1.6 2000/07/03 23:09:52 wieck Exp $
*
* This is an implementation of LZ compression for PostgreSQL.
* It uses a simple history table and generates 2-3 byte tags
@ -582,11 +582,15 @@ pglz_compress(char *source, int slen, PGLZ_Header *dest, PGLZ_Strategy *strategy
* ----------
*/
if (do_compress)
return (dest->varsize = result_size + sizeof(PGLZ_Header));
{
dest->varsize = result_size + sizeof(PGLZ_Header);
return VARATT_SIZE(dest);
}
else
{
memcpy(((char *) dest) + sizeof(PGLZ_Header), source, slen);
return (dest->varsize = slen + sizeof(PGLZ_Header));
dest->varsize = slen + sizeof(PGLZ_Header);
return VARATT_SIZE(dest);
}
}
@ -609,10 +613,10 @@ pglz_decompress(PGLZ_Header *source, char *dest)
int32 off;
dp = ((unsigned char *) source) + sizeof(PGLZ_Header);
dend = ((unsigned char *) source) + source->varsize;
dend = ((unsigned char *) source) + VARATT_SIZE(source);
bp = (unsigned char *) dest;
if (source->varsize == source->rawsize + sizeof(PGLZ_Header))
if (VARATT_SIZE(source) == source->rawsize + sizeof(PGLZ_Header))
{
memcpy(dest, dp, source->rawsize);
return source->rawsize;