diff --git a/lib/zustr2stp.h b/lib/zustr2stp.h index 7775fc6d..f2dbc741 100644 --- a/lib/zustr2stp.h +++ b/lib/zustr2stp.h @@ -10,14 +10,21 @@ #include +#include #include #include #include "mempcpy.h" +#include "must_be.h" #include "sizeof.h" -#define ZUSTR2STP(dst, src) zustr2stp(dst, src, SIZEOF_ARRAY(src)) +#define ZUSTR2STP(dst, src) \ +({ \ + static_assert(!is_array(dst) || sizeof(dst) > SIZEOF_ARRAY(src), ""); \ + \ + zustr2stp(dst, src, SIZEOF_ARRAY(src)); \ +}) inline char *zustr2stp(char *restrict dst, const char *restrict src, size_t sz);