Stop using non-portable <sys/cdefs.h> For portability, we should not rely on the __BEGIN_DECLS, __END_DECLS and __P to be predefined somewhere. For __P, we just remove its usage as we do not support pre-ANSI-C compilers. [guillem@hadrons.org: - Separate extern declarations with newlines. - Slightly reword commit message. ] Signed-off-by: Guillem Jover <guillem@hadrons.org>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232
diff --git a/include/md2.h b/include/md2.h
index 7832905..d4ca22a 100644
--- a/include/md2.h
+++ b/include/md2.h
@@ -3,7 +3,6 @@
#ifndef _MD2_H_
#define _MD2_H_
-#include <sys/cdefs.h>
#include <sys/types.h>
#include <stdint.h>
@@ -18,7 +17,10 @@ typedef struct MD2Context {
unsigned char X[48]; /* input buffer */
} MD2_CTX;
-__BEGIN_DECLS
+#ifdef __cplusplus
+extern "C" {
+#endif
+
void MD2Init(MD2_CTX *);
void MD2Update(MD2_CTX *, const unsigned char *, unsigned int);
void MD2Final(unsigned char[16], MD2_CTX *);
@@ -26,6 +28,9 @@ char *MD2End(MD2_CTX *, char *);
char *MD2File(const char *, char *);
char *MD2FileChunk(const char *, char *, off_t, off_t);
char *MD2Data(const unsigned char *, size_t, char *);
-__END_DECLS
+
+#ifdef __cplusplus
+}
+#endif
#endif /* _MD2_H_ */
diff --git a/include/md4.h b/include/md4.h
index ccd524f..c4942b8 100644
--- a/include/md4.h
+++ b/include/md4.h
@@ -16,7 +16,6 @@
#ifndef _MD4_H_
#define _MD4_H_
-#include <sys/cdefs.h>
#include <sys/types.h>
#include <stdint.h>
@@ -31,7 +30,10 @@ typedef struct MD4Context {
uint8_t buffer[MD4_BLOCK_LENGTH]; /* input buffer */
} MD4_CTX;
-__BEGIN_DECLS
+#ifdef __cplusplus
+extern "C" {
+#endif
+
void MD4Init(MD4_CTX *);
void MD4Update(MD4_CTX *, const uint8_t *, size_t);
void MD4Pad(MD4_CTX *);
@@ -41,6 +43,9 @@ char *MD4End(MD4_CTX *, char *);
char *MD4File(const char *, char *);
char *MD4FileChunk(const char *, char *, off_t, off_t);
char *MD4Data(const uint8_t *, size_t, char *);
-__END_DECLS
+
+#ifdef __cplusplus
+}
+#endif
#endif /* _MD4_H_ */
diff --git a/include/md5.h b/include/md5.h
index 0a0a4ff..dee2bf4 100644
--- a/include/md5.h
+++ b/include/md5.h
@@ -15,7 +15,6 @@
#ifndef _MD5_H_
#define _MD5_H_
-#include <sys/cdefs.h>
#include <sys/types.h>
#include <stdint.h>
@@ -30,7 +29,10 @@ typedef struct MD5Context {
uint8_t buffer[MD5_BLOCK_LENGTH]; /* input buffer */
} MD5_CTX;
-__BEGIN_DECLS
+#ifdef __cplusplus
+extern "C" {
+#endif
+
void MD5Init(MD5_CTX *);
void MD5Update(MD5_CTX *, const uint8_t *, size_t);
void MD5Pad(MD5_CTX *);
@@ -40,6 +42,9 @@ char *MD5End(MD5_CTX *, char *);
char *MD5File(const char *, char *);
char *MD5FileChunk(const char *, char *, off_t, off_t);
char *MD5Data(const uint8_t *, size_t, char *);
-__END_DECLS
+
+#ifdef __cplusplus
+}
+#endif
#endif /* _MD5_H_ */
diff --git a/include/rmd160.h b/include/rmd160.h
index b9fef11..f8a7afa 100644
--- a/include/rmd160.h
+++ b/include/rmd160.h
@@ -25,7 +25,6 @@
#ifndef _RMD160_H
#define _RMD160_H
-#include <sys/cdefs.h>
#include <sys/types.h>
#include <stdint.h>
@@ -41,7 +40,10 @@ typedef struct RMD160Context {
uint8_t buffer[RMD160_BLOCK_LENGTH]; /* input buffer */
} RMD160_CTX;
-__BEGIN_DECLS
+#ifdef __cplusplus
+extern "C" {
+#endif
+
void RMD160Init(RMD160_CTX *);
void RMD160Transform(uint32_t [5], const uint8_t [RMD160_BLOCK_LENGTH]);
void RMD160Update(RMD160_CTX *, const uint8_t *, size_t);
@@ -51,6 +53,9 @@ char *RMD160End(RMD160_CTX *, char *);
char *RMD160File(const char *, char *);
char *RMD160FileChunk(const char *, char *, off_t, off_t);
char *RMD160Data(const uint8_t *, size_t, char *);
-__END_DECLS
+
+#ifdef __cplusplus
+}
+#endif
#endif /* _RMD160_H */
diff --git a/include/sha1.h b/include/sha1.h
index bf21e58..40a53a1 100644
--- a/include/sha1.h
+++ b/include/sha1.h
@@ -9,7 +9,6 @@
#ifndef _SHA1_H
#define _SHA1_H
-#include <sys/cdefs.h>
#include <sys/types.h>
#include <stdint.h>
@@ -24,7 +23,10 @@ typedef struct {
uint8_t buffer[SHA1_BLOCK_LENGTH];
} SHA1_CTX;
-__BEGIN_DECLS
+#ifdef __cplusplus
+extern "C" {
+#endif
+
void SHA1Init(SHA1_CTX *);
void SHA1Pad(SHA1_CTX *);
void SHA1Transform(uint32_t [5], const uint8_t [SHA1_BLOCK_LENGTH]);
@@ -34,7 +36,10 @@ char *SHA1End(SHA1_CTX *, char *);
char *SHA1File(const char *, char *);
char *SHA1FileChunk(const char *, char *, off_t, off_t);
char *SHA1Data(const uint8_t *, size_t, char *);
-__END_DECLS
+
+#ifdef __cplusplus
+}
+#endif
#define HTONDIGEST(x) do { \
x[0] = htonl(x[0]); \
diff --git a/include/sha2.h b/include/sha2.h
index 9cfd273..0387ea3 100644
--- a/include/sha2.h
+++ b/include/sha2.h
@@ -37,7 +37,6 @@
#ifndef _SHA2_H
#define _SHA2_H
-#include <sys/cdefs.h>
#include <sys/types.h>
#include <stdint.h>
@@ -64,7 +63,10 @@ typedef struct _SHA2_CTX {
uint8_t buffer[SHA512_BLOCK_LENGTH];
} SHA2_CTX;
-__BEGIN_DECLS
+#ifdef __cplusplus
+extern "C" {
+#endif
+
void SHA256Init(SHA2_CTX *);
void SHA256Transform(uint32_t state[8], const uint8_t [SHA256_BLOCK_LENGTH]);
void SHA256Update(SHA2_CTX *, const uint8_t *, size_t);
@@ -94,6 +96,9 @@ char *SHA512End(SHA2_CTX *, char *);
char *SHA512File(const char *, char *);
char *SHA512FileChunk(const char *, char *, off_t, off_t);
char *SHA512Data(const uint8_t *, size_t, char *);
-__END_DECLS
+
+#ifdef __cplusplus
+}
+#endif
#endif /* _SHA2_H */
diff --git a/src/md2.c b/src/md2.c
index b01fe60..20487f0 100644
--- a/src/md2.c
+++ b/src/md2.c
@@ -29,7 +29,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: md2.c,v 1.7 2012/06/25 22:32:44 abs Exp $");
#endif /* LIBC_SCCS and not lint */
@@ -96,7 +95,7 @@ static const unsigned char *pad[] = {
* XXX This should not be visible, but due to an accident, it is
* XXX so it must remain so.
*/
-/*static*/ void MD2Transform __P((MD2_CTX *));
+/*static*/ void MD2Transform(MD2_CTX *);
#ifdef __weak_alias
__weak_alias(MD2Init,_MD2Init)