From b77cb1aeb4f63291c83678211b968ea458458de5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dag-Erling=20Sm=C3=B8rgrav?= Date: Mon, 3 Oct 2016 12:31:16 +0200 Subject: [PATCH] Tidy up the headers a bit and make them C++-safe. --- include/cryb/Makefile.am | 2 +- include/cryb/aes.h | 4 ++++ include/cryb/algorithm.h | 4 ++++ include/cryb/bitwise.h | 4 ++++ include/cryb/cipher.h | 4 ++++ include/cryb/core.h | 4 ++++ include/cryb/cpe.h | 4 ++++ include/cryb/{attributes.h => defs.h} | 18 +++++++++++------- include/cryb/enc.h | 4 ++++ include/cryb/endian.h | 4 ++++ include/cryb/hash.h | 4 ++++ include/cryb/hmac_sha1.h | 4 ++++ include/cryb/hmac_sha224.h | 4 ++++ include/cryb/hmac_sha256.h | 4 ++++ include/cryb/hmac_sha384.h | 4 ++++ include/cryb/hmac_sha512.h | 4 ++++ include/cryb/impl.h | 3 +-- include/cryb/mac.h | 4 ++++ include/cryb/md2.h | 12 ++++-------- include/cryb/md4.h | 4 ++++ include/cryb/md5.h | 4 ++++ include/cryb/memset_s.h | 4 +++- include/cryb/mpi.h | 4 ++++ include/cryb/oath.h | 4 ++++ include/cryb/oath_constants.h | 4 ++++ include/cryb/oath_hotp.h | 4 ++++ include/cryb/oath_totp.h | 4 ++++ include/cryb/oath_types.h | 4 ++++ include/cryb/rand.h | 4 ++++ include/cryb/rc4.h | 4 ++++ include/cryb/rfc3986.h | 4 ++++ include/cryb/rfc4648.h | 4 ++++ include/cryb/sha1.h | 4 ++++ include/cryb/sha224.h | 4 ++++ include/cryb/sha256.h | 4 ++++ include/cryb/sha384.h | 10 +++------- include/cryb/sha512.h | 10 +++------- include/cryb/string.h | 4 ++++ include/cryb/strlcat.h | 4 ++++ include/cryb/strlcmp.h | 4 ++++ include/cryb/strlcpy.h | 4 ++++ include/cryb/test.h | 5 ++++- include/cryb/to.h | 2 ++ include/cryb/wcslcat.h | 4 ++++ include/cryb/wcslcmp.h | 4 ++++ include/cryb/wcslcpy.h | 4 ++++ include/cryb/wstring.h | 4 ++++ 47 files changed, 184 insertions(+), 34 deletions(-) rename include/cryb/{attributes.h => defs.h} (89%) diff --git a/include/cryb/Makefile.am b/include/cryb/Makefile.am index 47a4231..e1afcb5 100644 --- a/include/cryb/Makefile.am +++ b/include/cryb/Makefile.am @@ -13,10 +13,10 @@ endif CRYB_CIPHER if CRYB_CORE cryb_HEADERS += \ algorithm.h \ - attributes.h \ bitwise.h \ core.h \ ctype.h \ + defs.h \ endian.h \ memset_s.h \ string.h \ diff --git a/include/cryb/aes.h b/include/cryb/aes.h index 7555be9..7a7d9b1 100644 --- a/include/cryb/aes.h +++ b/include/cryb/aes.h @@ -36,6 +36,8 @@ #include +CRYB_BEGIN + #define AES_BLOCK_LEN 16 #define aes_digest cryb_aes_digest @@ -59,4 +61,6 @@ void aes_init(aes_ctx *, cipher_mode, const uint8_t *, size_t); void aes_update(aes_ctx *, const void *, size_t, void *); void aes_finish(aes_ctx *); +CRYB_END + #endif diff --git a/include/cryb/algorithm.h b/include/cryb/algorithm.h index 07cb6ae..3cdd3c8 100644 --- a/include/cryb/algorithm.h +++ b/include/cryb/algorithm.h @@ -35,6 +35,8 @@ #include #endif +CRYB_BEGIN + typedef enum algorithm_type { digest_algorithm, mac_algorithm, @@ -45,4 +47,6 @@ typedef struct algorithm { const char *name; } algorithm; +CRYB_END + #endif diff --git a/include/cryb/bitwise.h b/include/cryb/bitwise.h index 204014d..3a0d398 100644 --- a/include/cryb/bitwise.h +++ b/include/cryb/bitwise.h @@ -35,6 +35,8 @@ #include #endif +CRYB_BEGIN + #define CRYB_ROL_ROR(N) \ static inline uint##N##_t rol##N(uint##N##_t i, int n) \ { \ @@ -52,4 +54,6 @@ CRYB_ROL_ROR(64); #undef CRYB_ROL_ROR +CRYB_END + #endif diff --git a/include/cryb/cipher.h b/include/cryb/cipher.h index 22bdaea..3b467db 100644 --- a/include/cryb/cipher.h +++ b/include/cryb/cipher.h @@ -34,6 +34,8 @@ #include #endif +CRYB_BEGIN + const char *cryb_cipher_version(void); #define cipher_ctx cryb_cipher_ctx @@ -73,4 +75,6 @@ const cipher_algorithm *get_cipher_algorithm(const char *); #define cipher_finish(alg, ctx) \ (alg)->finish((ctx)) +CRYB_END + #endif diff --git a/include/cryb/core.h b/include/cryb/core.h index 4f6ec7f..4c80730 100644 --- a/include/cryb/core.h +++ b/include/cryb/core.h @@ -34,6 +34,10 @@ #include #endif +CRYB_BEGIN + const char *cryb_core_version(void); +CRYB_END + #endif diff --git a/include/cryb/cpe.h b/include/cryb/cpe.h index 4d51064..863e7c2 100644 --- a/include/cryb/cpe.h +++ b/include/cryb/cpe.h @@ -34,6 +34,8 @@ #include #endif +CRYB_BEGIN + const char *cryb_cpe_version(void); #define cpe_name cryb_cpe_name @@ -109,4 +111,6 @@ wchar_t *cpe_to_wfn(const cpe_name *); int cpe_copy_attr(cpe_name *, const cpe_name *, int, int); cpe_name *cpe_upgrade22(const cpe_name *); +CRYB_END + #endif diff --git a/include/cryb/attributes.h b/include/cryb/defs.h similarity index 89% rename from include/cryb/attributes.h rename to include/cryb/defs.h index f23fb5f..ee23049 100644 --- a/include/cryb/attributes.h +++ b/include/cryb/defs.h @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2014 Dag-Erling Smørgrav + * Copyright (c) 2014-2016 Dag-Erling Smørgrav * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -27,12 +27,8 @@ * SUCH DAMAGE. */ -#ifndef CRYB_ATTRIBUTES_H_INCLUDED -#define CRYB_ATTRIBUTES_H_INCLUDED - -#ifndef CRYB_TO -#include -#endif +#ifndef CRYB_DEFS_H_INCLUDED +#define CRYB_DEFS_H_INCLUDED #if defined(__GNUC__) || defined(__clang__) # define CRYB_PRINTF(fmt, arg) __attribute__((format(printf, fmt, arg))) @@ -46,4 +42,12 @@ # define CRYB_USED #endif +#ifdef __cplusplus +#define CRYB_BEGIN extern "C" { +#define CRYB_END } +#else +#define CRYB_BEGIN +#define CRYB_END +#endif + #endif diff --git a/include/cryb/enc.h b/include/cryb/enc.h index fd6ec10..10e2589 100644 --- a/include/cryb/enc.h +++ b/include/cryb/enc.h @@ -37,6 +37,10 @@ #include #include +CRYB_BEGIN + const char *cryb_enc_version(void); +CRYB_END + #endif diff --git a/include/cryb/endian.h b/include/cryb/endian.h index 53b40a8..efe64bb 100644 --- a/include/cryb/endian.h +++ b/include/cryb/endian.h @@ -43,6 +43,8 @@ #include #endif +CRYB_BEGIN + #if !HAVE_DECL_BSWAP16 #define bswap16 cryb_bswap16 #endif @@ -390,4 +392,6 @@ cryb_le64toh(uint64_t u64) return (u64); } +CRYB_END + #endif diff --git a/include/cryb/hash.h b/include/cryb/hash.h index 2e070a0..cc22b0b 100644 --- a/include/cryb/hash.h +++ b/include/cryb/hash.h @@ -34,6 +34,8 @@ #include #endif +CRYB_BEGIN + const char *cryb_hash_version(void); #define adler32_hash cryb_adler32_hash @@ -52,4 +54,6 @@ uint32_t murmur3_32_hash(const void *, size_t, uint32_t); uint8_t pearson_hash(const void *, size_t); uint8_t pearson_hash_str(const char *); +CRYB_END + #endif diff --git a/include/cryb/hmac_sha1.h b/include/cryb/hmac_sha1.h index ac51d0b..7f84dfc 100644 --- a/include/cryb/hmac_sha1.h +++ b/include/cryb/hmac_sha1.h @@ -36,6 +36,8 @@ #include +CRYB_BEGIN + #define HMAC_SHA1_MAC_LEN 20 #define hmac_sha1_ctx cryb_hmac_sha1_ctx @@ -54,4 +56,6 @@ void hmac_sha1_update(hmac_sha1_ctx *, const void *, size_t); void hmac_sha1_final(hmac_sha1_ctx *, uint8_t *); void hmac_sha1_complete(const void *, size_t, const void *, size_t, uint8_t *); +CRYB_END + #endif diff --git a/include/cryb/hmac_sha224.h b/include/cryb/hmac_sha224.h index 5faf71f..66458a7 100644 --- a/include/cryb/hmac_sha224.h +++ b/include/cryb/hmac_sha224.h @@ -36,6 +36,8 @@ #include +CRYB_BEGIN + #define HMAC_SHA224_MAC_LEN 28 #define hmac_sha224_ctx cryb_hmac_sha224_ctx @@ -54,4 +56,6 @@ void hmac_sha224_update(hmac_sha224_ctx *, const void *, size_t); void hmac_sha224_final(hmac_sha224_ctx *, uint8_t *); void hmac_sha224_complete(const void *, size_t, const void *, size_t, uint8_t *); +CRYB_END + #endif diff --git a/include/cryb/hmac_sha256.h b/include/cryb/hmac_sha256.h index 66ad95c..b637d15 100644 --- a/include/cryb/hmac_sha256.h +++ b/include/cryb/hmac_sha256.h @@ -36,6 +36,8 @@ #include +CRYB_BEGIN + #define HMAC_SHA256_MAC_LEN 32 #define hmac_sha256_ctx cryb_hmac_sha256_ctx @@ -54,4 +56,6 @@ void hmac_sha256_update(hmac_sha256_ctx *, const void *, size_t); void hmac_sha256_final(hmac_sha256_ctx *, uint8_t *); void hmac_sha256_complete(const void *, size_t, const void *, size_t, uint8_t *); +CRYB_END + #endif diff --git a/include/cryb/hmac_sha384.h b/include/cryb/hmac_sha384.h index a36c7c9..0be71df 100644 --- a/include/cryb/hmac_sha384.h +++ b/include/cryb/hmac_sha384.h @@ -36,6 +36,8 @@ #include +CRYB_BEGIN + #define HMAC_SHA384_MAC_LEN 48 #define hmac_sha384_ctx cryb_hmac_sha384_ctx @@ -54,4 +56,6 @@ void hmac_sha384_update(hmac_sha384_ctx *, const void *, size_t); void hmac_sha384_final(hmac_sha384_ctx *, uint8_t *); void hmac_sha384_complete(const void *, size_t, const void *, size_t, uint8_t *); +CRYB_END + #endif diff --git a/include/cryb/hmac_sha512.h b/include/cryb/hmac_sha512.h index cd88732..33558cc 100644 --- a/include/cryb/hmac_sha512.h +++ b/include/cryb/hmac_sha512.h @@ -36,6 +36,8 @@ #include +CRYB_BEGIN + #define HMAC_SHA512_MAC_LEN 64 #define hmac_sha512_ctx cryb_hmac_sha512_ctx @@ -54,4 +56,6 @@ void hmac_sha512_update(hmac_sha512_ctx *, const void *, size_t); void hmac_sha512_final(hmac_sha512_ctx *, uint8_t *); void hmac_sha512_complete(const void *, size_t, const void *, size_t, uint8_t *); +CRYB_END + #endif diff --git a/include/cryb/impl.h b/include/cryb/impl.h index 06cf12b..64c372b 100644 --- a/include/cryb/impl.h +++ b/include/cryb/impl.h @@ -31,14 +31,13 @@ #define CRYB_IMPL_H_INCLUDED #if HAVE_CONFIG_H -# include "config.h" +#include "config.h" #endif #ifndef CRYB_TO #include #endif -#include #include #endif diff --git a/include/cryb/mac.h b/include/cryb/mac.h index 2d2ddb0..1201559 100644 --- a/include/cryb/mac.h +++ b/include/cryb/mac.h @@ -36,6 +36,10 @@ #include +CRYB_BEGIN + const char *cryb_mac_version(void); +CRYB_END + #endif diff --git a/include/cryb/md2.h b/include/cryb/md2.h index 7e500aa..69d83cf 100644 --- a/include/cryb/md2.h +++ b/include/cryb/md2.h @@ -36,6 +36,8 @@ #include +CRYB_BEGIN + #define MD2_BLOCK_LEN 16 #define MD2_DIGEST_LEN 16 @@ -59,10 +61,6 @@ typedef struct int left; /*!< amount of data in buffer */ } md2_ctx; -#ifdef __cplusplus -extern "C" { -#endif - /** * \brief MD2 context setup * @@ -96,8 +94,6 @@ void md2_final( md2_ctx *ctx, uint8_t *output ); */ void md2_complete( const void *input, int ilen, uint8_t *output ); -#ifdef __cplusplus -} -#endif +CRYB_END -#endif /* md2.h */ +#endif diff --git a/include/cryb/md4.h b/include/cryb/md4.h index 02d223b..3da1222 100644 --- a/include/cryb/md4.h +++ b/include/cryb/md4.h @@ -36,6 +36,8 @@ #include +CRYB_BEGIN + #define MD4_BLOCK_LEN 64 #define MD4_DIGEST_LEN 16 @@ -100,4 +102,6 @@ void md4_complete( const void *input, int ilen, uint8_t *output ); } #endif +CRYB_END + #endif diff --git a/include/cryb/md5.h b/include/cryb/md5.h index a7d70e9..2568177 100644 --- a/include/cryb/md5.h +++ b/include/cryb/md5.h @@ -37,6 +37,8 @@ #include +CRYB_BEGIN + #define MD5_BLOCK_LEN 64 #define MD5_DIGEST_LEN 16 @@ -61,4 +63,6 @@ void md5_update(md5_ctx *, const void *, size_t); void md5_final(md5_ctx *, uint8_t *); void md5_complete(const void *, size_t, uint8_t *); +CRYB_END + #endif diff --git a/include/cryb/memset_s.h b/include/cryb/memset_s.h index 16760ea..3ca6e78 100644 --- a/include/cryb/memset_s.h +++ b/include/cryb/memset_s.h @@ -30,10 +30,12 @@ #ifndef CRYB_MEMSET_S_H_INCLUDED #define CRYB_MEMSET_S_H_INCLUDED -#ifndef CRYB_TO +#ifndef CRYB_TO_H_INCLUDED #include #endif +CRYB_BEGIN + int cryb_memset_s(void *, size_t, int, size_t); #if !HAVE_MEMSET_S diff --git a/include/cryb/mpi.h b/include/cryb/mpi.h index 8f46707..47a8851 100644 --- a/include/cryb/mpi.h +++ b/include/cryb/mpi.h @@ -34,6 +34,8 @@ #include #endif +CRYB_BEGIN + const char *cryb_mpi_version(void); #define mpi_add cryb_mpi_add @@ -89,4 +91,6 @@ int mpi_cmp(cryb_mpi *, cryb_mpi *); int mpi_eq_abs(cryb_mpi *, cryb_mpi *); int mpi_eq(cryb_mpi *, cryb_mpi *); +CRYB_END + #endif diff --git a/include/cryb/oath.h b/include/cryb/oath.h index 5f19485..ffb7e9a 100644 --- a/include/cryb/oath.h +++ b/include/cryb/oath.h @@ -40,6 +40,8 @@ #include #include +CRYB_BEGIN + const char *cryb_oath_version(void); #define oath_key_alloc cryb_oath_key_alloc @@ -64,4 +66,6 @@ struct oath_key *oath_key_dummy(enum oath_mode, enum oath_hash, unsigned int); const char *oath_mode_name(enum oath_mode); enum oath_mode oath_mode_value(const char *); +CRYB_END + #endif diff --git a/include/cryb/oath_constants.h b/include/cryb/oath_constants.h index 17630ac..457de00 100644 --- a/include/cryb/oath_constants.h +++ b/include/cryb/oath_constants.h @@ -34,6 +34,8 @@ #include #endif +CRYB_BEGIN + /* * OATH modes */ @@ -84,4 +86,6 @@ enum oath_hash { */ #define OATH_DUMMY_LABEL "oath-dummy@openpam.org" +CRYB_END + #endif diff --git a/include/cryb/oath_hotp.h b/include/cryb/oath_hotp.h index 36d4b35..a2d672f 100644 --- a/include/cryb/oath_hotp.h +++ b/include/cryb/oath_hotp.h @@ -38,6 +38,8 @@ #include #include +CRYB_BEGIN + #define oath_hotp cryb_oath_hotp #define oath_hotp_current cryb_oath_hotp_current #define oath_hotp_match cryb_oath_hotp_match @@ -46,4 +48,6 @@ unsigned int oath_hotp(const uint8_t *, size_t, uint64_t, unsigned int); unsigned int oath_hotp_current(struct oath_key *); int oath_hotp_match(struct oath_key *, unsigned int, int); +CRYB_END + #endif diff --git a/include/cryb/oath_totp.h b/include/cryb/oath_totp.h index 724d484..9021a7e 100644 --- a/include/cryb/oath_totp.h +++ b/include/cryb/oath_totp.h @@ -38,6 +38,8 @@ #include #include +CRYB_BEGIN + #define oath_totp cryb_oath_totp #define oath_totp_current cryb_oath_totp_current #define oath_totp_match cryb_oath_totp_match @@ -46,4 +48,6 @@ unsigned int oath_totp(const uint8_t *, size_t, unsigned int); unsigned int oath_totp_current(const struct oath_key *); int oath_totp_match(struct oath_key *, unsigned int, int); +CRYB_END + #endif diff --git a/include/cryb/oath_types.h b/include/cryb/oath_types.h index 91edd99..b895f1f 100644 --- a/include/cryb/oath_types.h +++ b/include/cryb/oath_types.h @@ -34,6 +34,8 @@ #include #endif +CRYB_BEGIN + /* * OATH key and associated parameters */ @@ -62,4 +64,6 @@ struct oath_key { uint8_t key[OATH_MAX_KEYLEN]; }; +CRYB_END + #endif diff --git a/include/cryb/rand.h b/include/cryb/rand.h index 56cdc29..4eb4f04 100644 --- a/include/cryb/rand.h +++ b/include/cryb/rand.h @@ -34,9 +34,13 @@ #include #endif +CRYB_BEGIN + const char *cryb_rand_version(void); #define rand_bytes cryb_rand_bytes int rand_bytes(uint8_t *, size_t); +CRYB_END + #endif diff --git a/include/cryb/rc4.h b/include/cryb/rc4.h index f976aa1..5c902e9 100644 --- a/include/cryb/rc4.h +++ b/include/cryb/rc4.h @@ -36,6 +36,8 @@ #include +CRYB_BEGIN + #define rc4_digest cryb_rc4_digest #define rc4_ctx cryb_rc4_ctx #define rc4_init cryb_rc4_init @@ -52,4 +54,6 @@ void rc4_init(rc4_ctx *, cipher_mode, const uint8_t *, size_t); void rc4_update(rc4_ctx *, const void *, size_t, void *); void rc4_finish(rc4_ctx *); +CRYB_END + #endif diff --git a/include/cryb/rfc3986.h b/include/cryb/rfc3986.h index 7ad60df..3eccd26 100644 --- a/include/cryb/rfc3986.h +++ b/include/cryb/rfc3986.h @@ -34,6 +34,8 @@ #include #endif +CRYB_BEGIN + /* estimate of output length for percent encoding / decoding */ #define percent_enclen(l) (size_t)((l) * 3) #define percent_declen(l) (size_t)(l) @@ -43,4 +45,6 @@ int percent_encode(const char *, size_t, char *, size_t *); int percent_decode(const char *, size_t, char *, size_t *); +CRYB_END + #endif diff --git a/include/cryb/rfc4648.h b/include/cryb/rfc4648.h index d8a7765..e0a81f4 100644 --- a/include/cryb/rfc4648.h +++ b/include/cryb/rfc4648.h @@ -34,6 +34,8 @@ #include #endif +CRYB_BEGIN + /* estimate of output length for base32 encoding / decoding */ #define base32_enclen(l) (size_t)(((l + 4) / 5) * 8) #define base32_declen(l) (size_t)(((l + 7) / 8) * 5) @@ -54,4 +56,6 @@ int base32_decode(const char *, size_t, uint8_t *, size_t *); int base64_encode(const uint8_t *, size_t, char *, size_t *); int base64_decode(const char *, size_t, uint8_t *, size_t *); +CRYB_END + #endif diff --git a/include/cryb/sha1.h b/include/cryb/sha1.h index 5a9ecbc..358d2f0 100644 --- a/include/cryb/sha1.h +++ b/include/cryb/sha1.h @@ -37,6 +37,8 @@ #include +CRYB_BEGIN + #define SHA1_BLOCK_LEN 64 #define SHA1_DIGEST_LEN 20 @@ -61,4 +63,6 @@ void sha1_update(sha1_ctx *, const void *, size_t); void sha1_final(sha1_ctx *, uint8_t *); void sha1_complete(const void *, size_t, uint8_t *); +CRYB_END + #endif diff --git a/include/cryb/sha224.h b/include/cryb/sha224.h index 075c125..59510c7 100644 --- a/include/cryb/sha224.h +++ b/include/cryb/sha224.h @@ -33,6 +33,8 @@ #include +CRYB_BEGIN + #define SHA224_BLOCK_LEN 64 #define SHA224_DIGEST_LEN 28 @@ -89,4 +91,6 @@ void sha224_complete(const void *, size_t, uint8_t *); void pbkdf2_sha224(const uint8_t *, size_t, const uint8_t *, size_t, uint64_t, uint8_t *, size_t); +CRYB_END + #endif diff --git a/include/cryb/sha256.h b/include/cryb/sha256.h index 1e9c7b1..22f15c8 100644 --- a/include/cryb/sha256.h +++ b/include/cryb/sha256.h @@ -33,6 +33,8 @@ #include +CRYB_BEGIN + #define SHA256_BLOCK_LEN 64 #define SHA256_DIGEST_LEN 32 @@ -89,4 +91,6 @@ void sha256_complete(const void *, size_t, uint8_t *); void pbkdf2_sha256(const uint8_t *, size_t, const uint8_t *, size_t, uint64_t, uint8_t *, size_t); +CRYB_END + #endif diff --git a/include/cryb/sha384.h b/include/cryb/sha384.h index 965eef7..af809a5 100644 --- a/include/cryb/sha384.h +++ b/include/cryb/sha384.h @@ -36,6 +36,8 @@ #include +CRYB_BEGIN + #define SHA384_BLOCK_LEN 128 #define SHA384_DIGEST_LEN 48 @@ -59,10 +61,6 @@ typedef struct } sha384_ctx; -#ifdef __cplusplus -extern "C" { -#endif - /** * \brief SHA-384 context setup * @@ -96,8 +94,6 @@ void sha384_final( sha384_ctx *ctx, uint8_t *output ); */ void sha384_complete( const void *input, int ilen, uint8_t *output ); -#ifdef __cplusplus -} -#endif +CRYB_END #endif diff --git a/include/cryb/sha512.h b/include/cryb/sha512.h index 5fb6087..a2b3c57 100644 --- a/include/cryb/sha512.h +++ b/include/cryb/sha512.h @@ -36,6 +36,8 @@ #include +CRYB_BEGIN + #define SHA512_BLOCK_LEN 128 #define SHA512_DIGEST_LEN 64 @@ -59,10 +61,6 @@ typedef struct } sha512_ctx; -#ifdef __cplusplus -extern "C" { -#endif - /** * \brief SHA-512 context setup * @@ -96,8 +94,6 @@ void sha512_final( sha512_ctx *ctx, uint8_t *output ); */ void sha512_complete( const void *input, int ilen, uint8_t *output ); -#ifdef __cplusplus -} -#endif +CRYB_END #endif diff --git a/include/cryb/string.h b/include/cryb/string.h index 97dcc8f..da73145 100644 --- a/include/cryb/string.h +++ b/include/cryb/string.h @@ -34,6 +34,8 @@ #include #endif +CRYB_BEGIN + #define string_new cryb_string_new #define string_len cryb_string_len #define string_buf cryb_string_buf @@ -76,4 +78,6 @@ int string_compare_cs(const string *, const char *, size_t); int string_equal(const string *, const string *); int string_equal_cs(const string *, const char *, size_t); +CRYB_END + #endif diff --git a/include/cryb/strlcat.h b/include/cryb/strlcat.h index 06b787c..93c661b 100644 --- a/include/cryb/strlcat.h +++ b/include/cryb/strlcat.h @@ -34,6 +34,8 @@ #include #endif +CRYB_BEGIN + size_t cryb_strlcat(char *, const char *, size_t); #if !HAVE_STRLCAT @@ -41,4 +43,6 @@ size_t cryb_strlcat(char *, const char *, size_t); #define strlcat(arg, ...) cryb_strlcat(arg, __VA_ARGS__) #endif +CRYB_END + #endif diff --git a/include/cryb/strlcmp.h b/include/cryb/strlcmp.h index 63d022d..2267d5b 100644 --- a/include/cryb/strlcmp.h +++ b/include/cryb/strlcmp.h @@ -34,6 +34,8 @@ #include #endif +CRYB_BEGIN + int cryb_strlcmp(const char *, const char *, size_t); #if !HAVE_STRLCMP @@ -41,4 +43,6 @@ int cryb_strlcmp(const char *, const char *, size_t); #define strlcmp(...) cryb_strlcmp(__VA_ARGS__) #endif +CRYB_END + #endif diff --git a/include/cryb/strlcpy.h b/include/cryb/strlcpy.h index 8558635..885aaa4 100644 --- a/include/cryb/strlcpy.h +++ b/include/cryb/strlcpy.h @@ -34,6 +34,8 @@ #include #endif +CRYB_BEGIN + size_t cryb_strlcpy(char *, const char *, size_t); #if !HAVE_STRLCPY @@ -41,4 +43,6 @@ size_t cryb_strlcpy(char *, const char *, size_t); #define strlcpy(arg, ...) cryb_strlcpy(arg, __VA_ARGS__) #endif +CRYB_END + #endif diff --git a/include/cryb/test.h b/include/cryb/test.h index 276d027..93543fb 100644 --- a/include/cryb/test.h +++ b/include/cryb/test.h @@ -34,11 +34,12 @@ #include #endif -#include #include CRYB_DISABLE_COVERAGE +CRYB_BEGIN + const char *cryb_test_version(void); /* @@ -141,4 +142,6 @@ void t_malloc_printstats(FILE *); #endif extern struct t_test t_memory_leak; +CRYB_END + #endif diff --git a/include/cryb/to.h b/include/cryb/to.h index 1518da1..ef4dbd2 100644 --- a/include/cryb/to.h +++ b/include/cryb/to.h @@ -32,4 +32,6 @@ #define CRYB_TO 20160918 +#include + #endif diff --git a/include/cryb/wcslcat.h b/include/cryb/wcslcat.h index 767fcce..3ba6b44 100644 --- a/include/cryb/wcslcat.h +++ b/include/cryb/wcslcat.h @@ -34,6 +34,8 @@ #include #endif +CRYB_BEGIN + size_t cryb_wcslcat(wchar_t *, const wchar_t *, size_t); #if !HAVE_WCSLCAT @@ -41,4 +43,6 @@ size_t cryb_wcslcat(wchar_t *, const wchar_t *, size_t); #define wcslcat(arg, ...) cryb_wcslcat(arg, __VA_ARGS__) #endif +CRYB_END + #endif diff --git a/include/cryb/wcslcmp.h b/include/cryb/wcslcmp.h index c8bb697..22f9e28 100644 --- a/include/cryb/wcslcmp.h +++ b/include/cryb/wcslcmp.h @@ -34,6 +34,8 @@ #include #endif +CRYB_BEGIN + int cryb_wcslcmp(const wchar_t *, const wchar_t *, size_t); #if !HAVE_WCSLCMP @@ -41,4 +43,6 @@ int cryb_wcslcmp(const wchar_t *, const wchar_t *, size_t); #define wcslcmp(...) cryb_wcslcmp(__VA_ARGS__) #endif +CRYB_END + #endif diff --git a/include/cryb/wcslcpy.h b/include/cryb/wcslcpy.h index 0920ea2..a274f00 100644 --- a/include/cryb/wcslcpy.h +++ b/include/cryb/wcslcpy.h @@ -34,6 +34,8 @@ #include #endif +CRYB_BEGIN + size_t cryb_wcslcpy(wchar_t *, const wchar_t *, size_t); #if !HAVE_WCSLCPY @@ -41,4 +43,6 @@ size_t cryb_wcslcpy(wchar_t *, const wchar_t *, size_t); #define wcslcpy(arg, ...) cryb_wcslcpy(arg, __VA_ARGS__) #endif +CRYB_END + #endif diff --git a/include/cryb/wstring.h b/include/cryb/wstring.h index d3d15cc..080dd25 100644 --- a/include/cryb/wstring.h +++ b/include/cryb/wstring.h @@ -34,6 +34,8 @@ #include #endif +CRYB_BEGIN + #define wstring_new cryb_wstring_new #define wstring_len cryb_wstring_len #define wstring_buf cryb_wstring_buf @@ -76,4 +78,6 @@ int wstring_compare_wcs(const wstring *, const wchar_t *, size_t); int wstring_equal(const wstring *, const wstring *); int wstring_equal_wcs(const wstring *, const wchar_t *, size_t); +CRYB_END + #endif