mirror of
https://github.com/postgres/postgres.git
synced 2025-09-11 00:12:06 +03:00
Since C99, there can be a trailing comma after the last value in an enum definition. A lot of new code has been introducing this style on the fly. Some new patches are now taking an inconsistent approach to this. Some add the last comma on the fly if they add a new last value, some are trying to preserve the existing style in each place, some are even dropping the last comma if there was one. We could nudge this all in a consistent direction if we just add the trailing commas everywhere once. I omitted a few places where there was a fixed "last" value that will always stay last. I also skipped the header files of libpq and ecpg, in case people want to use those with older compilers. There were also a small number of cases where the enum type wasn't used anywhere (but the enum values were), which ended up confusing pgindent a bit, so I left those alone. Discussion: https://www.postgresql.org/message-id/flat/386f8c45-c8ac-4681-8add-e3b0852c1620%40eisentraut.org
54 lines
1.6 KiB
C
54 lines
1.6 KiB
C
/*-------------------------------------------------------------------------
|
|
*
|
|
* compression.h
|
|
*
|
|
* Shared definitions for compression methods and specifications.
|
|
*
|
|
* Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group
|
|
*
|
|
* IDENTIFICATION
|
|
* src/include/common/compression.h
|
|
*-------------------------------------------------------------------------
|
|
*/
|
|
|
|
#ifndef PG_COMPRESSION_H
|
|
#define PG_COMPRESSION_H
|
|
|
|
/*
|
|
* These values are stored in disk, for example in files generated by pg_dump.
|
|
* Create the necessary backwards compatibility layers if their order changes.
|
|
*/
|
|
typedef enum pg_compress_algorithm
|
|
{
|
|
PG_COMPRESSION_NONE,
|
|
PG_COMPRESSION_GZIP,
|
|
PG_COMPRESSION_LZ4,
|
|
PG_COMPRESSION_ZSTD,
|
|
} pg_compress_algorithm;
|
|
|
|
#define PG_COMPRESSION_OPTION_WORKERS (1 << 0)
|
|
#define PG_COMPRESSION_OPTION_LONG_DISTANCE (1 << 1)
|
|
|
|
typedef struct pg_compress_specification
|
|
{
|
|
pg_compress_algorithm algorithm;
|
|
unsigned options; /* OR of PG_COMPRESSION_OPTION constants */
|
|
int level;
|
|
int workers;
|
|
bool long_distance;
|
|
char *parse_error; /* NULL if parsing was OK, else message */
|
|
} pg_compress_specification;
|
|
|
|
extern void parse_compress_options(const char *option, char **algorithm,
|
|
char **detail);
|
|
extern bool parse_compress_algorithm(char *name, pg_compress_algorithm *algorithm);
|
|
extern const char *get_compress_algorithm_name(pg_compress_algorithm algorithm);
|
|
|
|
extern void parse_compress_specification(pg_compress_algorithm algorithm,
|
|
char *specification,
|
|
pg_compress_specification *result);
|
|
|
|
extern char *validate_compress_specification(pg_compress_specification *);
|
|
|
|
#endif
|