summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2014-09-06 01:33:26 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2014-09-06 01:33:26 +0200
commit58b8518100c8b306d5b6a3d87b4a83a1ae383a09 (patch)
tree698accb30882c4e9bfb39bf0568a4dee691b7f0a /src
parent1e540bed623cb6080f1aa2b6afd39600ed25a8dd (diff)
downloadfastd-58b8518100c8b306d5b6a3d87b4a83a1ae383a09.tar
fastd-58b8518100c8b306d5b6a3d87b4a83a1ae383a09.zip
Move UNUSED attribute to the start of arguments to help editors understand the syntax
Diffstat (limited to 'src')
-rw-r--r--src/crypto/cipher/null/memcpy/null_memcpy.c6
-rw-r--r--src/fastd.h2
-rw-r--r--src/lex.c2
-rw-r--r--src/methods/cipher_test/cipher_test.c2
-rw-r--r--src/methods/composed_gmac/composed_gmac.c2
-rw-r--r--src/methods/composed_umac/composed_umac.c2
-rw-r--r--src/methods/generic_gmac/generic_gmac.c2
-rw-r--r--src/methods/generic_poly1305/generic_poly1305.c2
-rw-r--r--src/methods/generic_umac/generic_umac.c2
-rw-r--r--src/methods/null/null.c14
-rw-r--r--src/methods/xsalsa20_poly1305/xsalsa20_poly1305.c10
-rw-r--r--src/peer.h2
-rw-r--r--src/poll.c2
-rw-r--r--src/protocols/ec25519_fhmqvc/handshake.c2
14 files changed, 26 insertions, 26 deletions
diff --git a/src/crypto/cipher/null/memcpy/null_memcpy.c b/src/crypto/cipher/null/memcpy/null_memcpy.c
index 1ad5784..1f090ca 100644
--- a/src/crypto/cipher/null/memcpy/null_memcpy.c
+++ b/src/crypto/cipher/null/memcpy/null_memcpy.c
@@ -34,18 +34,18 @@
/** Doesn't do anything as the null cipher doesn't use any state */
-static fastd_cipher_state_t * null_init(const uint8_t *key UNUSED) {
+static fastd_cipher_state_t * null_init(UNUSED const uint8_t *key) {
return NULL;
}
/** Just copies the input data to the output */
-static bool null_memcpy(const fastd_cipher_state_t *state UNUSED, fastd_block128_t *out, const fastd_block128_t *in, size_t len, const uint8_t *iv UNUSED) {
+static bool null_memcpy(UNUSED const fastd_cipher_state_t *state, fastd_block128_t *out, const fastd_block128_t *in, size_t len, UNUSED const uint8_t *iv) {
memcpy(out, in, len);
return true;
}
/** Doesn't do anything as the null cipher doesn't use any state */
-static void null_free(fastd_cipher_state_t *state UNUSED) {
+static void null_free(UNUSED fastd_cipher_state_t *state) {
}
/** The memcpy null implementation */
diff --git a/src/fastd.h b/src/fastd.h
index 464a7fd..a5737ba 100644
--- a/src/fastd.h
+++ b/src/fastd.h
@@ -382,7 +382,7 @@ static inline size_t fastd_max_payload(void) {
}
/** Adds statistics for a single packet of a given size */
-static inline void fastd_stats_add(fastd_stats_t *stats UNUSED, size_t stat_size UNUSED) {
+static inline void fastd_stats_add(UNUSED fastd_stats_t *stats, UNUSED size_t stat_size) {
#ifdef WITH_STATUS_SOCKET
if (stat_size) {
stats->packets++;
diff --git a/src/lex.c b/src/lex.c
index c2376c6..ffcebdd 100644
--- a/src/lex.c
+++ b/src/lex.c
@@ -198,7 +198,7 @@ static void consume(fastd_lex_t *lex, bool needspace) {
}
/** Signals an error caused by an I/O error */
-static int io_error(YYSTYPE *yylval, fastd_lex_t *lex UNUSED) {
+static int io_error(YYSTYPE *yylval, UNUSED fastd_lex_t *lex) {
yylval->error = "I/O error";
return -1;
}
diff --git a/src/methods/cipher_test/cipher_test.c b/src/methods/cipher_test/cipher_test.c
index 8ff57c6..056aaea 100644
--- a/src/methods/cipher_test/cipher_test.c
+++ b/src/methods/cipher_test/cipher_test.c
@@ -132,7 +132,7 @@ static void method_session_free(fastd_method_session_state_t *session) {
/** Encrypts a packet and adds the common method header */
-static bool method_encrypt(fastd_peer_t *peer UNUSED, fastd_method_session_state_t *session, fastd_buffer_t *out, fastd_buffer_t in) {
+static bool method_encrypt(UNUSED fastd_peer_t *peer, fastd_method_session_state_t *session, fastd_buffer_t *out, fastd_buffer_t in) {
size_t tail_len = alignto(in.len, sizeof(fastd_block128_t))-in.len;
*out = fastd_buffer_alloc(in.len, alignto(COMMON_HEADBYTES, 16), sizeof(fastd_block128_t)+tail_len);
diff --git a/src/methods/composed_gmac/composed_gmac.c b/src/methods/composed_gmac/composed_gmac.c
index 86ae66b..cac24d6 100644
--- a/src/methods/composed_gmac/composed_gmac.c
+++ b/src/methods/composed_gmac/composed_gmac.c
@@ -206,7 +206,7 @@ static inline void put_size(fastd_block128_t *out, size_t len) {
}
/** Encrypts and authenticates a packet */
-static bool method_encrypt(fastd_peer_t *peer UNUSED, fastd_method_session_state_t *session, fastd_buffer_t *out, fastd_buffer_t in) {
+static bool method_encrypt(UNUSED fastd_peer_t *peer, fastd_method_session_state_t *session, fastd_buffer_t *out, fastd_buffer_t in) {
size_t tail_len = alignto(in.len, sizeof(fastd_block128_t))-in.len;
*out = fastd_buffer_alloc(sizeof(fastd_block128_t)+in.len, alignto(COMMON_HEADBYTES, 16), sizeof(fastd_block128_t)+tail_len);
diff --git a/src/methods/composed_umac/composed_umac.c b/src/methods/composed_umac/composed_umac.c
index 6c01bff..ed8225f 100644
--- a/src/methods/composed_umac/composed_umac.c
+++ b/src/methods/composed_umac/composed_umac.c
@@ -175,7 +175,7 @@ static void method_session_free(fastd_method_session_state_t *session) {
}
/** Encrypts and authenticates a packet */
-static bool method_encrypt(fastd_peer_t *peer UNUSED, fastd_method_session_state_t *session, fastd_buffer_t *out, fastd_buffer_t in) {
+static bool method_encrypt(UNUSED fastd_peer_t *peer, fastd_method_session_state_t *session, fastd_buffer_t *out, fastd_buffer_t in) {
size_t tail_len = in.len ? alignto(in.len, 2 * sizeof(fastd_block128_t))-in.len : (2 * sizeof(fastd_block128_t));
*out = fastd_buffer_alloc(sizeof(fastd_block128_t)+in.len, alignto(COMMON_HEADBYTES, 16), sizeof(fastd_block128_t)+tail_len);
diff --git a/src/methods/generic_gmac/generic_gmac.c b/src/methods/generic_gmac/generic_gmac.c
index 519c354..0e68f7e 100644
--- a/src/methods/generic_gmac/generic_gmac.c
+++ b/src/methods/generic_gmac/generic_gmac.c
@@ -177,7 +177,7 @@ static inline void put_size(fastd_block128_t *out, size_t len) {
/** Encrypts and authenticates a packet */
-static bool method_encrypt(fastd_peer_t *peer UNUSED, fastd_method_session_state_t *session, fastd_buffer_t *out, fastd_buffer_t in) {
+static bool method_encrypt(UNUSED fastd_peer_t *peer, fastd_method_session_state_t *session, fastd_buffer_t *out, fastd_buffer_t in) {
fastd_buffer_pull_head_zero(&in, sizeof(fastd_block128_t));
size_t tail_len = alignto(in.len, sizeof(fastd_block128_t))-in.len;
diff --git a/src/methods/generic_poly1305/generic_poly1305.c b/src/methods/generic_poly1305/generic_poly1305.c
index a9b1673..881ec7f 100644
--- a/src/methods/generic_poly1305/generic_poly1305.c
+++ b/src/methods/generic_poly1305/generic_poly1305.c
@@ -142,7 +142,7 @@ static void method_session_free(fastd_method_session_state_t *session) {
/** Encrypts and authenticates a packet */
-static bool method_encrypt(fastd_peer_t *peer UNUSED, fastd_method_session_state_t *session, fastd_buffer_t *out, fastd_buffer_t in) {
+static bool method_encrypt(UNUSED fastd_peer_t *peer, fastd_method_session_state_t *session, fastd_buffer_t *out, fastd_buffer_t in) {
fastd_buffer_pull_head_zero(&in, KEYBYTES);
size_t tail_len = alignto(in.len, sizeof(fastd_block128_t))-in.len;
diff --git a/src/methods/generic_umac/generic_umac.c b/src/methods/generic_umac/generic_umac.c
index 167ee79..3355fdb 100644
--- a/src/methods/generic_umac/generic_umac.c
+++ b/src/methods/generic_umac/generic_umac.c
@@ -146,7 +146,7 @@ static void method_session_free(fastd_method_session_state_t *session) {
}
/** Encrypts and authenticates a packet */
-static bool method_encrypt(fastd_peer_t *peer UNUSED, fastd_method_session_state_t *session, fastd_buffer_t *out, fastd_buffer_t in) {
+static bool method_encrypt(UNUSED fastd_peer_t *peer, fastd_method_session_state_t *session, fastd_buffer_t *out, fastd_buffer_t in) {
size_t tail_len = in.len ? alignto(in.len, 2 * sizeof(fastd_block128_t))-in.len : (2 * sizeof(fastd_block128_t));
fastd_buffer_pull_head_zero(&in, sizeof(fastd_block128_t));
diff --git a/src/methods/null/null.c b/src/methods/null/null.c
index 13b2dbd..f84cf6c 100644
--- a/src/methods/null/null.c
+++ b/src/methods/null/null.c
@@ -40,21 +40,21 @@ struct fastd_method_session_state {
/** Returns true if the name is "null" */
-static bool method_create_by_name(const char *name, fastd_method_t **method UNUSED) {
+static bool method_create_by_name(const char *name, UNUSED fastd_method_t **method) {
return !strcmp(name, "null");
}
/** Does nothing as the null provider provides only a single method */
-static void method_destroy(fastd_method_t *method UNUSED) {
+static void method_destroy(UNUSED fastd_method_t *method) {
}
/** Returns 0 */
-static size_t method_key_length(const fastd_method_t *method UNUSED) {
+static size_t method_key_length(UNUSED const fastd_method_t *method) {
return 0;
}
/** Initiates a new null session */
-static fastd_method_session_state_t * method_session_init(const fastd_method_t *method UNUSED, const uint8_t *secret UNUSED, bool initiator) {
+static fastd_method_session_state_t * method_session_init(UNUSED const fastd_method_t *method, UNUSED const uint8_t *secret, bool initiator) {
fastd_method_session_state_t *session = fastd_new(fastd_method_session_state_t);
session->valid = true;
@@ -64,7 +64,7 @@ static fastd_method_session_state_t * method_session_init(const fastd_method_t *
}
/** Initiates a new null session (pre-v11 compat handshake) */
-static fastd_method_session_state_t * method_session_init_compat(const fastd_method_t *method, const uint8_t *secret, size_t length UNUSED, bool initiator) {
+static fastd_method_session_state_t * method_session_init_compat(const fastd_method_t *method, const uint8_t *secret, UNUSED size_t length, bool initiator) {
return method_session_init(method, secret, initiator);
}
@@ -79,7 +79,7 @@ static bool method_session_is_initiator(fastd_method_session_state_t *session) {
}
/** Returns false */
-static bool method_session_want_refresh(fastd_method_session_state_t *session UNUSED) {
+static bool method_session_want_refresh(UNUSED fastd_method_session_state_t *session) {
return false;
}
@@ -99,7 +99,7 @@ static void method_session_free(fastd_method_session_state_t *session) {
}
/** Just returns the input buffer as the output */
-static bool method_passthrough(fastd_peer_t *peer UNUSED, fastd_method_session_state_t *session UNUSED, fastd_buffer_t *out, fastd_buffer_t in) {
+static bool method_passthrough(UNUSED fastd_peer_t *peer, UNUSED fastd_method_session_state_t *session, fastd_buffer_t *out, fastd_buffer_t in) {
*out = in;
return true;
}
diff --git a/src/methods/xsalsa20_poly1305/xsalsa20_poly1305.c b/src/methods/xsalsa20_poly1305/xsalsa20_poly1305.c
index 4b2f60d..ee44200 100644
--- a/src/methods/xsalsa20_poly1305/xsalsa20_poly1305.c
+++ b/src/methods/xsalsa20_poly1305/xsalsa20_poly1305.c
@@ -50,21 +50,21 @@ struct fastd_method_session_state {
/** Matches the method name "xsalsa20-poly1305" */
-static bool method_create_by_name(const char *name, fastd_method_t **method UNUSED) {
+static bool method_create_by_name(const char *name, UNUSED fastd_method_t **method) {
return !strcmp(name, "xsalsa20-poly1305");
}
/** Does nothing as this provider has only a single method */
-static void method_destroy(fastd_method_t *method UNUSED) {
+static void method_destroy(UNUSED fastd_method_t *method) {
}
/** Returns the key length used by xsalsa20-poly1305 */
-static size_t method_key_length(const fastd_method_t *method UNUSED) {
+static size_t method_key_length(UNUSED const fastd_method_t *method) {
return crypto_secretbox_xsalsa20poly1305_KEYBYTES;
}
/** Initializes the session state */
-static fastd_method_session_state_t * method_session_init(const fastd_method_t *method UNUSED, const uint8_t *secret, bool initiator) {
+static fastd_method_session_state_t * method_session_init(UNUSED const fastd_method_t *method, const uint8_t *secret, bool initiator) {
fastd_method_session_state_t *session = fastd_new(fastd_method_session_state_t);
fastd_method_common_init(&session->common, initiator);
@@ -147,7 +147,7 @@ static inline bool handle_header(const fastd_method_common_t *session, fastd_buf
/** Performs encryption and authentication of a packet */
-static bool method_encrypt(fastd_peer_t *peer UNUSED, fastd_method_session_state_t *session, fastd_buffer_t *out, fastd_buffer_t in) {
+static bool method_encrypt(UNUSED fastd_peer_t *peer, fastd_method_session_state_t *session, fastd_buffer_t *out, fastd_buffer_t in) {
fastd_buffer_pull_head_zero(&in, crypto_secretbox_xsalsa20poly1305_ZEROBYTES);
*out = fastd_buffer_alloc(in.len, 0, 0);
diff --git a/src/peer.h b/src/peer.h
index 51e6ffa..ba97d2b 100644
--- a/src/peer.h
+++ b/src/peer.h
@@ -210,7 +210,7 @@ static inline bool fastd_peer_is_floating(const fastd_peer_t *peer) {
}
/** Checks if a peer is not statically configured, but added after a on-verify run */
-static inline bool fastd_peer_is_dynamic(const fastd_peer_t *peer UNUSED) {
+static inline bool fastd_peer_is_dynamic(UNUSED const fastd_peer_t *peer) {
#ifdef WITH_DYNAMIC_PEERS
return peer->config_state == CONFIG_DYNAMIC;
#else
diff --git a/src/poll.c b/src/poll.c
index 3021399..949a597 100644
--- a/src/poll.c
+++ b/src/poll.c
@@ -134,7 +134,7 @@ void fastd_poll_set_fd_peer(size_t i) {
void fastd_poll_add_peer(void) {
}
-void fastd_poll_delete_peer(size_t i UNUSED) {
+void fastd_poll_delete_peer(UNUSED size_t i) {
}
diff --git a/src/protocols/ec25519_fhmqvc/handshake.c b/src/protocols/ec25519_fhmqvc/handshake.c
index d7b7bfc..54c9f02 100644
--- a/src/protocols/ec25519_fhmqvc/handshake.c
+++ b/src/protocols/ec25519_fhmqvc/handshake.c
@@ -606,7 +606,7 @@ void fastd_protocol_ec25519_fhmqvc_handle_verify_return(fastd_peer_t *peer, fast
#else
/** Dummy add dynamic function for fastd versions without on-verify support */
-static inline fastd_peer_t * add_dynamic(fastd_socket_t *sock UNUSED, const fastd_peer_address_t *addr, const unsigned char key[PUBLICKEYBYTES] UNUSED) {
+static inline fastd_peer_t * add_dynamic(UNUSED fastd_socket_t *sock, const fastd_peer_address_t *addr, UNUSED const unsigned char key[PUBLICKEYBYTES]) {
pr_debug("ignoring handshake from %I (unknown key)", addr);
return NULL;
}