Skip to content

Commit 966115c

Browse files
committed
Temporarily revert "Move pg_lzcompress.c to src/common."
This reverts commit 60838df. That change needs a bit more thought to be workable. In view of the potentially machine-dependent stuff that went in today, we need all of the buildfarm to be testing those other changes.
1 parent d72731a commit 966115c

File tree

6 files changed

+17
-29
lines changed

6 files changed

+17
-29
lines changed

src/backend/access/heap/tuptoaster.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
#include "catalog/catalog.h"
3838
#include "miscadmin.h"
3939
#include "utils/fmgroids.h"
40-
#include "common/pg_lzcompress.h"
40+
#include "utils/pg_lzcompress.h"
4141
#include "utils/rel.h"
4242
#include "utils/typcache.h"
4343
#include "utils/tqual.h"
@@ -142,8 +142,7 @@ heap_tuple_untoast_attr(struct varlena * attr)
142142

143143
attr = (struct varlena *) palloc(PGLZ_RAW_SIZE(tmp) + VARHDRSZ);
144144
SET_VARSIZE(attr, PGLZ_RAW_SIZE(tmp) + VARHDRSZ);
145-
if (!pglz_decompress(tmp, VARDATA(attr)))
146-
elog(ERROR, "compressed data is corrupted");
145+
pglz_decompress(tmp, VARDATA(attr));
147146
pfree(tmp);
148147
}
149148
}
@@ -168,8 +167,7 @@ heap_tuple_untoast_attr(struct varlena * attr)
168167

169168
attr = (struct varlena *) palloc(PGLZ_RAW_SIZE(tmp) + VARHDRSZ);
170169
SET_VARSIZE(attr, PGLZ_RAW_SIZE(tmp) + VARHDRSZ);
171-
if (!pglz_decompress(tmp, VARDATA(attr)))
172-
elog(ERROR, "compressed data is corrupted");
170+
pglz_decompress(tmp, VARDATA(attr));
173171
}
174172
else if (VARATT_IS_SHORT(attr))
175173
{
@@ -241,8 +239,7 @@ heap_tuple_untoast_attr_slice(struct varlena * attr,
241239

242240
preslice = (struct varlena *) palloc(size);
243241
SET_VARSIZE(preslice, size);
244-
if (!pglz_decompress(tmp, VARDATA(preslice)))
245-
elog(ERROR, "compressed data is corrupted");
242+
pglz_decompress(tmp, VARDATA(preslice));
246243

247244
if (tmp != (PGLZ_Header *) attr)
248245
pfree(tmp);

src/backend/utils/adt/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ OBJS = acl.o arrayfuncs.o array_selfuncs.o array_typanalyze.o \
2525
jsonfuncs.o like.o lockfuncs.o mac.o misc.o nabstime.o name.o \
2626
network.o network_gist.o network_selfuncs.o \
2727
numeric.o numutils.o oid.o oracle_compat.o \
28-
orderedsetaggs.o pg_locale.o pg_lsn.o pgstatfuncs.o \
29-
pseudotypes.o quote.o rangetypes.o rangetypes_gist.o \
28+
orderedsetaggs.o pg_lzcompress.o pg_locale.o pg_lsn.o \
29+
pgstatfuncs.o pseudotypes.o quote.o rangetypes.o rangetypes_gist.o \
3030
rangetypes_selfuncs.o rangetypes_spgist.o rangetypes_typanalyze.o \
3131
regexp.o regproc.o ri_triggers.o rowtypes.o ruleutils.o \
3232
selfuncs.o tid.o timestamp.o trigfuncs.o \

src/common/pg_lzcompress.c renamed to src/backend/utils/adt/pg_lzcompress.c

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
* FALSE if not; in the latter case the contents of dest
2828
* are undefined.
2929
*
30-
* bool
30+
* void
3131
* pglz_decompress(const PGLZ_Header *source, char *dest)
3232
*
3333
* source is the compressed input.
@@ -40,10 +40,6 @@
4040
* The data is written to buff exactly as it was handed
4141
* to pglz_compress(). No terminating zero byte is added.
4242
*
43-
* The return value is TRUE if decompression succeeded,
44-
* FALSE if not; in the latter case the contents of dest
45-
* are undefined.
46-
*
4743
* The decompression algorithm and internal data format:
4844
*
4945
* PGLZ_Header is defined as
@@ -173,14 +169,14 @@
173169
*
174170
* Copyright (c) 1999-2014, PostgreSQL Global Development Group
175171
*
176-
* src/common/pg_lzcompress.c
172+
* src/backend/utils/adt/pg_lzcompress.c
177173
* ----------
178174
*/
179175
#include "postgres.h"
180176

181177
#include <limits.h>
182178

183-
#include "common/pg_lzcompress.h"
179+
#include "utils/pg_lzcompress.h"
184180

185181

186182
/* ----------
@@ -496,8 +492,7 @@ pglz_find_match(int16 *hstart, const char *input, const char *end,
496492
/* ----------
497493
* pglz_compress -
498494
*
499-
* Compresses source into dest using strategy. Returns false if a failure
500-
* occurred, true in case of success.
495+
* Compresses source into dest using strategy.
501496
* ----------
502497
*/
503498
bool
@@ -683,11 +678,10 @@ pglz_compress(const char *source, int32 slen, PGLZ_Header *dest,
683678
/* ----------
684679
* pglz_decompress -
685680
*
686-
* Decompresses source into dest. Returns false if a failure
687-
* occurred, true in case of success.
681+
* Decompresses source into dest.
688682
* ----------
689683
*/
690-
bool
684+
void
691685
pglz_decompress(const PGLZ_Header *source, char *dest)
692686
{
693687
const unsigned char *sp;
@@ -777,10 +771,9 @@ pglz_decompress(const PGLZ_Header *source, char *dest)
777771
* Check we decompressed the right amount.
778772
*/
779773
if (dp != destend || sp != srcend)
780-
return false;
774+
elog(ERROR, "compressed data is corrupt");
781775

782776
/*
783777
* That's it.
784778
*/
785-
return true;
786779
}

src/common/Makefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ include $(top_builddir)/src/Makefile.global
2323
override CPPFLAGS := -DFRONTEND $(CPPFLAGS)
2424
LIBS += $(PTHREAD_LIBS)
2525

26-
OBJS_COMMON = exec.o pg_lzcompress.o pgfnames.o psprintf.o relpath.o \
27-
rmtree.o username.o wait_error.o
26+
OBJS_COMMON = exec.o pgfnames.o psprintf.o relpath.o rmtree.o username.o wait_error.o
2827

2928
OBJS_FRONTEND = $(OBJS_COMMON) fe_memutils.o
3029

src/include/common/pg_lzcompress.h renamed to src/include/utils/pg_lzcompress.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Definitions for the builtin LZ compressor
55
*
6-
* src/include/common/pg_lzcompress.h
6+
* src/include/utils/pg_lzcompress.h
77
* ----------
88
*/
99

@@ -107,6 +107,6 @@ extern const PGLZ_Strategy *const PGLZ_strategy_always;
107107
*/
108108
extern bool pglz_compress(const char *source, int32 slen, PGLZ_Header *dest,
109109
const PGLZ_Strategy *strategy);
110-
extern bool pglz_decompress(const PGLZ_Header *source, char *dest);
110+
extern void pglz_decompress(const PGLZ_Header *source, char *dest);
111111

112112
#endif /* _PG_LZCOMPRESS_H_ */

src/tools/msvc/Mkvcbuild.pm

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,7 @@ sub mkvcbuild
7676
push(@pgportfiles, 'rint.c') if ($vsVersion < '12.00');
7777

7878
our @pgcommonallfiles = qw(
79-
exec.c pg_lzcompress.c pgfnames.c psprintf.c relpath.c rmtree.c
80-
username.c wait_error.c);
79+
exec.c pgfnames.c psprintf.c relpath.c rmtree.c username.c wait_error.c);
8180

8281
our @pgcommonfrontendfiles = (@pgcommonallfiles, qw(fe_memutils.c));
8382

0 commit comments

Comments
 (0)