From 3258534e994549e07bc65e2ddf11636078f4a8d2 Mon Sep 17 00:00:00 2001 From: Wayne Davison Date: Thu, 18 Aug 2022 17:33:11 -0700 Subject: [PATCH] Change name_num_obj struct to use a name_num_item pointer. --- checksum.c | 24 +++++++++++++----------- compat.c | 20 +++++++++++--------- rsync.h | 2 +- 3 files changed, 25 insertions(+), 21 deletions(-) diff --git a/checksum.c b/checksum.c index 758b489d..7eb50f17 100644 --- a/checksum.c +++ b/checksum.c @@ -42,21 +42,23 @@ extern int protocol_version; extern int proper_seed_order; extern const char *checksum_choice; -struct name_num_obj valid_checksums = { - "checksum", NULL, NULL, 0, 0, { +struct name_num_item valid_checksums_items[] = { #ifdef SUPPORT_XXH3 - { CSUM_XXH3_128, "xxh128", NULL }, - { CSUM_XXH3_64, "xxh3", NULL }, + { CSUM_XXH3_128, "xxh128", NULL }, + { CSUM_XXH3_64, "xxh3", NULL }, #endif #ifdef SUPPORT_XXHASH - { CSUM_XXH64, "xxh64", NULL }, - { CSUM_XXH64, "xxhash", NULL }, + { CSUM_XXH64, "xxh64", NULL }, + { CSUM_XXH64, "xxhash", NULL }, #endif - { CSUM_MD5, "md5", NULL }, - { CSUM_MD4, "md4", NULL }, - { CSUM_NONE, "none", NULL }, - { 0, NULL, NULL } - } + { CSUM_MD5, "md5", NULL }, + { CSUM_MD4, "md4", NULL }, + { CSUM_NONE, "none", NULL }, + { 0, NULL, NULL } +}; + +struct name_num_obj valid_checksums = { + "checksum", NULL, NULL, 0, 0, valid_checksums_items }; int xfersum_type = 0; /* used for the file transfer checksums */ diff --git a/compat.c b/compat.c index b46eb199..622910eb 100644 --- a/compat.c +++ b/compat.c @@ -91,19 +91,21 @@ int filesfrom_convert = 0; #define MAX_NSTR_STRLEN 256 -struct name_num_obj valid_compressions = { - "compress", NULL, NULL, 0, 0, { +struct name_num_item valid_compressions_items[] = { #ifdef SUPPORT_ZSTD - { CPRES_ZSTD, "zstd", NULL }, + { CPRES_ZSTD, "zstd", NULL }, #endif #ifdef SUPPORT_LZ4 - { CPRES_LZ4, "lz4", NULL }, + { CPRES_LZ4, "lz4", NULL }, #endif - { CPRES_ZLIBX, "zlibx", NULL }, - { CPRES_ZLIB, "zlib", NULL }, - { CPRES_NONE, "none", NULL }, - { 0, NULL, NULL } - } + { CPRES_ZLIBX, "zlibx", NULL }, + { CPRES_ZLIB, "zlib", NULL }, + { CPRES_NONE, "none", NULL }, + { 0, NULL, NULL } +}; + +struct name_num_obj valid_compressions = { + "compress", NULL, NULL, 0, 0, valid_compressions_items }; #define CF_INC_RECURSE (1<<0) diff --git a/rsync.h b/rsync.h index 1cc037c5..e29c37c3 100644 --- a/rsync.h +++ b/rsync.h @@ -1172,7 +1172,7 @@ struct name_num_obj { uchar *saw; int saw_len; int negotiated_num; - struct name_num_item list[10]; /* we'll get a compile error/warning if this is ever too small */ + struct name_num_item *list; }; #ifdef EXTERNAL_ZLIB -- 2.47.2