Skip to content
Snippets Groups Projects
Commit a987cf4b authored by Deucе's avatar Deucе :ok_hand_tone4:
Browse files

Stop interlacing preprocessor stuff.

parent 406ea948
No related branches found
No related tags found
1 merge request!455Update branch with changes from master
Pipeline #6250 passed
...@@ -430,11 +430,9 @@ typedef struct { ...@@ -430,11 +430,9 @@ typedef struct {
#define TERMINATE(str) str[sizeof(str)-1]=0 #define TERMINATE(str) str[sizeof(str)-1]=0
/* This is a bound-safe version of strcpy basically - only works with fixed-length arrays */ /* This is a bound-safe version of strcpy basically - only works with fixed-length arrays */
#ifdef _DEBUG #if defined(_DEBUG) && (__STDC_VERSION__ >= 201112L)
#define SAFECOPY(dst,src) do { \ #define SAFECOPY(dst,src) do { \
#if (__STDC_VERSION__ >= 201112L)
static_assert(sizeof(dst) != sizeof(void*), "SAFECOPY() on pointer-sized dst, use strlcpy"); \ static_assert(sizeof(dst) != sizeof(void*), "SAFECOPY() on pointer-sized dst, use strlcpy"); \
#endif
strlcpy(dst,src,sizeof(dst)); \ strlcpy(dst,src,sizeof(dst)); \
} while(0) } while(0)
#else #else
...@@ -442,11 +440,9 @@ typedef struct { ...@@ -442,11 +440,9 @@ typedef struct {
#endif #endif
/* Extra-safe SAFECOPY doesn't pass NULL-pointer to strlcpy */ /* Extra-safe SAFECOPY doesn't pass NULL-pointer to strlcpy */
#ifdef _DEBUG #if defined(_DEBUG) && (__STDC_VERSION__ >= 201112L)
#define XSAFECOPY(dst,src) do { \ #define XSAFECOPY(dst,src) do { \
#if (__STDC_VERSION__ >= 201112L)
static_assert(sizeof(dst) != sizeof(void*), "SAFECOPY() on pointer-sized dst, use strlcpy"); \ static_assert(sizeof(dst) != sizeof(void*), "SAFECOPY() on pointer-sized dst, use strlcpy"); \
#endif
strlcpy(dst,(src)==NULL?"(null)":(src),sizeof(dst)); \ strlcpy(dst,(src)==NULL?"(null)":(src),sizeof(dst)); \
} while(0) } while(0)
#else #else
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment