Brad Bishop | 37a0e4d | 2017-12-04 01:01:44 -0500 | [diff] [blame] | 1 | From 88adbe1a855b7aa95bd925c80ed83c86f3fc42e3 Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Sun, 6 Nov 2016 09:39:31 -0800 |
| 4 | Subject: [PATCH 1/3] Replace __BEGIN_DECLS and __END_DECLS |
| 5 | |
| 6 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 7 | Signed-off-by: Yi Zhao <yi.zhao@windriver.com> |
Brad Bishop | 37a0e4d | 2017-12-04 01:01:44 -0500 | [diff] [blame] | 8 | --- |
| 9 | Upstream-Status: Pending |
| 10 | |
| 11 | include/bsd/err.h | 10 ++++++++-- |
| 12 | include/bsd/libutil.h | 10 ++++++++-- |
| 13 | include/bsd/md5.h | 10 ++++++++-- |
| 14 | include/bsd/nlist.h | 10 ++++++++-- |
| 15 | include/bsd/readpassphrase.h | 10 ++++++++-- |
| 16 | include/bsd/stdio.h | 10 ++++++++-- |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 17 | include/bsd/stdlib.h | 12 +++++++++--- |
| 18 | include/bsd/string.h | 12 +++++++++--- |
Brad Bishop | 37a0e4d | 2017-12-04 01:01:44 -0500 | [diff] [blame] | 19 | include/bsd/stringlist.h | 10 ++++++++-- |
| 20 | include/bsd/unistd.h | 10 ++++++++-- |
| 21 | include/bsd/vis.h | 10 ++++++++-- |
| 22 | include/bsd/wchar.h | 10 ++++++++-- |
| 23 | src/hash/sha512.h | 10 ++++++++-- |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 24 | 13 files changed, 106 insertions(+), 28 deletions(-) |
Brad Bishop | 37a0e4d | 2017-12-04 01:01:44 -0500 | [diff] [blame] | 25 | |
| 26 | diff --git a/include/bsd/err.h b/include/bsd/err.h |
| 27 | index 12fd051..43dfc32 100644 |
| 28 | --- a/include/bsd/err.h |
| 29 | +++ b/include/bsd/err.h |
| 30 | @@ -42,7 +42,10 @@ |
| 31 | |
| 32 | #include <stdarg.h> |
| 33 | |
| 34 | -__BEGIN_DECLS |
| 35 | +/* __BEGIN_DECLS */ |
| 36 | +#ifdef __cplusplus |
| 37 | +extern "C" { |
| 38 | +#endif |
| 39 | void warnc(int code, const char *format, ...) |
| 40 | __printflike(2, 3); |
| 41 | void vwarnc(int code, const char *format, va_list ap) |
| 42 | @@ -51,6 +54,9 @@ void errc(int status, int code, const char *format, ...) |
| 43 | __printflike(3, 4); |
| 44 | void verrc(int status, int code, const char *format, va_list ap) |
| 45 | __printflike(3, 0); |
| 46 | -__END_DECLS |
| 47 | +#ifdef __cplusplus |
| 48 | +} |
| 49 | +#endif |
| 50 | +/* __END_DECLS */ |
| 51 | |
| 52 | #endif |
| 53 | diff --git a/include/bsd/libutil.h b/include/bsd/libutil.h |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 54 | index 45b3b15..9c936e5 100644 |
Brad Bishop | 37a0e4d | 2017-12-04 01:01:44 -0500 | [diff] [blame] | 55 | --- a/include/bsd/libutil.h |
| 56 | +++ b/include/bsd/libutil.h |
| 57 | @@ -53,7 +53,10 @@ struct pidfh { |
| 58 | ino_t pf_ino; |
| 59 | }; |
| 60 | |
| 61 | -__BEGIN_DECLS |
| 62 | +/* __BEGIN_DECLS */ |
| 63 | +#ifdef __cplusplus |
| 64 | +extern "C" { |
| 65 | +#endif |
| 66 | int humanize_number(char *buf, size_t len, int64_t bytes, |
| 67 | const char *suffix, int scale, int flags); |
| 68 | int expand_number(const char *_buf, uint64_t *_num); |
| 69 | @@ -66,7 +69,10 @@ int pidfile_close(struct pidfh *pfh); |
| 70 | int pidfile_remove(struct pidfh *pfh); |
| 71 | |
| 72 | char *fparseln(FILE *, size_t *, size_t *, const char[3], int); |
| 73 | -__END_DECLS |
| 74 | +#ifdef __cplusplus |
| 75 | +} |
| 76 | +#endif |
| 77 | +/* __END_DECLS */ |
| 78 | |
| 79 | /* humanize_number(3) */ |
| 80 | #define HN_DECIMAL 0x01 |
| 81 | diff --git a/include/bsd/md5.h b/include/bsd/md5.h |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 82 | index 5f3ae46..5d80e5c 100644 |
Brad Bishop | 37a0e4d | 2017-12-04 01:01:44 -0500 | [diff] [blame] | 83 | --- a/include/bsd/md5.h |
| 84 | +++ b/include/bsd/md5.h |
| 85 | @@ -30,7 +30,10 @@ typedef struct MD5Context { |
| 86 | #include <sys/cdefs.h> |
| 87 | #include <sys/types.h> |
| 88 | |
| 89 | -__BEGIN_DECLS |
| 90 | +/* __BEGIN_DECLS */ |
| 91 | +#ifdef __cplusplus |
| 92 | +extern "C" { |
| 93 | +#endif |
| 94 | void MD5Init(MD5_CTX *); |
| 95 | void MD5Update(MD5_CTX *, const uint8_t *, size_t) |
| 96 | __attribute__((__bounded__(__string__,2,3))); |
| 97 | @@ -49,6 +52,9 @@ char *MD5FileChunk(const char *, char *, off_t, off_t) |
| 98 | char *MD5Data(const uint8_t *, size_t, char *) |
| 99 | __attribute__((__bounded__(__string__,1,2))) |
| 100 | __attribute__((__bounded__(__minbytes__,3,MD5_DIGEST_STRING_LENGTH))); |
| 101 | -__END_DECLS |
| 102 | +#ifdef __cplusplus |
| 103 | +} |
| 104 | +#endif |
| 105 | +/* __END_DECLS */ |
| 106 | |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 107 | #endif /* LIBBSD_MD5_H */ |
Brad Bishop | 37a0e4d | 2017-12-04 01:01:44 -0500 | [diff] [blame] | 108 | diff --git a/include/bsd/nlist.h b/include/bsd/nlist.h |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 109 | index cb297e8..e63bbbd 100644 |
Brad Bishop | 37a0e4d | 2017-12-04 01:01:44 -0500 | [diff] [blame] | 110 | --- a/include/bsd/nlist.h |
| 111 | +++ b/include/bsd/nlist.h |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 112 | @@ -88,8 +88,14 @@ struct nlist { |
| 113 | |
| 114 | #define N_FORMAT "%08x" /* namelist value format; XXX */ |
Brad Bishop | 37a0e4d | 2017-12-04 01:01:44 -0500 | [diff] [blame] | 115 | |
| 116 | -__BEGIN_DECLS |
| 117 | +/* __BEGIN_DECLS */ |
| 118 | +#ifdef __cplusplus |
| 119 | +extern "C" { |
| 120 | +#endif |
| 121 | extern int nlist(const char *filename, struct nlist *list); |
| 122 | -__END_DECLS |
| 123 | +#ifdef __cplusplus |
| 124 | +} |
| 125 | +#endif |
| 126 | +/* __END_DECLS */ |
| 127 | |
| 128 | #endif |
| 129 | diff --git a/include/bsd/readpassphrase.h b/include/bsd/readpassphrase.h |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 130 | index 14744b8..fa73361 100644 |
Brad Bishop | 37a0e4d | 2017-12-04 01:01:44 -0500 | [diff] [blame] | 131 | --- a/include/bsd/readpassphrase.h |
| 132 | +++ b/include/bsd/readpassphrase.h |
| 133 | @@ -34,8 +34,14 @@ |
| 134 | #include <sys/cdefs.h> |
| 135 | #include <sys/types.h> |
| 136 | |
| 137 | -__BEGIN_DECLS |
| 138 | +/* __BEGIN_DECLS */ |
| 139 | +#ifdef __cplusplus |
| 140 | +extern "C" { |
| 141 | +#endif |
| 142 | char * readpassphrase(const char *, char *, size_t, int); |
| 143 | -__END_DECLS |
| 144 | +#ifdef __cplusplus |
| 145 | +} |
| 146 | +#endif |
| 147 | +/* __END_DECLS */ |
| 148 | |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 149 | #endif /* !LIBBSD_READPASSPHRASE_H */ |
Brad Bishop | 37a0e4d | 2017-12-04 01:01:44 -0500 | [diff] [blame] | 150 | diff --git a/include/bsd/stdio.h b/include/bsd/stdio.h |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 151 | index 4b69983..18645b7 100644 |
Brad Bishop | 37a0e4d | 2017-12-04 01:01:44 -0500 | [diff] [blame] | 152 | --- a/include/bsd/stdio.h |
| 153 | +++ b/include/bsd/stdio.h |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 154 | @@ -45,7 +45,10 @@ |
| 155 | #endif |
Brad Bishop | 37a0e4d | 2017-12-04 01:01:44 -0500 | [diff] [blame] | 156 | #include <sys/types.h> |
| 157 | |
| 158 | -__BEGIN_DECLS |
| 159 | +/* __BEGIN_DECLS */ |
| 160 | +#ifdef __cplusplus |
| 161 | +extern "C" { |
| 162 | +#endif |
| 163 | const char *fmtcheck(const char *, const char *); |
| 164 | |
| 165 | /* XXX: The function requires cooperation from the system libc to store the |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 166 | @@ -73,7 +76,10 @@ FILE *funopen(const void *cookie, |
Brad Bishop | 37a0e4d | 2017-12-04 01:01:44 -0500 | [diff] [blame] | 167 | #define fwopen(cookie, fn) funopen(cookie, NULL, fn, NULL, NULL) |
| 168 | |
| 169 | int fpurge(FILE *fp); |
| 170 | -__END_DECLS |
| 171 | +#ifdef __cplusplus |
| 172 | +} |
| 173 | +#endif |
| 174 | +/* __END_DECLS */ |
| 175 | |
| 176 | #endif |
| 177 | #endif |
| 178 | diff --git a/include/bsd/stdlib.h b/include/bsd/stdlib.h |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 179 | index ebc9638..c4b54b6 100644 |
Brad Bishop | 37a0e4d | 2017-12-04 01:01:44 -0500 | [diff] [blame] | 180 | --- a/include/bsd/stdlib.h |
| 181 | +++ b/include/bsd/stdlib.h |
| 182 | @@ -46,7 +46,10 @@ |
| 183 | #include <sys/stat.h> |
| 184 | #include <stdint.h> |
| 185 | |
| 186 | -__BEGIN_DECLS |
| 187 | +/* __BEGIN_DECLS */ |
| 188 | +#ifdef __cplusplus |
| 189 | +extern "C" { |
| 190 | +#endif |
| 191 | uint32_t arc4random(void); |
| 192 | void arc4random_stir(void); |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 193 | void arc4random_addrandom(unsigned char *dat, int datlen); |
| 194 | @@ -67,7 +70,7 @@ int sradixsort(const unsigned char **base, int nmemb, |
| 195 | const unsigned char *table, unsigned endbyte); |
| 196 | |
| 197 | void *reallocf(void *ptr, size_t size); |
| 198 | -#if defined(_GNU_SOURCE) && defined(__GLIBC__) && !__GLIBC_PREREQ(2, 26) |
| 199 | +#if defined(_GNU_SOURCE) && defined(__GLIBC__) |
| 200 | void *reallocarray(void *ptr, size_t nmemb, size_t size); |
| 201 | #endif |
| 202 | |
| 203 | @@ -75,6 +78,9 @@ long long strtonum(const char *nptr, long long minval, long long maxval, |
Brad Bishop | 37a0e4d | 2017-12-04 01:01:44 -0500 | [diff] [blame] | 204 | const char **errstr); |
| 205 | |
| 206 | char *getbsize(int *headerlenp, long *blocksizep); |
| 207 | -__END_DECLS |
| 208 | +#ifdef __cplusplus |
| 209 | +} |
| 210 | +#endif |
| 211 | +/* __END_DECLS */ |
| 212 | |
| 213 | #endif |
| 214 | diff --git a/include/bsd/string.h b/include/bsd/string.h |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 215 | index 6798bf6..fa1193f 100644 |
Brad Bishop | 37a0e4d | 2017-12-04 01:01:44 -0500 | [diff] [blame] | 216 | --- a/include/bsd/string.h |
| 217 | +++ b/include/bsd/string.h |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 218 | @@ -36,15 +36,21 @@ |
Brad Bishop | 37a0e4d | 2017-12-04 01:01:44 -0500 | [diff] [blame] | 219 | #include <sys/cdefs.h> |
| 220 | #include <sys/types.h> |
| 221 | |
| 222 | -__BEGIN_DECLS |
| 223 | +/* __BEGIN_DECLS */ |
| 224 | +#ifdef __cplusplus |
| 225 | +extern "C" { |
| 226 | +#endif |
| 227 | size_t strlcpy(char *dst, const char *src, size_t siz); |
| 228 | size_t strlcat(char *dst, const char *src, size_t siz); |
| 229 | char *strnstr(const char *str, const char *find, size_t str_len); |
| 230 | void strmode(mode_t mode, char *str); |
| 231 | |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 232 | -#if defined(_GNU_SOURCE) && defined(__GLIBC__) && !__GLIBC_PREREQ(2, 25) |
| 233 | +#if defined(_GNU_SOURCE) && defined(__GLIBC__) |
Brad Bishop | 37a0e4d | 2017-12-04 01:01:44 -0500 | [diff] [blame] | 234 | void explicit_bzero(void *buf, size_t len); |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 235 | #endif |
Brad Bishop | 37a0e4d | 2017-12-04 01:01:44 -0500 | [diff] [blame] | 236 | -__END_DECLS |
| 237 | +#ifdef __cplusplus |
| 238 | +} |
| 239 | +#endif |
| 240 | +/* __END_DECLS */ |
| 241 | |
| 242 | #endif |
| 243 | diff --git a/include/bsd/stringlist.h b/include/bsd/stringlist.h |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 244 | index ff30cac..4600f6b 100644 |
Brad Bishop | 37a0e4d | 2017-12-04 01:01:44 -0500 | [diff] [blame] | 245 | --- a/include/bsd/stringlist.h |
| 246 | +++ b/include/bsd/stringlist.h |
| 247 | @@ -43,12 +43,18 @@ typedef struct _stringlist { |
| 248 | size_t sl_cur; |
| 249 | } StringList; |
| 250 | |
| 251 | -__BEGIN_DECLS |
| 252 | +/* __BEGIN_DECLS */ |
| 253 | +#ifdef __cplusplus |
| 254 | +extern "C" { |
| 255 | +#endif |
| 256 | StringList *sl_init(void); |
| 257 | int sl_add(StringList *, char *); |
| 258 | void sl_free(StringList *, int); |
| 259 | char *sl_find(StringList *, const char *); |
| 260 | int sl_delete(StringList *, const char *, int); |
| 261 | -__END_DECLS |
| 262 | +#ifdef __cplusplus |
| 263 | +} |
| 264 | +#endif |
| 265 | +/* __END_DECLS */ |
| 266 | |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 267 | #endif /* LIBBSD_STRINGLIST_H */ |
Brad Bishop | 37a0e4d | 2017-12-04 01:01:44 -0500 | [diff] [blame] | 268 | diff --git a/include/bsd/unistd.h b/include/bsd/unistd.h |
| 269 | index 1f9c5f8..5b2f4c7 100644 |
| 270 | --- a/include/bsd/unistd.h |
| 271 | +++ b/include/bsd/unistd.h |
| 272 | @@ -45,7 +45,10 @@ |
| 273 | #define S_ISTXT S_ISVTX |
| 274 | #endif |
| 275 | |
| 276 | -__BEGIN_DECLS |
| 277 | +/* __BEGIN_DECLS */ |
| 278 | +#ifdef __cplusplus |
| 279 | +extern "C" { |
| 280 | +#endif |
| 281 | extern int optreset; |
| 282 | |
| 283 | #ifdef LIBBSD_OVERLAY |
| 284 | @@ -68,6 +71,9 @@ void setproctitle(const char *fmt, ...) |
| 285 | __printflike(1, 2); |
| 286 | |
| 287 | int getpeereid(int s, uid_t *euid, gid_t *egid); |
| 288 | -__END_DECLS |
| 289 | +#ifdef __cplusplus |
| 290 | +} |
| 291 | +#endif |
| 292 | +/* __END_DECLS */ |
| 293 | |
| 294 | #endif |
| 295 | diff --git a/include/bsd/vis.h b/include/bsd/vis.h |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 296 | index 970dfdd..621d3c6 100644 |
Brad Bishop | 37a0e4d | 2017-12-04 01:01:44 -0500 | [diff] [blame] | 297 | --- a/include/bsd/vis.h |
| 298 | +++ b/include/bsd/vis.h |
| 299 | @@ -74,7 +74,10 @@ |
| 300 | |
| 301 | #include <sys/cdefs.h> |
| 302 | |
| 303 | -__BEGIN_DECLS |
| 304 | +/* __BEGIN_DECLS */ |
| 305 | +#ifdef __cplusplus |
| 306 | +extern "C" { |
| 307 | +#endif |
| 308 | char *vis(char *, int, int, int); |
| 309 | int strvis(char *, const char *, int); |
| 310 | int strvisx(char *, const char *, size_t, int); |
| 311 | @@ -83,6 +86,9 @@ int strunvis(char *, const char *); |
| 312 | int strunvisx(char *, const char *, int); |
| 313 | ssize_t strnunvis(char *, const char *, size_t); |
| 314 | int unvis(char *, int, int *, int); |
| 315 | -__END_DECLS |
| 316 | +#ifdef __cplusplus |
| 317 | +} |
| 318 | +#endif |
| 319 | +/* __END_DECLS */ |
| 320 | |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 321 | #endif /* !LIBBSD_VIS_H */ |
Brad Bishop | 37a0e4d | 2017-12-04 01:01:44 -0500 | [diff] [blame] | 322 | diff --git a/include/bsd/wchar.h b/include/bsd/wchar.h |
| 323 | index 33a500e..aa70742 100644 |
| 324 | --- a/include/bsd/wchar.h |
| 325 | +++ b/include/bsd/wchar.h |
| 326 | @@ -43,12 +43,18 @@ |
| 327 | #include <sys/cdefs.h> |
| 328 | #include <sys/types.h> |
| 329 | |
| 330 | -__BEGIN_DECLS |
| 331 | +/* __BEGIN_DECLS */ |
| 332 | +#ifdef __cplusplus |
| 333 | +extern "C" { |
| 334 | +#endif |
| 335 | wchar_t *fgetwln(FILE *stream, size_t *len); |
| 336 | |
| 337 | size_t wcslcat(wchar_t *dst, const wchar_t *src, size_t size); |
| 338 | size_t wcslcpy(wchar_t *dst, const wchar_t *src, size_t size); |
| 339 | -__END_DECLS |
| 340 | +#ifdef __cplusplus |
| 341 | +} |
| 342 | +#endif |
| 343 | +/* __END_DECLS */ |
| 344 | |
| 345 | #endif |
| 346 | #endif |
| 347 | diff --git a/src/hash/sha512.h b/src/hash/sha512.h |
| 348 | index 4f368a1..27ddc24 100644 |
| 349 | --- a/src/hash/sha512.h |
| 350 | +++ b/src/hash/sha512.h |
| 351 | @@ -39,7 +39,10 @@ typedef struct SHA512Context { |
| 352 | unsigned char buf[128]; |
| 353 | } SHA512_CTX; |
| 354 | |
| 355 | -__BEGIN_DECLS |
| 356 | +/* __BEGIN_DECLS */ |
| 357 | +#ifdef __cplusplus |
| 358 | +extern "C" { |
| 359 | +#endif |
| 360 | |
| 361 | void SHA512_Init(SHA512_CTX *); |
| 362 | void SHA512_Update(SHA512_CTX *, const void *, size_t); |
| 363 | @@ -48,6 +51,9 @@ char *SHA512_End(SHA512_CTX *, char *); |
| 364 | char *SHA512_File(const char *, char *); |
| 365 | char *SHA512_FileChunk(const char *, char *, off_t, off_t); |
| 366 | char *SHA512_Data(const void *, unsigned int, char *); |
| 367 | -__END_DECLS |
| 368 | +#ifdef __cplusplus |
| 369 | +} |
| 370 | +#endif |
| 371 | +/* __END_DECLS */ |
| 372 | |
| 373 | #endif /* !_SHA512_H_ */ |
| 374 | -- |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 375 | 1.9.1 |
Brad Bishop | 37a0e4d | 2017-12-04 01:01:44 -0500 | [diff] [blame] | 376 | |