Skip to content

Commit 0983e62

Browse files
committed
Explains warnings about unused variables
1 parent d2b6fd6 commit 0983e62

File tree

4 files changed

+7
-0
lines changed

4 files changed

+7
-0
lines changed

src/client.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ client_t *client_create(uint16_t id, socket_t *tcp_sock, socket_t *udp_sock,
8282
*/
8383
client_t *client_copy(client_t *dst, client_t *src, size_t len)
8484
{
85+
(void)len; // must be compatible with memcpy signature
8586
if(!dst || !src)
8687
return NULL;
8788

@@ -103,6 +104,7 @@ client_t *client_copy(client_t *dst, client_t *src, size_t len)
103104
*/
104105
int client_cmp(client_t *c1, client_t *c2, size_t len)
105106
{
107+
(void)len; // must be compatible with memcmp signature
106108
return c1->id - c2->id;
107109
}
108110

src/destination.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ destination_t *destination_create(const char *address)
6666

6767
destination_t *destination_copy(destination_t *dst, destination_t *src, size_t len)
6868
{
69+
(void)len; // must be compatible with memcpy signature
6970
size_t host_len, port_len;
7071

7172
host_len = src->host ? strlen(src->host) : 0;
@@ -116,6 +117,8 @@ static int strcmp_null(const char *s1, const char *s2)
116117

117118
int destination_cmp(destination_t *d1, destination_t *d2, size_t len)
118119
{
120+
(void)len; // must be compatible with memcmp signature
121+
119122
int cmp;
120123

121124
cmp = strcmp_null(d1->host, d2->host);

src/list.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ void list_free(list_t *list);
5656

5757
static _inline_ int int_cmp(int *i, int *j, size_t sz)
5858
{
59+
(void)sz; // must be compatible with memcpy signature
5960
return *i - *j;
6061
}
6162

src/udpclient.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ bool isnumber(const char* str) {
7575
*/
7676
int udpclient(int argc, char* argv[])
7777
{
78+
(void)argc; // unused
7879
char *lhost, *lport, *phost, *pport, *rhost, *rport;
7980
list_t *clients;
8081
list_t *conn_clients;

0 commit comments

Comments
 (0)