1From 651425fced0691d9063fe417388ba6ca1c38c40b Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Mon, 29 Aug 2022 19:53:28 -0700
4Subject: [PATCH] Add missing prototypes to function declarations
5
6With Clang 15+ compiler -Wstrict-prototypes is triggering warnings which
7are turned into errors with -Werror, this fixes the problem by adding
8missing prototypes
9
10Fixes errors like
11| log.c:134:24: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
12| static void syslog_init()
13|                        ^
14|                         void
15
16Upstream-Status: Submitted [https://lists.samba.org/archive/rsync/2022-August/032858.html]
17Signed-off-by: Khem Raj <raj.khem@gmail.com>
18
19---
20 checksum.c       | 2 +-
21 exclude.c        | 2 +-
22 hlink.c          | 3 +--
23 lib/pool_alloc.c | 2 +-
24 log.c            | 2 +-
25 main.c           | 2 +-
26 syscall.c        | 4 ++--
27 zlib/crc32.c     | 2 +-
28 zlib/trees.c     | 2 +-
29 zlib/zutil.c     | 4 ++--
30 10 files changed, 12 insertions(+), 13 deletions(-)
31
32diff --git a/checksum.c b/checksum.c
33index 60de365..67a9e16 100644
34--- a/checksum.c
35+++ b/checksum.c
36@@ -778,7 +778,7 @@ static void verify_digest(struct name_num_item *nni, BOOL check_auth_list)
37 }
38 #endif
39
40-void init_checksum_choices()
41+void init_checksum_choices(void)
42 {
43 #if defined SUPPORT_XXH3 || defined USE_OPENSSL
44 	struct name_num_item *nni;
45diff --git a/exclude.c b/exclude.c
46index ffe55b1..a85ea76 100644
47--- a/exclude.c
48+++ b/exclude.c
49@@ -363,7 +363,7 @@ void implied_include_partial_string(const char *s_start, const char *s_end)
50 	memcpy(partial_string_buf, s_start, partial_string_len);
51 }
52
53-void free_implied_include_partial_string()
54+void free_implied_include_partial_string(void)
55 {
56 	if (partial_string_buf) {
57 		if (partial_string_len)
58diff --git a/hlink.c b/hlink.c
59index 20291f2..5c26a6b 100644
60--- a/hlink.c
61+++ b/hlink.c
62@@ -117,8 +117,7 @@ static void match_gnums(int32 *ndx_list, int ndx_count)
63 	struct ht_int32_node *node = NULL;
64 	int32 gnum, gnum_next;
65
66-	qsort(ndx_list, ndx_count, sizeof ndx_list[0], (int (*)()) hlink_compare_gnum);
67-
68+	qsort(ndx_list, ndx_count, sizeof ndx_list[0], (int (*)(const void *, const void *)) hlink_compare_gnum);
69 	for (from = 0; from < ndx_count; from++) {
70 		file = hlink_flist->sorted[ndx_list[from]];
71 		gnum = F_HL_GNUM(file);
72diff --git a/lib/pool_alloc.c b/lib/pool_alloc.c
73index a1a7245..4eae062 100644
74--- a/lib/pool_alloc.c
75+++ b/lib/pool_alloc.c
76@@ -9,7 +9,7 @@ struct alloc_pool
77 	size_t			size;		/* extent size		*/
78 	size_t			quantum;	/* allocation quantum	*/
79 	struct pool_extent	*extents;	/* top extent is "live" */
80-	void			(*bomb)();	/* called if malloc fails */
81+	void			(*bomb)(const char *, const char *, int);	/* called if malloc fails */
82 	int			flags;
83
84 	/* statistical data */
85diff --git a/log.c b/log.c
86index e4ba1cc..8482b71 100644
87--- a/log.c
88+++ b/log.c
89@@ -131,7 +131,7 @@ static void logit(int priority, const char *buf)
90 	}
91 }
92
93-static void syslog_init()
94+static void syslog_init(void)
95 {
96 	int options = LOG_PID;
97
98diff --git a/main.c b/main.c
99index d2a7b9b..c50af45 100644
100--- a/main.c
101+++ b/main.c
102@@ -244,7 +244,7 @@ void read_del_stats(int f)
103 	stats.deleted_files += stats.deleted_specials = read_varint(f);
104 }
105
106-static void become_copy_as_user()
107+static void become_copy_as_user(void)
108 {
109 	char *gname;
110 	uid_t uid;
111diff --git a/syscall.c b/syscall.c
112index d92074a..92ca86d 100644
113--- a/syscall.c
114+++ b/syscall.c
115@@ -389,9 +389,9 @@ OFF_T do_lseek(int fd, OFF_T offset, int whence)
116 {
117 #ifdef HAVE_LSEEK64
118 #if !SIZEOF_OFF64_T
119-	OFF_T lseek64();
120+	OFF_T lseek64(int fd, OFF_T offset, int whence);
121 #else
122-	off64_t lseek64();
123+	off64_t lseek64(int fd, off64_t offset, int whence);
124 #endif
125 	return lseek64(fd, offset, whence);
126 #else
127diff --git a/zlib/crc32.c b/zlib/crc32.c
128index 05733f4..50c6c02 100644
129--- a/zlib/crc32.c
130+++ b/zlib/crc32.c
131@@ -187,7 +187,7 @@ local void write_table(out, table)
132 /* =========================================================================
133  * This function can be used by asm versions of crc32()
134  */
135-const z_crc_t FAR * ZEXPORT get_crc_table()
136+const z_crc_t FAR * ZEXPORT get_crc_table(void)
137 {
138 #ifdef DYNAMIC_CRC_TABLE
139     if (crc_table_empty)
140diff --git a/zlib/trees.c b/zlib/trees.c
141index 9c66770..0d9047e 100644
142--- a/zlib/trees.c
143+++ b/zlib/trees.c
144@@ -231,7 +231,7 @@ local void send_bits(s, value, length)
145 /* ===========================================================================
146  * Initialize the various 'constant' tables.
147  */
148-local void tr_static_init()
149+local void tr_static_init(void)
150 {
151 #if defined(GEN_TREES_H) || !defined(STDC)
152     static int static_init_done = 0;
153diff --git a/zlib/zutil.c b/zlib/zutil.c
154index bbba7b2..61f8dc9 100644
155--- a/zlib/zutil.c
156+++ b/zlib/zutil.c
157@@ -27,12 +27,12 @@ z_const char * const z_errmsg[10] = {
158 ""};
159
160
161-const char * ZEXPORT zlibVersion()
162+const char * ZEXPORT zlibVersion(void)
163 {
164     return ZLIB_VERSION;
165 }
166
167-uLong ZEXPORT zlibCompileFlags()
168+uLong ZEXPORT zlibCompileFlags(void)
169 {
170     uLong flags;
171
172