From f450695e8899fcaffd1da06b6ef1b7f39abcac89 Mon Sep 17 00:00:00 2001 From: Michael Paquier Date: Wed, 21 Dec 2022 10:39:06 +0900 Subject: [PATCH] Make more consistent some translated strings related to compression This commit changes some of the bbstreamer files and pg_dump to use the same style as a few other places (like common/compression.c), where the name of the compression method is not part of the string, but an argument of it. This reduces a bit the translation work with less string patterns. Discussion: https://postgr.es/m/Y5/5tdK+4n3clvtU@paquier.xyz --- src/bin/pg_basebackup/bbstreamer_gzip.c | 4 ++-- src/bin/pg_basebackup/bbstreamer_lz4.c | 4 ++-- src/bin/pg_basebackup/bbstreamer_zstd.c | 4 ++-- src/bin/pg_dump/compress_io.c | 10 +++++----- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/bin/pg_basebackup/bbstreamer_gzip.c b/src/bin/pg_basebackup/bbstreamer_gzip.c index c3455ffbdd..ad1b79e6f2 100644 --- a/src/bin/pg_basebackup/bbstreamer_gzip.c +++ b/src/bin/pg_basebackup/bbstreamer_gzip.c @@ -113,7 +113,7 @@ bbstreamer_gzip_writer_new(char *pathname, FILE *file, return &streamer->base; #else - pg_fatal("this build does not support gzip compression"); + pg_fatal("this build does not support compression with %s", "gzip"); return NULL; /* keep compiler quiet */ #endif } @@ -246,7 +246,7 @@ bbstreamer_gzip_decompressor_new(bbstreamer *next) return &streamer->base; #else - pg_fatal("this build does not support gzip compression"); + pg_fatal("this build does not support compression with %s", "gzip"); return NULL; /* keep compiler quiet */ #endif } diff --git a/src/bin/pg_basebackup/bbstreamer_lz4.c b/src/bin/pg_basebackup/bbstreamer_lz4.c index ed2aa01305..14282c4833 100644 --- a/src/bin/pg_basebackup/bbstreamer_lz4.c +++ b/src/bin/pg_basebackup/bbstreamer_lz4.c @@ -97,7 +97,7 @@ bbstreamer_lz4_compressor_new(bbstreamer *next, pg_compress_specification *compr return &streamer->base; #else - pg_fatal("this build does not support lz4 compression"); + pg_fatal("this build does not support compression with %s", "LZ4"); return NULL; /* keep compiler quiet */ #endif } @@ -295,7 +295,7 @@ bbstreamer_lz4_decompressor_new(bbstreamer *next) return &streamer->base; #else - pg_fatal("this build does not support lz4 compression"); + pg_fatal("this build does not support compression with %s", "LZ4"); return NULL; /* keep compiler quiet */ #endif } diff --git a/src/bin/pg_basebackup/bbstreamer_zstd.c b/src/bin/pg_basebackup/bbstreamer_zstd.c index 1207dd771a..72cd052c7d 100644 --- a/src/bin/pg_basebackup/bbstreamer_zstd.c +++ b/src/bin/pg_basebackup/bbstreamer_zstd.c @@ -113,7 +113,7 @@ bbstreamer_zstd_compressor_new(bbstreamer *next, pg_compress_specification *comp return &streamer->base; #else - pg_fatal("this build does not support zstd compression"); + pg_fatal("this build does not support compression with %s", "ZSTD"); return NULL; /* keep compiler quiet */ #endif } @@ -268,7 +268,7 @@ bbstreamer_zstd_decompressor_new(bbstreamer *next) return &streamer->base; #else - pg_fatal("this build does not support zstd compression"); + pg_fatal("this build does not support compression with %s", "ZSTD"); return NULL; /* keep compiler quiet */ #endif } diff --git a/src/bin/pg_dump/compress_io.c b/src/bin/pg_dump/compress_io.c index a7df600cc0..26967eb618 100644 --- a/src/bin/pg_dump/compress_io.c +++ b/src/bin/pg_dump/compress_io.c @@ -101,7 +101,7 @@ AllocateCompressor(const pg_compress_specification compression_spec, #ifndef HAVE_LIBZ if (compression_spec.algorithm == PG_COMPRESSION_GZIP) - pg_fatal("not built with zlib support"); + pg_fatal("this build does not support compression with %s", "gzip"); #endif cs = (CompressorState *) pg_malloc0(sizeof(CompressorState)); @@ -135,7 +135,7 @@ ReadDataFromArchive(ArchiveHandle *AH, #ifdef HAVE_LIBZ ReadDataFromArchiveZlib(AH, readF); #else - pg_fatal("not built with zlib support"); + pg_fatal("this build does not support compression with %s", "gzip"); #endif } } @@ -153,7 +153,7 @@ WriteDataToArchive(ArchiveHandle *AH, CompressorState *cs, #ifdef HAVE_LIBZ WriteDataToArchiveZlib(AH, cs, data, dLen); #else - pg_fatal("not built with zlib support"); + pg_fatal("this build does not support compression with %s", "gzip"); #endif break; case PG_COMPRESSION_NONE: @@ -482,7 +482,7 @@ cfopen_write(const char *path, const char *mode, fp = cfopen(fname, mode, compression_spec); free_keep_errno(fname); #else - pg_fatal("not built with zlib support"); + pg_fatal("this build does not support compression with %s", "gzip"); fp = NULL; /* keep compiler quiet */ #endif } @@ -526,7 +526,7 @@ cfopen(const char *path, const char *mode, fp = NULL; } #else - pg_fatal("not built with zlib support"); + pg_fatal("this build does not support compression with %s", "gzip"); #endif } else -- 2.30.2