1
1
/* ----------
2
2
* pg_lzcompress.c -
3
3
*
4
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/pg_lzcompress.c,v 1.11 2001/03/22 06:16:17 momjian Exp $
4
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/pg_lzcompress.c,v 1.12 2001/10/25 01:29:37 momjian Exp $
5
5
*
6
6
*This is an implementation of LZ compression for PostgreSQL.
7
7
*It uses a simple history table and generates 2-3 byte tags
@@ -283,7 +283,8 @@ static PGLZ_HistEntry hist_entries[PGLZ_HISTORY_SIZE];
283
283
*Adds a new entry to the history table.
284
284
* ----------
285
285
*/
286
- #define pglz_hist_add (_hs ,_he ,_hn ,_s ,_e ) {\
286
+ #define pglz_hist_add (_hs ,_he ,_hn ,_s ,_e ) \
287
+ do {\
287
288
int __hindex = pglz_hist_idx((_s),(_e));\
288
289
if ((_he)[(_hn)].prev == NULL) {\
289
290
(_hs)[__hindex] = (_he)[(_hn)].next;\
@@ -303,7 +304,7 @@ static PGLZ_HistEntry hist_entries[PGLZ_HISTORY_SIZE];
303
304
if (++(_hn) >= PGLZ_HISTORY_SIZE) {\
304
305
(_hn) = 0;\
305
306
}\
306
- }
307
+ } while (0)
307
308
308
309
309
310
/* ----------
@@ -312,15 +313,16 @@ static PGLZ_HistEntry hist_entries[PGLZ_HISTORY_SIZE];
312
313
*Outputs the last and allocates a new control byte if needed.
313
314
* ----------
314
315
*/
315
- #define pglz_out_ctrl (__ctrlp ,__ctrlb ,__ctrl ,__buf ) {\
316
+ #define pglz_out_ctrl (__ctrlp ,__ctrlb ,__ctrl ,__buf ) \
317
+ do { \
316
318
if ((__ctrl & 0xff) == 0)\
317
319
{\
318
320
*__ctrlp = __ctrlb;\
319
321
__ctrlp = __buf++;\
320
322
__ctrlb = 0;\
321
323
__ctrl = 1;\
322
324
}\
323
- }
325
+ } while (0)
324
326
325
327
326
328
/* ----------
@@ -330,11 +332,12 @@ static PGLZ_HistEntry hist_entries[PGLZ_HISTORY_SIZE];
330
332
*appropriate control bit.
331
333
* ----------
332
334
*/
333
- #define pglz_out_literal (_ctrlp ,_ctrlb ,_ctrl ,_buf ,_byte ) {\
335
+ #define pglz_out_literal (_ctrlp ,_ctrlb ,_ctrl ,_buf ,_byte ) \
336
+ do { \
334
337
pglz_out_ctrl(_ctrlp,_ctrlb,_ctrl,_buf);\
335
338
*_buf++ = (unsigned char)(_byte);\
336
339
_ctrl <<= 1;\
337
- }
340
+ } while (0)
338
341
339
342
340
343
/* ----------
@@ -345,7 +348,8 @@ static PGLZ_HistEntry hist_entries[PGLZ_HISTORY_SIZE];
345
348
*appropriate control bit.
346
349
* ----------
347
350
*/
348
- #define pglz_out_tag (_ctrlp ,_ctrlb ,_ctrl ,_buf ,_len ,_off ) {\
351
+ #define pglz_out_tag (_ctrlp ,_ctrlb ,_ctrl ,_buf ,_len ,_off ) \
352
+ do { \
349
353
pglz_out_ctrl(_ctrlp,_ctrlb,_ctrl,_buf);\
350
354
_ctrlb |= _ctrl;\
351
355
_ctrl <<= 1;\
@@ -360,7 +364,7 @@ static PGLZ_HistEntry hist_entries[PGLZ_HISTORY_SIZE];
360
364
_buf[1] = (unsigned char)((_off) & 0xff);\
361
365
_buf += 2;\
362
366
}\
363
- }
367
+ } while (0)
364
368
365
369
366
370
/* ----------