Skip to content

Commit

Permalink
strdup is not C99
Browse files Browse the repository at this point in the history
  • Loading branch information
justsmth committed Nov 22, 2024
1 parent c48572a commit 7506521
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions crypto/err/err.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,16 @@
* ([email protected]). This product includes software written by Tim
* Hudson ([email protected]). */

// `strdup` was only officially added in C23:
// * https://en.cppreference.com/w/c/string/byte/strdup
// The following macros are needed to ensure its definition
// is provided by the headers.
#ifdef __STDC_ALLOC_LIB__
#define __STDC_WANT_LIB_EXT2__ 1
#else
#define _POSIX_C_SOURCE 200809L
#endif

// Ensure we can't call OPENSSL_malloc circularly.
#define _BORINGSSL_PROHIBIT_OPENSSL_MALLOC
#include <openssl/err.h>
Expand Down

0 comments on commit 7506521

Please sign in to comment.