diff options
author | Peter Eisentraut | 2024-06-21 05:50:02 +0000 |
---|---|---|
committer | Peter Eisentraut | 2024-06-21 05:53:30 +0000 |
commit | 02bbc3c83aec597e4b8c873916e9e29f3d02b132 (patch) | |
tree | 3215858aa089784ac27c86346792dcdbe6529fdb /src/bin/pg_verifybackup/pg_verifybackup.c | |
parent | 15cd9a3881b030a1a4bddc809f038f86ec27e66d (diff) |
parse_manifest: Use const char *
This adapts the manifest parsing code to take advantage of the
const-ified jsonapi.
Reviewed-by: Andrew Dunstan <[email protected]>
Discussion: https://www.postgresql.org/message-id/flat/f732b014-f614-4600-a437-dba5a2c3738b%40eisentraut.org
Diffstat (limited to 'src/bin/pg_verifybackup/pg_verifybackup.c')
-rw-r--r-- | src/bin/pg_verifybackup/pg_verifybackup.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/bin/pg_verifybackup/pg_verifybackup.c b/src/bin/pg_verifybackup/pg_verifybackup.c index fd610c20a65..d77e70fbe38 100644 --- a/src/bin/pg_verifybackup/pg_verifybackup.c +++ b/src/bin/pg_verifybackup/pg_verifybackup.c @@ -52,7 +52,7 @@ typedef struct manifest_file { uint32 status; /* hash status */ - char *pathname; + const char *pathname; size_t size; pg_checksum_type checksum_type; int checksum_length; @@ -70,7 +70,7 @@ typedef struct manifest_file */ #define SH_PREFIX manifest_files #define SH_ELEMENT_TYPE manifest_file -#define SH_KEY_TYPE char * +#define SH_KEY_TYPE const char * #define SH_KEY pathname #define SH_HASH_KEY(tb, key) hash_string(key) #define SH_EQUAL(tb, a, b) (strcmp(a, b) == 0) @@ -123,7 +123,7 @@ static void verifybackup_version_cb(JsonManifestParseContext *context, static void verifybackup_system_identifier(JsonManifestParseContext *context, uint64 manifest_system_identifier); static void verifybackup_per_file_cb(JsonManifestParseContext *context, - char *pathname, size_t size, + const char *pathname, size_t size, pg_checksum_type checksum_type, int checksum_length, uint8 *checksum_payload); @@ -155,7 +155,7 @@ static void report_backup_error(verifier_context *context, pg_attribute_printf(2, 3); static void report_fatal_error(const char *pg_restrict fmt,...) pg_attribute_printf(1, 2) pg_attribute_noreturn(); -static bool should_ignore_relpath(verifier_context *context, char *relpath); +static bool should_ignore_relpath(verifier_context *context, const char *relpath); static void progress_report(bool finished); static void usage(void); @@ -546,7 +546,7 @@ verifybackup_system_identifier(JsonManifestParseContext *context, */ static void verifybackup_per_file_cb(JsonManifestParseContext *context, - char *pathname, size_t size, + const char *pathname, size_t size, pg_checksum_type checksum_type, int checksum_length, uint8 *checksum_payload) { @@ -852,7 +852,7 @@ verify_file_checksum(verifier_context *context, manifest_file *m, char *fullpath, uint8 *buffer) { pg_checksum_context checksum_ctx; - char *relpath = m->pathname; + const char *relpath = m->pathname; int fd; int rc; size_t bytes_read = 0; @@ -1016,13 +1016,13 @@ report_fatal_error(const char *pg_restrict fmt,...) * "aa/bb" is not a prefix of "aa/bbb", but it is a prefix of "aa/bb/cc". */ static bool -should_ignore_relpath(verifier_context *context, char *relpath) +should_ignore_relpath(verifier_context *context, const char *relpath) { SimpleStringListCell *cell; for (cell = context->ignore_list.head; cell != NULL; cell = cell->next) { - char *r = relpath; + const char *r = relpath; char *v = cell->val; while (*v != '\0' && *r == *v) |