summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2014-04-10 19:42:06 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2014-04-10 19:42:06 +0200
commit2b3043e578f00a5071dfae40c237b86cc6d70c7e (patch)
tree2c7876ce55f85fcbbd58e980dee7ae474b24fe19
parent4ab823eb500a8a63061eb23581e73ff9d8bffce1 (diff)
downloadfastd-2b3043e578f00a5071dfae40c237b86cc6d70c7e.tar
fastd-2b3043e578f00a5071dfae40c237b86cc6d70c7e.zip
Use #pragma once
-rw-r--r--cmake/generate_version.cmake4
-rw-r--r--src/buffer.h5
-rw-r--r--src/compat.h5
-rw-r--r--src/config.h5
-rw-r--r--src/cpuid.h5
-rw-r--r--src/crypto.h5
-rw-r--r--src/crypto/mac/ghash/pclmulqdq/ghash_pclmulqdq.h2
-rw-r--r--src/dlist.h5
-rw-r--r--src/fastd.h5
-rw-r--r--src/fastd_config.h.in5
-rw-r--r--src/handshake.h6
-rw-r--r--src/hkdf_sha256.h5
-rw-r--r--src/lex.h5
-rw-r--r--src/log.h6
-rw-r--r--src/method.h5
-rw-r--r--src/methods/common.h5
-rw-r--r--src/peer.h5
-rw-r--r--src/protocols/ec25519_fhmqvc/ec25519_fhmqvc.h5
-rw-r--r--src/protocols/ec25519_fhmqvc/handshake.h5
-rw-r--r--src/sha256.h5
-rw-r--r--src/types.h5
21 files changed, 22 insertions, 81 deletions
diff --git a/cmake/generate_version.cmake b/cmake/generate_version.cmake
index e4a833c..3830800 100644
--- a/cmake/generate_version.cmake
+++ b/cmake/generate_version.cmake
@@ -2,10 +2,8 @@ set(VERSION_FILE "${FASTD_BINARY_DIR}/src/fastd_version.h")
add_custom_target(
version
- COMMAND echo "#ifndef _FASTD_FASTD_VERSION_H_" > "${VERSION_FILE}.new"
- COMMAND echo "#define _FASTD_FASTD_VERSION_H_" >> "${VERSION_FILE}.new"
+ COMMAND echo "#pragma once" > "${VERSION_FILE}.new"
COMMAND sh -c "echo \"#define FASTD_VERSION \\\"$(git --git-dir=./.git describe --dirty 2>/dev/null || echo ${FASTD_VERSION})\\\"\"" >> "${VERSION_FILE}.new"
- COMMAND echo "#endif /* _FASTD_FASTD_VERSION_H_ */" >> "${VERSION_FILE}.new"
COMMAND cmp -s "${VERSION_FILE}" "${VERSION_FILE}.new" && rm "${VERSION_FILE}.new" || mv "${VERSION_FILE}.new" "${VERSION_FILE}"
WORKING_DIRECTORY "${FASTD_SOURCE_DIR}"
VERBATIM
diff --git a/src/buffer.h b/src/buffer.h
index 34168bf..d403785 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -24,8 +24,7 @@
*/
-#ifndef _FASTD_BUFFER_H_
-#define _FASTD_BUFFER_H_
+#pragma once
#include "log.h"
@@ -91,5 +90,3 @@ static inline void fastd_buffer_push_head_to(const fastd_context_t *ctx, fastd_b
memcpy(data, buffer->data, len);
fastd_buffer_push_head(ctx, buffer, len);
}
-
-#endif /* _FASTD_BUFFER_H_ */
diff --git a/src/compat.h b/src/compat.h
index 1cb68f9..e55f869 100644
--- a/src/compat.h
+++ b/src/compat.h
@@ -24,8 +24,7 @@
*/
-#ifndef _FASTD_COMPAT_H_
-#define _FASTD_COMPAT_H_
+#pragma once
#include <fastd_config.h>
@@ -72,5 +71,3 @@ static inline char *get_current_dir_name(void) {
#endif
#endif
-
-#endif /* _FASTD_COMPAT_H_ */
diff --git a/src/config.h b/src/config.h
index e319973..a13ddc0 100644
--- a/src/config.h
+++ b/src/config.h
@@ -24,8 +24,7 @@
*/
-#ifndef _FASTD_CONFIG_H_
-#define _FASTD_CONFIG_H_
+#pragma once
#include "fastd.h"
@@ -47,5 +46,3 @@ void fastd_config_verify(fastd_context_t *ctx, fastd_config_t *conf);
void fastd_add_peer_dir(fastd_context_t *ctx, fastd_config_t *conf, const char *dir);
bool fastd_read_config(fastd_context_t *ctx, fastd_config_t *conf, const char *filename, bool peer_config, int depth);
-
-#endif /* _FASTD_CONFIG_H_ */
diff --git a/src/cpuid.h b/src/cpuid.h
index a15050d..546c258 100644
--- a/src/cpuid.h
+++ b/src/cpuid.h
@@ -24,8 +24,7 @@
*/
-#ifndef _FASTD_CPUID_H_
-#define _FASTD_CPUID_H_
+#pragma once
#include <stdint.h>
@@ -42,5 +41,3 @@ static inline uint64_t fastd_cpuid(void) {
return ((uint64_t)ecx) << 32 | edx;
}
-
-#endif /* _FASTD_CPUID_H_ */
diff --git a/src/crypto.h b/src/crypto.h
index 9d96268..25efb10 100644
--- a/src/crypto.h
+++ b/src/crypto.h
@@ -24,8 +24,7 @@
*/
-#ifndef _FASTD_CRYPTO_H_
-#define _FASTD_CRYPTO_H_
+#pragma once
#include "types.h"
@@ -92,5 +91,3 @@ static inline void xor_a(fastd_block128_t *x, const fastd_block128_t *a) {
static inline bool fastd_true(void) {
return true;
}
-
-#endif /* _FASTD_CRYPTO_H_ */
diff --git a/src/crypto/mac/ghash/pclmulqdq/ghash_pclmulqdq.h b/src/crypto/mac/ghash/pclmulqdq/ghash_pclmulqdq.h
index dc9c436..c2cf4e3 100644
--- a/src/crypto/mac/ghash/pclmulqdq/ghash_pclmulqdq.h
+++ b/src/crypto/mac/ghash/pclmulqdq/ghash_pclmulqdq.h
@@ -24,6 +24,8 @@
*/
+#pragma once
+
#include "../../../../crypto.h"
diff --git a/src/dlist.h b/src/dlist.h
index 8d1e263..efe7021 100644
--- a/src/dlist.h
+++ b/src/dlist.h
@@ -24,8 +24,7 @@
*/
-#ifndef _FASTD_DLIST_H_
-#define _FASTD_DLIST_H_
+#pragma once
#include "types.h"
@@ -63,5 +62,3 @@ static inline void fastd_dlist_remove(fastd_dlist_head_t *elem) {
elem->prev = elem->next = NULL;
}
-
-#endif /* _FASTD_DLIST_H_ */
diff --git a/src/fastd.h b/src/fastd.h
index 721c9b5..0c3b7a4 100644
--- a/src/fastd.h
+++ b/src/fastd.h
@@ -24,8 +24,7 @@
*/
-#ifndef _FASTD_FASTD_H_
-#define _FASTD_FASTD_H_
+#pragma once
#include "compat.h"
#include "types.h"
@@ -436,5 +435,3 @@ static inline size_t max_size_t(size_t a, size_t b) {
static inline size_t min_size_t(size_t a, size_t b) {
return (a < b) ? a : b;
}
-
-#endif /* _FASTD_FASTD_H_ */
diff --git a/src/fastd_config.h.in b/src/fastd_config.h.in
index 7426baf..8394853 100644
--- a/src/fastd_config.h.in
+++ b/src/fastd_config.h.in
@@ -24,8 +24,7 @@
*/
-#ifndef _FASTD_FASTD_CONFIG_H_
-#define _FASTD_FASTD_CONFIG_H_
+#pragma once
#cmakedefine HAVE_AI_ADDRCONFIG
#cmakedefine HAVE_ETHHDR
@@ -52,5 +51,3 @@
#cmakedefine ENABLE_OPENSSL
#define MAX_CONFIG_DEPTH @MAX_CONFIG_DEPTH_NUM@
-
-#endif /* _FASTD_FASTD_CONFIG_H_ */
diff --git a/src/handshake.h b/src/handshake.h
index a519450..5674b83 100644
--- a/src/handshake.h
+++ b/src/handshake.h
@@ -24,8 +24,7 @@
*/
-#ifndef _FASTD_HANDSHAKE_H_
-#define _FASTD_HANDSHAKE_H_
+#pragma once
#include "fastd.h"
@@ -138,6 +137,3 @@ static inline void fastd_handshake_add_uint16(fastd_context_t *ctx, fastd_buffer
dst[0] = value;
dst[1] = value >> 8;
}
-
-
-#endif /* _FASTD_HANDSHAKE_H_ */
diff --git a/src/hkdf_sha256.h b/src/hkdf_sha256.h
index d882c1b..94b726e 100644
--- a/src/hkdf_sha256.h
+++ b/src/hkdf_sha256.h
@@ -24,8 +24,7 @@
*/
-#ifndef _FASTD_HKDF_SHA256_H_
-#define _FASTD_HKDF_SHA256_H_
+#pragma once
#include "sha256.h"
#include "types.h"
@@ -36,5 +35,3 @@ static inline void fastd_hkdf_sha256_extract(fastd_sha256_t *out, const uint32_t
}
void fastd_hkdf_sha256_expand(fastd_sha256_t *out, size_t blocks, const fastd_sha256_t *prk, const uint8_t *info, size_t infolen);
-
-#endif /* _FASTD_HKDF_SHA256_H_ */
diff --git a/src/lex.h b/src/lex.h
index 307bec0..1b9ec68 100644
--- a/src/lex.h
+++ b/src/lex.h
@@ -24,8 +24,7 @@
*/
-#ifndef _FASTD_LEX_H_
-#define _FASTD_LEX_H_
+#pragma once
#include "types.h"
#include <config.yy.h>
@@ -37,5 +36,3 @@ fastd_lex_t* fastd_lex_init(FILE *file);
void fastd_lex_destroy(fastd_lex_t *lex);
int fastd_lex(YYSTYPE *yylval, YYLTYPE *yylloc, fastd_lex_t *lex);
-
-#endif /* _FASTD_LEX_H_ */
diff --git a/src/log.h b/src/log.h
index c61f1f5..6e47590 100644
--- a/src/log.h
+++ b/src/log.h
@@ -24,8 +24,7 @@
*/
-#ifndef _FASTD_LOG_H_
-#define _FASTD_LOG_H_
+#pragma once
#include "types.h"
@@ -55,6 +54,3 @@ void fastd_logf(const fastd_context_t *ctx, fastd_loglevel_t level, const char *
#define exit_bug(ctx, message) exit_fatal(ctx, "BUG: %s", message)
#define exit_error(ctx, args...) do { pr_error(ctx, args); exit(1); } while(0)
#define exit_errno(ctx, message) exit_error(ctx, "%s: %s", message, strerror(errno))
-
-#endif /* _FASTD_LOG_H_ */
-
diff --git a/src/method.h b/src/method.h
index 1d9522a..159d2b8 100644
--- a/src/method.h
+++ b/src/method.h
@@ -24,8 +24,7 @@
*/
-#ifndef _FASTD_METHOD_H_
-#define _FASTD_METHOD_H_
+#pragma once
#include "fastd.h"
@@ -73,5 +72,3 @@ static inline const fastd_method_info_t* fastd_method_get_by_name(fastd_context_
return NULL;
}
-
-#endif /* _FASTD_METHOD_H_ */
diff --git a/src/methods/common.h b/src/methods/common.h
index 92cacc8..4d9c4c0 100644
--- a/src/methods/common.h
+++ b/src/methods/common.h
@@ -24,8 +24,7 @@
*/
-#ifndef _FASTD_METHODS_COMMON_H_
-#define _FASTD_METHODS_COMMON_H_
+#pragma once
#include "../fastd.h"
@@ -116,5 +115,3 @@ static inline void fastd_method_expand_nonce(uint8_t *buf, const uint8_t nonce[C
memcpy(buf, nonce, min_size_t(len, COMMON_NONCEBYTES));
buf[len-1] = 1;
}
-
-#endif /* _FASTD_METHODS_COMMON_H_ */
diff --git a/src/peer.h b/src/peer.h
index 4eead4e..6deeacb 100644
--- a/src/peer.h
+++ b/src/peer.h
@@ -24,8 +24,7 @@
*/
-#ifndef _FASTD_PEER_H_
-#define _FASTD_PEER_H_
+#pragma once
#include "fastd.h"
@@ -219,5 +218,3 @@ static inline bool fastd_eth_addr_is_unicast(fastd_eth_addr_t addr) {
void fastd_peer_eth_addr_add(fastd_context_t *ctx, fastd_peer_t *peer, fastd_eth_addr_t addr);
void fastd_peer_eth_addr_cleanup(fastd_context_t *ctx);
fastd_peer_t* fastd_peer_find_by_eth_addr(fastd_context_t *ctx, fastd_eth_addr_t addr);
-
-#endif /* _FASTD_PEER_H_ */
diff --git a/src/protocols/ec25519_fhmqvc/ec25519_fhmqvc.h b/src/protocols/ec25519_fhmqvc/ec25519_fhmqvc.h
index 40e9e85..19d2cbf 100644
--- a/src/protocols/ec25519_fhmqvc/ec25519_fhmqvc.h
+++ b/src/protocols/ec25519_fhmqvc/ec25519_fhmqvc.h
@@ -24,8 +24,7 @@
*/
-#ifndef _FASTD_PROTOCOL_EC25519_FHMQVC_H_
-#define _FASTD_PROTOCOL_EC25519_FHMQVC_H_
+#pragma once
#include "../../fastd.h"
#include "../../method.h"
@@ -106,5 +105,3 @@ static inline void hexdump(char out[65], const unsigned char d[32]) {
static inline bool is_session_valid(fastd_context_t *ctx, const protocol_session_t *session) {
return (session->method && session->method->provider->session_is_valid(ctx, session->method_state));
}
-
-#endif /* _FASTD_PROTOCOL_EC25519_FHMQVC_H_ */
diff --git a/src/protocols/ec25519_fhmqvc/handshake.h b/src/protocols/ec25519_fhmqvc/handshake.h
index 04eb571..867b0fa 100644
--- a/src/protocols/ec25519_fhmqvc/handshake.h
+++ b/src/protocols/ec25519_fhmqvc/handshake.h
@@ -24,8 +24,7 @@
*/
-#ifndef _FASTD_PROTOCOL_EC25519_FHMQVC_HANDSHAKE_H_
-#define _FASTD_PROTOCOL_EC25519_FHMQVC_HANDSHAKE_H_
+#pragma once
#include "ec25519_fhmqvc.h"
@@ -51,5 +50,3 @@ static inline bool is_handshake_key_valid(fastd_context_t *ctx, const handshake_
static inline bool is_handshake_key_preferred(fastd_context_t *ctx, const handshake_key_t *handshake_key) {
return !fastd_timed_out(ctx, &handshake_key->preferred_till);
}
-
-#endif /* _FASTD_PROTOCOL_EC25519_FHMQVC_HANDSHAKE_H_ */
diff --git a/src/sha256.h b/src/sha256.h
index 4cfe11f..30a8d35 100644
--- a/src/sha256.h
+++ b/src/sha256.h
@@ -24,8 +24,7 @@
*/
-#ifndef _FASTD_SHA256_H_
-#define _FASTD_SHA256_H_
+#pragma once
#include <stdbool.h>
#include <stddef.h>
@@ -56,5 +55,3 @@ void fastd_hmacsha256_blocks(fastd_sha256_t *out, const uint32_t key[FASTD_HMACS
bool fastd_hmacsha256_blocks_verify(const uint8_t mac[FASTD_SHA256_HASH_BYTES], const uint32_t key[FASTD_HMACSHA256_KEY_WORDS], ...);
void fastd_hmacsha256(fastd_sha256_t *out, const uint32_t key[FASTD_HMACSHA256_KEY_WORDS], const uint32_t *in, size_t len);
bool fastd_hmacsha256_verify(const uint8_t mac[FASTD_SHA256_HASH_BYTES], const uint32_t key[FASTD_HMACSHA256_KEY_WORDS], const uint32_t *in, size_t len);
-
-#endif /* _FASTD_SHA256_H_ */
diff --git a/src/types.h b/src/types.h
index ca6f084..cb9f952 100644
--- a/src/types.h
+++ b/src/types.h
@@ -30,8 +30,7 @@
*/
-#ifndef _FASTD_TYPES_H_
-#define _FASTD_TYPES_H_
+#pragma once
#include <fastd_config.h>
@@ -149,5 +148,3 @@ typedef struct fastd_method_session_state fastd_method_session_state_t;
typedef struct fastd_cipher_state fastd_cipher_state_t;
typedef struct fastd_mac_state fastd_mac_state_t;
-
-#endif /* _FASTD_TYPES_H_ */