From 30048dddef355b2788c49cdd0a7d500eb887cad6 Mon Sep 17 00:00:00 2001 From: TapTap Date: Tue, 8 Sep 2026 18:38:50 +0200 Subject: [PATCH] style: clang-format 18 (CI lint) on Wave-A sources Reflow usage.c, config.c, file.c, test_client_cli.c, test_file.c so the clang-format check passes. Whitespace-only; no behavior change. --- src/client/usage.c | 3 ++- src/shared/config.c | 20 +++++++++----------- src/shared/file.c | 9 ++++----- tests/test_client_cli.c | 2 ++ tests/test_file.c | 8 ++++---- 5 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/client/usage.c b/src/client/usage.c index 0029121..08ab4c2 100644 --- a/src/client/usage.c +++ b/src/client/usage.c @@ -182,7 +182,8 @@ void print_usage(void) { printf(" --copy-unsafe-links Only transform unsafe symlinks into referent files\n"); printf(" -S, --sparse Handle sparse files efficiently\n"); printf(" --inplace Update files in-place (no temp+rename)\n"); - printf(" --preallocate Allocate destination file space up front (fail-fast on full disk)\n"); + printf( + " --preallocate Allocate destination file space up front (fail-fast on full disk)\n"); printf(" --append Resume a shorter destination by appending only its tail\n"); printf(" (prefix is not verified; requires --incremental)\n"); printf(" --append-verify Like --append, but verifies the retained prefix checksum\n"); diff --git a/src/shared/config.c b/src/shared/config.c index 232da44..11c197e 100644 --- a/src/shared/config.c +++ b/src/shared/config.c @@ -179,13 +179,12 @@ static bool validate_received_config(const Config* config) { valid_wire_bool(config->existing) && valid_wire_bool(config->update) && valid_wire_bool(config->inplace) && valid_wire_bool(config->append) && valid_wire_bool(config->use_fsync) && valid_wire_bool(config->append_verify) && - valid_wire_bool(config->delete_excluded) && valid_wire_bool(config->force_delete) && - valid_wire_bool(config->delete_missing_args) && valid_wire_bool(config->delete_after) && - valid_wire_bool(config->preallocate) && - valid_wire_bool(config->delete_delay) && valid_wire_bool(config->delete_during) && - valid_wire_bool(config->relative) && valid_wire_bool(config->prune_empty_dirs) && - valid_wire_bool(config->delay_updates) && valid_wire_bool(config->mkpath) && - !(config->delay_updates && config->inplace) && + valid_wire_bool(config->delete_excluded) && valid_wire_bool(config->force_delete) && + valid_wire_bool(config->delete_missing_args) && valid_wire_bool(config->delete_after) && + valid_wire_bool(config->preallocate) && valid_wire_bool(config->delete_delay) && + valid_wire_bool(config->delete_during) && valid_wire_bool(config->relative) && + valid_wire_bool(config->prune_empty_dirs) && valid_wire_bool(config->delay_updates) && + valid_wire_bool(config->mkpath) && !(config->delay_updates && config->inplace) && !(config->delay_updates && delay_updates_staging_name_conflict(config->backup_dir)) && valid_wire_bool(config->partial) && valid_wire_bool(config->delete_before) && valid_wire_bool(config->checksum) && valid_wire_bool(config->eight_bit_output) && @@ -450,10 +449,9 @@ static bool send_selection_options(int fd, const Config* c) { send_int(fd, c->use_fsync) && send_int(fd, c->append_verify) && send_int(fd, c->delete_excluded) && send_int(fd, c->force_delete) && send_int(fd, c->delete_missing_args) && send_int(fd, c->delete_after) && - send_int(fd, c->preallocate) && - send_n_data(fd, &c->max_delete, sizeof(c->max_delete)) && send_int(fd, c->relative) && - send_int(fd, c->prune_empty_dirs) && send_int(fd, c->mkpath) && - send_int(fd, c->delete_during) && send_int(fd, c->delete_delay); + send_int(fd, c->preallocate) && send_n_data(fd, &c->max_delete, sizeof(c->max_delete)) && + send_int(fd, c->relative) && send_int(fd, c->prune_empty_dirs) && + send_int(fd, c->mkpath) && send_int(fd, c->delete_during) && send_int(fd, c->delete_delay); } static bool send_skip_compress_options(int fd, const Config* c) { diff --git a/src/shared/file.c b/src/shared/file.c index 648b666..7de1bd1 100644 --- a/src/shared/file.c +++ b/src/shared/file.c @@ -562,9 +562,8 @@ static bool file_to_disk_secure_impl(const char* path, const void* data, if (preallocate && data_size > 0) { prealloc_rc = preallocate_fd(fd, data_size); if (prealloc_rc != 0) - log_message(LOG_LEVEL_ERROR, - "preallocate failed for '%s' (%s); transfer aborted", - path, strerror(prealloc_rc)); + log_message(LOG_LEVEL_ERROR, "preallocate failed for '%s' (%s); transfer aborted", path, + strerror(prealloc_rc)); } if (prealloc_rc == 0) { /* posix_fallocate does not guarantee the fd's file offset is left @@ -662,8 +661,8 @@ static bool file_to_disk_secure_impl(const char* path, const void* data, if (preallocate && data_size > 0) { prealloc_rc = preallocate_fd(fd, data_size); if (prealloc_rc != 0) - log_message(LOG_LEVEL_ERROR, "preallocate failed for '%s' (%s); transfer aborted", - path, strerror(prealloc_rc)); + log_message(LOG_LEVEL_ERROR, "preallocate failed for '%s' (%s); transfer aborted", path, + strerror(prealloc_rc)); } if (prealloc_rc == 0) { lseek(fd, 0, SEEK_SET); diff --git a/tests/test_client_cli.c b/tests/test_client_cli.c index e80a7cf..51950a3 100644 --- a/tests/test_client_cli.c +++ b/tests/test_client_cli.c @@ -2237,6 +2237,8 @@ static void test_parse_args_rejects_malformed_identity() { int positional_args[2]; int positional_count = 0; EXPECT_EQ_INT(parse_args(cfg, 2, argv, positional_args, &positional_count), -1); + config_delete(cfg); +} /* --preallocate parses as a boolean flag and validates cleanly. */ static void test_parse_args_preallocate() { diff --git a/tests/test_file.c b/tests/test_file.c index e913478..88a8129 100644 --- a/tests/test_file.c +++ b/tests/test_file.c @@ -391,8 +391,8 @@ static void test_file_write_to_disk_with_fsync() { static void test_file_write_to_disk_preallocate_atomic() { const char* path = "test_file_write_prealloc_atomic.txt"; const char* content = "prealloc atomic content"; - EXPECT_TRUE(file_to_disk_secure(path, content, strlen(content), false, false, true, NULL, false, - NULL)); + EXPECT_TRUE( + file_to_disk_secure(path, content, strlen(content), false, false, true, NULL, false, NULL)); struct stat st; EXPECT_EQ_INT(stat(path, &st), 0); EXPECT_EQ_INT((int)st.st_size, (int)strlen(content)); @@ -409,8 +409,8 @@ static void test_file_write_to_disk_preallocate_atomic() { static void test_file_write_to_disk_preallocate_inplace() { const char* path = "test_file_write_prealloc_inplace.txt"; const char* content = "prealloc inplace content"; - EXPECT_TRUE(file_to_disk_secure(path, content, strlen(content), true, false, true, NULL, false, - NULL)); + EXPECT_TRUE( + file_to_disk_secure(path, content, strlen(content), true, false, true, NULL, false, NULL)); struct stat st; EXPECT_EQ_INT(stat(path, &st), 0); EXPECT_EQ_INT((int)st.st_size, (int)strlen(content));