diff options
author | Mattias Andrée <maandree@kth.se> | 2022-06-12 18:48:26 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2022-06-12 18:48:26 +0200 |
commit | 9b483673c0c8a52d81127a23788fa4c976f2b10f (patch) | |
tree | f25ded5960dd73ccfe819fc3331f7a2b8c0561a1 | |
parent | Remove `static` from some `static inline` (diff) | |
download | libsimple-9b483673c0c8a52d81127a23788fa4c976f2b10f.tar.gz libsimple-9b483673c0c8a52d81127a23788fa4c976f2b10f.tar.bz2 libsimple-9b483673c0c8a52d81127a23788fa4c976f2b10f.tar.xz |
Replace to last static inline's with line + extern inline, and fix warnings
Signed-off-by: Mattias Andrée <maandree@kth.se>
408 files changed, 1915 insertions, 956 deletions
@@ -46,7 +46,8 @@ SUBHDR =\ HDR =\ $(SUBHDR)\ - libsimple.h + libsimple.h\ + common.h OBJ =\ aligned_allocn.o\ @@ -209,6 +210,8 @@ OBJ =\ getenv_e.o\ getenv_ne.o\ gmtime.o\ + inchrcaseset.o\ + inchrset.o\ localtime.o\ mallocn.o\ mallocz.o\ @@ -298,25 +301,38 @@ OBJ =\ reallocf.o\ reallocfn.o\ reallocn.o\ + stpmove.o\ stpnmove.o\ stpnset.o\ stpntolower.o\ stpntoupper.o\ + stpset.o\ stptolower.o\ stptoupper.o\ strcasechr.o\ strcasechr_inv.o\ strcasechrnul.o\ strcasechrnul_inv.o\ + strcasecmpnul.o\ strcaseends.o\ + strcaseeq.o\ strcaseeqlen.o\ + strcaseeqnul.o\ + strcasestarts.o\ strcasestr.o\ + strccpy.o\ strchr_inv.o\ strchrnul.o\ strchrnul_inv.o\ strcmove.o\ + strcmpnul.o\ + strend.o\ strends.o\ + streq.o\ streqlen.o\ + streqnul.o\ + strisutf8.o\ + strmove.o\ strncasechr.o\ strncasechr_inv.o\ strncasechrnul.o\ @@ -350,8 +366,11 @@ OBJ =\ strntoupper.o\ strrcasechr.o\ strrcasechr_inv.o\ + strrcaseeqlen.o\ strrcasestr.o\ strrchr_inv.o\ + strreplace.o\ + strreqlen.o\ strrncasechr.o\ strrncasechr_inv.o\ strrncaseeqlen.o\ @@ -361,6 +380,7 @@ OBJ =\ strrneqlen.o\ strrnstr.o\ strrstr.o\ + strset.o\ strstarts.o\ strtoh.o\ strtohh.o\ @@ -369,6 +389,7 @@ OBJ =\ strtoi32.o\ strtoi64.o\ strtoi8.o\ + strtolower.o\ strtotimespec.o\ strtotimeval.o\ strtou.o\ @@ -378,6 +399,7 @@ OBJ =\ strtou8.o\ strtouh.o\ strtouhh.o\ + strtoupper.o\ strtouz.o\ strtoz.o\ sumtimespec.o\ diff --git a/aligned_allocn.c b/aligned_allocn.c index 42e614c..de4b69f 100644 --- a/aligned_allocn.c +++ b/aligned_allocn.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/aligned_allocz.c b/aligned_allocz.c index ab18d1a..29e6644 100644 --- a/aligned_allocz.c +++ b/aligned_allocz.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/aligned_alloczn.c b/aligned_alloczn.c index 9b35a17..d7d199f 100644 --- a/aligned_alloczn.c +++ b/aligned_alloczn.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/aligned_memdup.c b/aligned_memdup.c index 7b2ca71..d383dbd 100644 --- a/aligned_memdup.c +++ b/aligned_memdup.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/aligned_realloc.c b/aligned_realloc.c index 1aaa0b9..985afbc 100644 --- a/aligned_realloc.c +++ b/aligned_realloc.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/aligned_reallocarray.c b/aligned_reallocarray.c index 185f24a..96fd937 100644 --- a/aligned_reallocarray.c +++ b/aligned_reallocarray.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/aligned_reallocarrayf.c b/aligned_reallocarrayf.c index 561615f..485043f 100644 --- a/aligned_reallocarrayf.c +++ b/aligned_reallocarrayf.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/aligned_reallocf.c b/aligned_reallocf.c index 9493fb9..397c328 100644 --- a/aligned_reallocf.c +++ b/aligned_reallocf.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/aligned_reallocfn.c b/aligned_reallocfn.c index 21e97ec..a686a5f 100644 --- a/aligned_reallocfn.c +++ b/aligned_reallocfn.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/aligned_reallocn.c b/aligned_reallocn.c index ffae2fd..0c63633 100644 --- a/aligned_reallocn.c +++ b/aligned_reallocn.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/aligned_strdup.c b/aligned_strdup.c index ed4ddf7..6838bed 100644 --- a/aligned_strdup.c +++ b/aligned_strdup.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/aligned_strndup.c b/aligned_strndup.c index f41fa8c..9f8cf68 100644 --- a/aligned_strndup.c +++ b/aligned_strndup.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/aligned_wcsdup.c b/aligned_wcsdup.c index abb98e0..2c2fb29 100644 --- a/aligned_wcsdup.c +++ b/aligned_wcsdup.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/aligned_wcsndup.c b/aligned_wcsndup.c index 90ce7f7..923c6b5 100644 --- a/aligned_wcsndup.c +++ b/aligned_wcsndup.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/aligned_wmemdup.c b/aligned_wmemdup.c index c92e17f..b8793e0 100644 --- a/aligned_wmemdup.c +++ b/aligned_wmemdup.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/cmptimespec.c b/cmptimespec.c index 5a8463b..025a946 100644 --- a/cmptimespec.c +++ b/cmptimespec.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -13,119 +13,195 @@ int main(void) { struct timespec ts1, ts2; - ts1.tv_sec = 0, ts1.tv_nsec = 0L; - ts2.tv_sec = 0, ts2.tv_nsec = 0L; + ts1.tv_sec = 0; + ts1.tv_nsec = 0L; + ts2.tv_sec = 0; + ts2.tv_nsec = 0L; assert(libsimple_cmptimespec(&ts1, &ts2) == 0); - ts1.tv_sec = 0, ts1.tv_nsec = 1L; - ts2.tv_sec = 0, ts2.tv_nsec = 0L; + ts1.tv_sec = 0; + ts1.tv_nsec = 1L; + ts2.tv_sec = 0; + ts2.tv_nsec = 0L; assert(libsimple_cmptimespec(&ts1, &ts2) == 1); - ts1.tv_sec = 0, ts1.tv_nsec = 999999999L; - ts2.tv_sec = 0, ts2.tv_nsec = 0L; + ts1.tv_sec = 0; + ts1.tv_nsec = 999999999L; + ts2.tv_sec = 0; + ts2.tv_nsec = 0L; assert(libsimple_cmptimespec(&ts1, &ts2) == 1); - ts1.tv_sec = 0, ts1.tv_nsec = 0L; - ts2.tv_sec = 0, ts2.tv_nsec = 1L; - assert(libsimple_cmptimespec(&ts1, &ts2) == -1); - ts1.tv_sec = 0, ts1.tv_nsec = 1L; - ts2.tv_sec = 0, ts2.tv_nsec = 1L; + ts1.tv_sec = 0; + ts1.tv_nsec = 0L; + ts2.tv_sec = 0; + ts2.tv_nsec = 1L; + assert(libsimple_cmptimespec(&ts1, &ts2) == -1); + ts1.tv_sec = 0; + ts1.tv_nsec = 1L; + ts2.tv_sec = 0; + ts2.tv_nsec = 1L; assert(libsimple_cmptimespec(&ts1, &ts2) == 0); - ts1.tv_sec = 0, ts1.tv_nsec = 999999999L; - ts2.tv_sec = 0, ts2.tv_nsec = 1L; + ts1.tv_sec = 0; + ts1.tv_nsec = 999999999L; + ts2.tv_sec = 0; + ts2.tv_nsec = 1L; assert(libsimple_cmptimespec(&ts1, &ts2) == 1); - ts1.tv_sec = 0, ts1.tv_nsec = 0L; - ts2.tv_sec = 0, ts2.tv_nsec = 999999999L; - assert(libsimple_cmptimespec(&ts1, &ts2) == -1); - ts1.tv_sec = 0, ts1.tv_nsec = 1L; - ts2.tv_sec = 0, ts2.tv_nsec = 999999999L; - assert(libsimple_cmptimespec(&ts1, &ts2) == -1); - ts1.tv_sec = 0, ts1.tv_nsec = 999999999L; - ts2.tv_sec = 0, ts2.tv_nsec = 999999999L; + ts1.tv_sec = 0; + ts1.tv_nsec = 0L; + ts2.tv_sec = 0; + ts2.tv_nsec = 999999999L; + assert(libsimple_cmptimespec(&ts1, &ts2) == -1); + ts1.tv_sec = 0; + ts1.tv_nsec = 1L; + ts2.tv_sec = 0; + ts2.tv_nsec = 999999999L; + assert(libsimple_cmptimespec(&ts1, &ts2) == -1); + ts1.tv_sec = 0; + ts1.tv_nsec = 999999999L; + ts2.tv_sec = 0; + ts2.tv_nsec = 999999999L; assert(libsimple_cmptimespec(&ts1, &ts2) == 0); - ts1.tv_sec = 1, ts1.tv_nsec = 0L; - ts2.tv_sec = 0, ts2.tv_nsec = 0L; + ts1.tv_sec = 1; + ts1.tv_nsec = 0L; + ts2.tv_sec = 0; + ts2.tv_nsec = 0L; assert(libsimple_cmptimespec(&ts1, &ts2) == 1); - ts1.tv_sec = 1, ts1.tv_nsec = 1L; - ts2.tv_sec = 0, ts2.tv_nsec = 0L; + ts1.tv_sec = 1; + ts1.tv_nsec = 1L; + ts2.tv_sec = 0; + ts2.tv_nsec = 0L; assert(libsimple_cmptimespec(&ts1, &ts2) == 1); - ts1.tv_sec = 1, ts1.tv_nsec = 0L; - ts2.tv_sec = 0, ts2.tv_nsec = 1L; + ts1.tv_sec = 1; + ts1.tv_nsec = 0L; + ts2.tv_sec = 0; + ts2.tv_nsec = 1L; assert(libsimple_cmptimespec(&ts1, &ts2) == 1); - ts1.tv_sec = 1, ts1.tv_nsec = 1L; - ts2.tv_sec = 0, ts2.tv_nsec = 1L; + ts1.tv_sec = 1; + ts1.tv_nsec = 1L; + ts2.tv_sec = 0; + ts2.tv_nsec = 1L; assert(libsimple_cmptimespec(&ts1, &ts2) == 1); - ts1.tv_sec = 0, ts1.tv_nsec = 0L; - ts2.tv_sec = 1, ts2.tv_nsec = 0L; - assert(libsimple_cmptimespec(&ts1, &ts2) == -1); - ts1.tv_sec = 0, ts1.tv_nsec = 1L; - ts2.tv_sec = 1, ts2.tv_nsec = 0L; - assert(libsimple_cmptimespec(&ts1, &ts2) == -1); - ts1.tv_sec = 0, ts1.tv_nsec = 0L; - ts2.tv_sec = 1, ts2.tv_nsec = 1L; - assert(libsimple_cmptimespec(&ts1, &ts2) == -1); - ts1.tv_sec = 0, ts1.tv_nsec = 1L; - ts2.tv_sec = 1, ts2.tv_nsec = 1L; - assert(libsimple_cmptimespec(&ts1, &ts2) == -1); - ts1.tv_sec = 1, ts1.tv_nsec = 0L; - ts2.tv_sec = 1, ts2.tv_nsec = 0L; + ts1.tv_sec = 0; + ts1.tv_nsec = 0L; + ts2.tv_sec = 1; + ts2.tv_nsec = 0L; + assert(libsimple_cmptimespec(&ts1, &ts2) == -1); + ts1.tv_sec = 0; + ts1.tv_nsec = 1L; + ts2.tv_sec = 1; + ts2.tv_nsec = 0L; + assert(libsimple_cmptimespec(&ts1, &ts2) == -1); + ts1.tv_sec = 0; + ts1.tv_nsec = 0L; + ts2.tv_sec = 1; + ts2.tv_nsec = 1L; + assert(libsimple_cmptimespec(&ts1, &ts2) == -1); + ts1.tv_sec = 0; + ts1.tv_nsec = 1L; + ts2.tv_sec = 1; + ts2.tv_nsec = 1L; + assert(libsimple_cmptimespec(&ts1, &ts2) == -1); + ts1.tv_sec = 1; + ts1.tv_nsec = 0L; + ts2.tv_sec = 1; + ts2.tv_nsec = 0L; assert(libsimple_cmptimespec(&ts1, &ts2) == 0); - ts1.tv_sec = 1, ts1.tv_nsec = 1L; - ts2.tv_sec = 1, ts2.tv_nsec = 0L; + ts1.tv_sec = 1; + ts1.tv_nsec = 1L; + ts2.tv_sec = 1; + ts2.tv_nsec = 0L; assert(libsimple_cmptimespec(&ts1, &ts2) == 1); - ts1.tv_sec = 1, ts1.tv_nsec = 0L; - ts2.tv_sec = 1, ts2.tv_nsec = 1L; - assert(libsimple_cmptimespec(&ts1, &ts2) == -1); - ts1.tv_sec = 1, ts1.tv_nsec = 1L; - ts2.tv_sec = 1, ts2.tv_nsec = 1L; + ts1.tv_sec = 1; + ts1.tv_nsec = 0L; + ts2.tv_sec = 1; + ts2.tv_nsec = 1L; + assert(libsimple_cmptimespec(&ts1, &ts2) == -1); + ts1.tv_sec = 1; + ts1.tv_nsec = 1L; + ts2.tv_sec = 1; + ts2.tv_nsec = 1L; assert(libsimple_cmptimespec(&ts1, &ts2) == 0); - ts1.tv_sec = -1, ts1.tv_nsec = 0L; - ts2.tv_sec = 0, ts2.tv_nsec = 0L; - assert(libsimple_cmptimespec(&ts1, &ts2) == -1); - ts1.tv_sec = -1, ts1.tv_nsec = 1L; - ts2.tv_sec = 0, ts2.tv_nsec = 0L; - assert(libsimple_cmptimespec(&ts1, &ts2) == -1); - ts1.tv_sec = -1, ts1.tv_nsec = 0L; - ts2.tv_sec = 0, ts2.tv_nsec = 1L; - assert(libsimple_cmptimespec(&ts1, &ts2) == -1); - ts1.tv_sec = -1, ts1.tv_nsec = 1L; - ts2.tv_sec = 0, ts2.tv_nsec = 1L; - assert(libsimple_cmptimespec(&ts1, &ts2) == -1); - ts1.tv_sec = 0, ts1.tv_nsec = 0L; - ts2.tv_sec = -1, ts2.tv_nsec = 0L; + ts1.tv_sec = -1; + ts1.tv_nsec = 0L; + ts2.tv_sec = 0; + ts2.tv_nsec = 0L; + assert(libsimple_cmptimespec(&ts1, &ts2) == -1); + ts1.tv_sec = -1; + ts1.tv_nsec = 1L; + ts2.tv_sec = 0; + ts2.tv_nsec = 0L; + assert(libsimple_cmptimespec(&ts1, &ts2) == -1); + ts1.tv_sec = -1; + ts1.tv_nsec = 0L; + ts2.tv_sec = 0; + ts2.tv_nsec = 1L; + assert(libsimple_cmptimespec(&ts1, &ts2) == -1); + ts1.tv_sec = -1; + ts1.tv_nsec = 1L; + ts2.tv_sec = 0; + ts2.tv_nsec = 1L; + assert(libsimple_cmptimespec(&ts1, &ts2) == -1); + ts1.tv_sec = 0; + ts1.tv_nsec = 0L; + ts2.tv_sec = -1; + ts2.tv_nsec = 0L; assert(libsimple_cmptimespec(&ts1, &ts2) == 1); - ts1.tv_sec = 0, ts1.tv_nsec = 1L; - ts2.tv_sec = -1, ts2.tv_nsec = 0L; + ts1.tv_sec = 0; + ts1.tv_nsec = 1L; + ts2.tv_sec = -1; + ts2.tv_nsec = 0L; assert(libsimple_cmptimespec(&ts1, &ts2) == 1); - ts1.tv_sec = 0, ts1.tv_nsec = 0L; - ts2.tv_sec = -1, ts2.tv_nsec = 1L; + ts1.tv_sec = 0; + ts1.tv_nsec = 0L; + ts2.tv_sec = -1; + ts2.tv_nsec = 1L; assert(libsimple_cmptimespec(&ts1, &ts2) == 1); - ts1.tv_sec = 0, ts1.tv_nsec = 1L; - ts2.tv_sec = -1, ts2.tv_nsec = 1L; + ts1.tv_sec = 0; + ts1.tv_nsec = 1L; + ts2.tv_sec = -1; + ts2.tv_nsec = 1L; assert(libsimple_cmptimespec(&ts1, &ts2) == 1); - ts1.tv_sec = -1, ts1.tv_nsec = 0L; - ts2.tv_sec = -1, ts2.tv_nsec = 0L; + ts1.tv_sec = -1; + ts1.tv_nsec = 0L; + ts2.tv_sec = -1; + ts2.tv_nsec = 0L; assert(libsimple_cmptimespec(&ts1, &ts2) == 0); - ts1.tv_sec = -1, ts1.tv_nsec = 1L; - ts2.tv_sec = -1, ts2.tv_nsec = 0L; + ts1.tv_sec = -1; + ts1.tv_nsec = 1L; + ts2.tv_sec = -1; + ts2.tv_nsec = 0L; assert(libsimple_cmptimespec(&ts1, &ts2) == 1); - ts1.tv_sec = -1, ts1.tv_nsec = 0L; - ts2.tv_sec = -1, ts2.tv_nsec = 1L; - assert(libsimple_cmptimespec(&ts1, &ts2) == -1); - ts1.tv_sec = -1, ts1.tv_nsec = 1L; - ts2.tv_sec = -1, ts2.tv_nsec = 1L; + ts1.tv_sec = -1; + ts1.tv_nsec = 0L; + ts2.tv_sec = -1; + ts2.tv_nsec = 1L; + assert(libsimple_cmptimespec(&ts1, &ts2) == -1); + ts1.tv_sec = -1; + ts1.tv_nsec = 1L; + ts2.tv_sec = -1; + ts2.tv_nsec = 1L; assert(libsimple_cmptimespec(&ts1, &ts2) == 0); - ts1.tv_sec = 0, ts1.tv_nsec = 0L; - ts2.tv_sec = TIME_MAX, ts2.tv_nsec = 0L; - assert(libsimple_cmptimespec(&ts1, &ts2) == -1); - ts1.tv_sec = 1, ts1.tv_nsec = 0L; - ts2.tv_sec = TIME_MAX, ts2.tv_nsec = 0L; - assert(libsimple_cmptimespec(&ts1, &ts2) == -1); - ts1.tv_sec = TIME_MAX, ts1.tv_nsec = 0L; - ts2.tv_sec = TIME_MAX, ts2.tv_nsec = 0L; + ts1.tv_sec = 0; + ts1.tv_nsec = 0L; + ts2.tv_sec = TIME_MAX; + ts2.tv_nsec = 0L; + assert(libsimple_cmptimespec(&ts1, &ts2) == -1); + ts1.tv_sec = 1; + ts1.tv_nsec = 0L; + ts2.tv_sec = TIME_MAX; + ts2.tv_nsec = 0L; + assert(libsimple_cmptimespec(&ts1, &ts2) == -1); + ts1.tv_sec = TIME_MAX; + ts1.tv_nsec = 0L; + ts2.tv_sec = TIME_MAX; + ts2.tv_nsec = 0L; assert(libsimple_cmptimespec(&ts1, &ts2) == 0); - ts1.tv_sec = 1, ts1.tv_nsec = 0L; - ts2.tv_sec = -1, ts2.tv_nsec = 0L; + ts1.tv_sec = 1; + ts1.tv_nsec = 0L; + ts2.tv_sec = -1; + ts2.tv_nsec = 0L; assert(libsimple_cmptimespec(&ts1, &ts2) == 1); - ts1.tv_sec = -1, ts1.tv_nsec = 0L; - ts2.tv_sec = 1, ts2.tv_nsec = 0L; + ts1.tv_sec = -1; + ts1.tv_nsec = 0L; + ts2.tv_sec = 1; + ts2.tv_nsec = 0L; assert(libsimple_cmptimespec(&ts1, &ts2) == -1); return 0; } diff --git a/cmptimeval.c b/cmptimeval.c index 7324988..4723705 100644 --- a/cmptimeval.c +++ b/cmptimeval.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/common.h b/common.h new file mode 100644 index 0000000..7f84f59 --- /dev/null +++ b/common.h @@ -0,0 +1,11 @@ +/* See LICENSE file for copyright and license details. */ +#include "libsimple.h" + +#if defined(__clang__) +# pragma clang diagnostic ignored "-Wdocumentation" +# pragma clang diagnostic ignored "-Wdocumentation-unknown-command" +# pragma clang diagnostic ignored "-Wreserved-identifier" +# pragma clang diagnostic ignored "-Wdisabled-macro-expansion" +# pragma clang diagnostic ignored "-Wc++98-compat" +# pragma clang diagnostic ignored "-Wcovered-switch-default" +#endif diff --git a/difftimespec.c b/difftimespec.c index 86d3441..f756007 100644 --- a/difftimespec.c +++ b/difftimespec.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -47,104 +47,138 @@ main(void) { struct timespec r, a, b; - a.tv_sec = 0, a.tv_nsec = 0L; - b.tv_sec = 0, b.tv_nsec = 0L; + a.tv_sec = 0; + a.tv_nsec = 0L; + b.tv_sec = 0; + b.tv_nsec = 0L; assert(!libsimple_difftimespec(&r, &a, &b)); assert(r.tv_sec == 0); assert(r.tv_nsec == 0L); - a.tv_sec = 10, a.tv_nsec = 0L; - b.tv_sec = 0, b.tv_nsec = 0L; + a.tv_sec = 10; + a.tv_nsec = 0L; + b.tv_sec = 0; + b.tv_nsec = 0L; assert(!libsimple_difftimespec(&r, &a, &b)); assert(r.tv_sec == 10); assert(r.tv_nsec == 0L); - a.tv_sec = 10, a.tv_nsec = 100L; - b.tv_sec = 0, b.tv_nsec = 0L; + a.tv_sec = 10; + a.tv_nsec = 100L; + b.tv_sec = 0; + b.tv_nsec = 0L; assert(!libsimple_difftimespec(&r, &a, &b)); assert(r.tv_sec == 10); assert(r.tv_nsec == 100L); - a.tv_sec = 10, a.tv_nsec = 100L; - b.tv_sec = 1, b.tv_nsec = 0L; + a.tv_sec = 10; + a.tv_nsec = 100L; + b.tv_sec = 1; + b.tv_nsec = 0L; assert(!libsimple_difftimespec(&r, &a, &b)); assert(r.tv_sec == 9); assert(r.tv_nsec == 100L); - a.tv_sec = 10, a.tv_nsec = 100L; - b.tv_sec = 0, b.tv_nsec = 1L; + a.tv_sec = 10; + a.tv_nsec = 100L; + b.tv_sec = 0; + b.tv_nsec = 1L; assert(!libsimple_difftimespec(&r, &a, &b)); assert(r.tv_sec == 10); assert(r.tv_nsec == 99L); - a.tv_sec = -10, a.tv_nsec = 100L; - b.tv_sec = 0, b.tv_nsec = 0L; + a.tv_sec = -10; + a.tv_nsec = 100L; + b.tv_sec = 0; + b.tv_nsec = 0L; assert(!libsimple_difftimespec(&r, &a, &b)); assert(r.tv_sec == -10); assert(r.tv_nsec == 100L); - a.tv_sec = 10, a.tv_nsec = 1L; - b.tv_sec = 1, b.tv_nsec = 100L; + a.tv_sec = 10; + a.tv_nsec = 1L; + b.tv_sec = 1; + b.tv_nsec = 100L; assert(!libsimple_difftimespec(&r, &a, &b)); assert(r.tv_sec == 8); assert(r.tv_nsec == 1000000001L - 100L); - a.tv_sec = 10, a.tv_nsec = 0L; - b.tv_sec = 20, b.tv_nsec = 0L; + a.tv_sec = 10; + a.tv_nsec = 0L; + b.tv_sec = 20; + b.tv_nsec = 0L; assert(!libsimple_difftimespec(&r, &a, &b)); assert(r.tv_sec == -10); assert(r.tv_nsec == 0L); - a.tv_sec = 10, a.tv_nsec = 10L; - b.tv_sec = 20, b.tv_nsec = 0L; + a.tv_sec = 10; + a.tv_nsec = 10L; + b.tv_sec = 20; + b.tv_nsec = 0L; assert(!libsimple_difftimespec(&r, &a, &b)); assert(r.tv_sec == -10); assert(r.tv_nsec == 10L); - a.tv_sec = 10, a.tv_nsec = 10L; - b.tv_sec = 20, b.tv_nsec = 20L; + a.tv_sec = 10; + a.tv_nsec = 10L; + b.tv_sec = 20; + b.tv_nsec = 20L; assert(!libsimple_difftimespec(&r, &a, &b)); assert(r.tv_sec == -10 - 1); assert(r.tv_nsec == 1000000010L - 20L); - a.tv_sec = 10, a.tv_nsec = 10L; - b.tv_sec = -20, b.tv_nsec = 0L; + a.tv_sec = 10; + a.tv_nsec = 10L; + b.tv_sec = -20; + b.tv_nsec = 0L; assert(!libsimple_difftimespec(&r, &a, &b)); assert(r.tv_sec == 30); assert(r.tv_nsec == 10L); - a.tv_sec = 0, a.tv_nsec = 10L; - b.tv_sec = 0, b.tv_nsec = 0L; + a.tv_sec = 0; + a.tv_nsec = 10L; + b.tv_sec = 0; + b.tv_nsec = 0L; assert(!libsimple_difftimespec(&r, &a, &b)); assert(r.tv_sec == 0); assert(r.tv_nsec == 10L); - a.tv_sec = 0, a.tv_nsec = 0L; - b.tv_sec = 0, b.tv_nsec = 10L; + a.tv_sec = 0; + a.tv_nsec = 0L; + b.tv_sec = 0; + b.tv_nsec = 10L; assert(!libsimple_difftimespec(&r, &a, &b)); assert(r.tv_sec == -1); assert(r.tv_nsec == 1000000000L - 10L); - a.tv_sec = TIME_MIN, a.tv_nsec = 0L; - b.tv_sec = 0, b.tv_nsec = 0L; + a.tv_sec = TIME_MIN; + a.tv_nsec = 0L; + b.tv_sec = 0; + b.tv_nsec = 0L; assert(!libsimple_difftimespec(&r, &a, &b)); assert(r.tv_sec == TIME_MIN); assert(r.tv_nsec == 0L); - a.tv_sec = TIME_MIN, a.tv_nsec = 0L; - b.tv_sec = 0, b.tv_nsec = 1L; + a.tv_sec = TIME_MIN; + a.tv_nsec = 0L; + b.tv_sec = 0; + b.tv_nsec = 1L; assert(libsimple_difftimespec(&r, &a, &b) == -1 && errno == ERANGE); assert(r.tv_sec == TIME_MIN); assert(r.tv_nsec == 0L); - a.tv_sec = TIME_MIN, a.tv_nsec = 0L; - b.tv_sec = -1, b.tv_nsec = 1L; + a.tv_sec = TIME_MIN; + a.tv_nsec = 0L; + b.tv_sec = -1; + b.tv_nsec = 1L; assert(!libsimple_difftimespec(&r, &a, &b)); assert(r.tv_sec == TIME_MIN); assert(r.tv_nsec == 999999999L); - a.tv_sec = TIME_MAX, a.tv_nsec = 0L; - b.tv_sec = -1, b.tv_nsec = 0L; + a.tv_sec = TIME_MAX; + a.tv_nsec = 0L; + b.tv_sec = -1; + b.tv_nsec = 0L; assert(libsimple_difftimespec(&r, &a, &b) == -1 && errno == ERANGE); assert(r.tv_sec == TIME_MAX); assert(r.tv_nsec == 999999999L); diff --git a/difftimeval.c b/difftimeval.c index e4c65e4..d9dcbf3 100644 --- a/difftimeval.c +++ b/difftimeval.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/doubletotimespec.c b/doubletotimespec.c index 02f40e9..f993f04 100644 --- a/doubletotimespec.c +++ b/doubletotimespec.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/doubletotimeval.c b/doubletotimeval.c index c603703..2977f42 100644 --- a/doubletotimeval.c +++ b/doubletotimeval.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/ealigned_alloc.c b/ealigned_alloc.c index 8076b23..38c512d 100644 --- a/ealigned_alloc.c +++ b/ealigned_alloc.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/ealigned_allocn.c b/ealigned_allocn.c index e10399b..dd6d294 100644 --- a/ealigned_allocn.c +++ b/ealigned_allocn.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/ealigned_allocz.c b/ealigned_allocz.c index 586df48..6d6307c 100644 --- a/ealigned_allocz.c +++ b/ealigned_allocz.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/ealigned_alloczn.c b/ealigned_alloczn.c index 2787549..31db576 100644 --- a/ealigned_alloczn.c +++ b/ealigned_alloczn.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/ealigned_memdup.c b/ealigned_memdup.c index 4209a77..1175c3e 100644 --- a/ealigned_memdup.c +++ b/ealigned_memdup.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/ealigned_realloc.c b/ealigned_realloc.c index 40b8372..ecca369 100644 --- a/ealigned_realloc.c +++ b/ealigned_realloc.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/ealigned_reallocarray.c b/ealigned_reallocarray.c index 8f44315..214c7cb 100644 --- a/ealigned_reallocarray.c +++ b/ealigned_reallocarray.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/ealigned_reallocn.c b/ealigned_reallocn.c index 3292a5a..da78bac 100644 --- a/ealigned_reallocn.c +++ b/ealigned_reallocn.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/ealigned_strdup.c b/ealigned_strdup.c index f0fd7e4..4f4a03d 100644 --- a/ealigned_strdup.c +++ b/ealigned_strdup.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/ealigned_strndup.c b/ealigned_strndup.c index 1d8cc1d..368f77b 100644 --- a/ealigned_strndup.c +++ b/ealigned_strndup.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/ealigned_wcsdup.c b/ealigned_wcsdup.c index a73a261..8f7a83e 100644 --- a/ealigned_wcsdup.c +++ b/ealigned_wcsdup.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/ealigned_wcsndup.c b/ealigned_wcsndup.c index 2f70be3..f155e23 100644 --- a/ealigned_wcsndup.c +++ b/ealigned_wcsndup.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/ealigned_wmemdup.c b/ealigned_wmemdup.c index dae7c33..99a24f1 100644 --- a/ealigned_wmemdup.c +++ b/ealigned_wmemdup.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/elocaltime.c b/elocaltime.c index b3accdd..f54f095 100644 --- a/elocaltime.c +++ b/elocaltime.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/emalloczn.c b/emalloczn.c index 760ee59..e85f436 100644 --- a/emalloczn.c +++ b/emalloczn.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/ememalign.c b/ememalign.c index 422c08d..ef48af4 100644 --- a/ememalign.c +++ b/ememalign.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/ememalignn.c b/ememalignn.c index cda6e99..eb259d4 100644 --- a/ememalignn.c +++ b/ememalignn.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/ememalignz.c b/ememalignz.c index 2ca550d..f45a04e 100644 --- a/ememalignz.c +++ b/ememalignz.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/ememalignzn.c b/ememalignzn.c index 72ab6f2..9f97d7f 100644 --- a/ememalignzn.c +++ b/ememalignzn.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/ememalloc.c b/ememalloc.c index 79b2059..525e67f 100644 --- a/ememalloc.c +++ b/ememalloc.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/enaligned_alloc.c b/enaligned_alloc.c index b7f8754..a6edf6b 100644 --- a/enaligned_alloc.c +++ b/enaligned_alloc.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/enaligned_allocn.c b/enaligned_allocn.c index 2c10177..77ac1ae 100644 --- a/enaligned_allocn.c +++ b/enaligned_allocn.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/enaligned_allocz.c b/enaligned_allocz.c index f92df4f..b620e53 100644 --- a/enaligned_allocz.c +++ b/enaligned_allocz.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/enaligned_alloczn.c b/enaligned_alloczn.c index 55f00d7..469eb45 100644 --- a/enaligned_alloczn.c +++ b/enaligned_alloczn.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/enaligned_memdup.c b/enaligned_memdup.c index ae8589f..dc3188e 100644 --- a/enaligned_memdup.c +++ b/enaligned_memdup.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/enaligned_realloc.c b/enaligned_realloc.c index 6d5ac4e..117c62a 100644 --- a/enaligned_realloc.c +++ b/enaligned_realloc.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/enaligned_reallocarray.c b/enaligned_reallocarray.c index 5a71207..5fd1d47 100644 --- a/enaligned_reallocarray.c +++ b/enaligned_reallocarray.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/enaligned_reallocn.c b/enaligned_reallocn.c index 3b561d8..aa93740 100644 --- a/enaligned_reallocn.c +++ b/enaligned_reallocn.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/enaligned_strdup.c b/enaligned_strdup.c index b2e505b..9312566 100644 --- a/enaligned_strdup.c +++ b/enaligned_strdup.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/enaligned_strndup.c b/enaligned_strndup.c index 91825fd..1901628 100644 --- a/enaligned_strndup.c +++ b/enaligned_strndup.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/enaligned_wcsdup.c b/enaligned_wcsdup.c index c048cc8..0293b62 100644 --- a/enaligned_wcsdup.c +++ b/enaligned_wcsdup.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/enaligned_wcsndup.c b/enaligned_wcsndup.c index 840d180..b7deea0 100644 --- a/enaligned_wcsndup.c +++ b/enaligned_wcsndup.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/enaligned_wmemdup.c b/enaligned_wmemdup.c index 657b644..df976bc 100644 --- a/enaligned_wmemdup.c +++ b/enaligned_wmemdup.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/encallocn.c b/encallocn.c index 49336da..a43fcbb 100644 --- a/encallocn.c +++ b/encallocn.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/enlocaltime.c b/enlocaltime.c index 73fc99e..e3df109 100644 --- a/enlocaltime.c +++ b/enlocaltime.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/enmallocn.c b/enmallocn.c index 761f196..b3600f6 100644 --- a/enmallocn.c +++ b/enmallocn.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/enmallocz.c b/enmallocz.c index 6204df8..7d51d9c 100644 --- a/enmallocz.c +++ b/enmallocz.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/enmalloczn.c b/enmalloczn.c index 69636f5..ac8b874 100644 --- a/enmalloczn.c +++ b/enmalloczn.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/enmemalign.c b/enmemalign.c index 766317d..306a09e 100644 --- a/enmemalign.c +++ b/enmemalign.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/enmemalignn.c b/enmemalignn.c index d7f67c7..b6dc8a3 100644 --- a/enmemalignn.c +++ b/enmemalignn.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/enmemalignz.c b/enmemalignz.c index 11fdb3a..b54ec4b 100644 --- a/enmemalignz.c +++ b/enmemalignz.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/enmemalignzn.c b/enmemalignzn.c index 4a43192..27d2b84 100644 --- a/enmemalignzn.c +++ b/enmemalignzn.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/enmemalloc.c b/enmemalloc.c index b81147b..763dffa 100644 --- a/enmemalloc.c +++ b/enmemalloc.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/enposix_memalign.c b/enposix_memalign.c index e2978e4..f50a3d2 100644 --- a/enposix_memalign.c +++ b/enposix_memalign.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/enposix_memalignn.c b/enposix_memalignn.c index 121d7c0..c8a6f0d 100644 --- a/enposix_memalignn.c +++ b/enposix_memalignn.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/enposix_memalignz.c b/enposix_memalignz.c index 81844ea..9b6c1c7 100644 --- a/enposix_memalignz.c +++ b/enposix_memalignz.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/enposix_memalignzn.c b/enposix_memalignzn.c index 3606e74..e7e1417 100644 --- a/enposix_memalignzn.c +++ b/enposix_memalignzn.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/enputenvf.c b/enputenvf.c index 8447eae..8ee5241 100644 --- a/enputenvf.c +++ b/enputenvf.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/enpvalloc.c b/enpvalloc.c index ab5df3a..34621f4 100644 --- a/enpvalloc.c +++ b/enpvalloc.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/enpvallocn.c b/enpvallocn.c index e4692ec..ffe89ec 100644 --- a/enpvallocn.c +++ b/enpvallocn.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/enpvallocz.c b/enpvallocz.c index d20e6f6..40661cc 100644 --- a/enpvallocz.c +++ b/enpvallocz.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/enpvalloczn.c b/enpvalloczn.c index 94d56bf..63c4746 100644 --- a/enpvalloczn.c +++ b/enpvalloczn.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/enrealloc.c b/enrealloc.c index fd3fa31..117fb06 100644 --- a/enrealloc.c +++ b/enrealloc.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/enreallocarray.c b/enreallocarray.c index 48ac9bd..f0e5ddb 100644 --- a/enreallocarray.c +++ b/enreallocarray.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -51,7 +51,7 @@ main(void) assert(!alloc_fail_in); } -#if defined(__GNUC__) && !defined(__clang) +#if defined(__GNUC__) && !defined(__clang__) # pragma GCC diagnostic push # pragma GCC diagnostic ignored "-Walloc-size-larger-than=" #endif @@ -60,7 +60,7 @@ main(void) assert(exit_status == 3); assert_stderr("%s: reallocarray: %s\n", argv0, strerror(ENOMEM)); -#if defined(__GNUC__) && !defined(__clang) +#if defined(__GNUC__) && !defined(__clang__) # pragma GCC diagnostic pop #endif diff --git a/enreallocn.c b/enreallocn.c index c1817d9..2bb12e8 100644 --- a/enreallocn.c +++ b/enreallocn.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/enstrndup.c b/enstrndup.c index 755872d..9457352 100644 --- a/enstrndup.c +++ b/enstrndup.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/envaligned_allocn.c b/envaligned_allocn.c index 622eada..fbb97f2 100644 --- a/envaligned_allocn.c +++ b/envaligned_allocn.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/envaligned_alloczn.c b/envaligned_alloczn.c index d79c6e7..37018d4 100644 --- a/envaligned_alloczn.c +++ b/envaligned_alloczn.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/envaligned_reallocn.c b/envaligned_reallocn.c index 747e8c8..ab24fe8 100644 --- a/envaligned_reallocn.c +++ b/envaligned_reallocn.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/envallocn.c b/envallocn.c index 664d50c..c253528 100644 --- a/envallocn.c +++ b/envallocn.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/envallocz.c b/envallocz.c index 8e8d9b3..5fcb8a2 100644 --- a/envallocz.c +++ b/envallocz.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/envalloczn.c b/envalloczn.c index c9a68fa..c5b6613 100644 --- a/envalloczn.c +++ b/envalloczn.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/envcallocn.c b/envcallocn.c index 1e5a0dd..3c943ef 100644 --- a/envcallocn.c +++ b/envcallocn.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/envmallocn.c b/envmallocn.c index 531234e..9b37db4 100644 --- a/envmallocn.c +++ b/envmallocn.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/envmalloczn.c b/envmalloczn.c index 3e81b56..b2c3987 100644 --- a/envmalloczn.c +++ b/envmalloczn.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/envmemalignn.c b/envmemalignn.c index 8df18c0..48a56fd 100644 --- a/envmemalignn.c +++ b/envmemalignn.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/envmemalignzn.c b/envmemalignzn.c index 278785f..fb4b464 100644 --- a/envmemalignzn.c +++ b/envmemalignzn.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/envmemalloc.c b/envmemalloc.c index c500063..2a93adc 100644 --- a/envmemalloc.c +++ b/envmemalloc.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/envposix_memalignn.c b/envposix_memalignn.c index d408e1a..166f545 100644 --- a/envposix_memalignn.c +++ b/envposix_memalignn.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/envposix_memalignzn.c b/envposix_memalignzn.c index 0693ac0..cb34725 100644 --- a/envposix_memalignzn.c +++ b/envposix_memalignzn.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/envputenvf.c b/envputenvf.c index 8b7fa72..71b9199 100644 --- a/envputenvf.c +++ b/envputenvf.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/envpvallocn.c b/envpvallocn.c index 46a3acd..2ad3ce7 100644 --- a/envpvallocn.c +++ b/envpvallocn.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/envpvalloczn.c b/envpvalloczn.c index 16bd5c4..be4b753 100644 --- a/envpvalloczn.c +++ b/envpvalloczn.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/envreallocn.c b/envreallocn.c index 7fdc82e..642deb4 100644 --- a/envreallocn.c +++ b/envreallocn.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/envvallocn.c b/envvallocn.c index 93ea889..b351a14 100644 --- a/envvallocn.c +++ b/envvallocn.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/envvalloczn.c b/envvalloczn.c index f7e7886..279dbf4 100644 --- a/envvalloczn.c +++ b/envvalloczn.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/enwcsndup.c b/enwcsndup.c index 04ff9fc..f642125 100644 --- a/enwcsndup.c +++ b/enwcsndup.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/enwmemdup.c b/enwmemdup.c index 19dc6be..14b5871 100644 --- a/enwmemdup.c +++ b/enwmemdup.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/eposix_memalign.c b/eposix_memalign.c index b471235..27b787d 100644 --- a/eposix_memalign.c +++ b/eposix_memalign.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/eposix_memalignn.c b/eposix_memalignn.c index 2845fe6..9ae5e18 100644 --- a/eposix_memalignn.c +++ b/eposix_memalignn.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/eposix_memalignz.c b/eposix_memalignz.c index c0ac5c1..bfc2d98 100644 --- a/eposix_memalignz.c +++ b/eposix_memalignz.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/eposix_memalignzn.c b/eposix_memalignzn.c index acb2153..76ea797 100644 --- a/eposix_memalignzn.c +++ b/eposix_memalignzn.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/epvallocn.c b/epvallocn.c index 4fcf347..8eef2d8 100644 --- a/epvallocn.c +++ b/epvallocn.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/epvallocz.c b/epvallocz.c index c9da7df..95ea4cf 100644 --- a/epvallocz.c +++ b/epvallocz.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/epvalloczn.c b/epvalloczn.c index b6880c3..976813b 100644 --- a/epvalloczn.c +++ b/epvalloczn.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/ereallocarray.c b/ereallocarray.c index da022ae..2d07ee0 100644 --- a/ereallocarray.c +++ b/ereallocarray.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -46,7 +46,7 @@ main(void) libsimple_default_failure_exit = 1; } -#if defined(__GNUC__) && !defined(__clang) +#if defined(__GNUC__) && !defined(__clang__) # pragma GCC diagnostic push # pragma GCC diagnostic ignored "-Walloc-size-larger-than=" #endif @@ -57,7 +57,7 @@ main(void) assert_stderr("%s: reallocarray: %s\n", argv0, strerror(ENOMEM)); libsimple_default_failure_exit = 1; -#if defined(__GNUC__) && !defined(__clang) +#if defined(__GNUC__) && !defined(__clang__) # pragma GCC diagnostic pop #endif diff --git a/ereallocn.c b/ereallocn.c index 17b1f09..f00fed3 100644 --- a/ereallocn.c +++ b/ereallocn.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/evaligned_allocn.c b/evaligned_allocn.c index 4f318fe..2d14680 100644 --- a/evaligned_allocn.c +++ b/evaligned_allocn.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/evaligned_alloczn.c b/evaligned_alloczn.c index 1e5d543..ec2d305 100644 --- a/evaligned_alloczn.c +++ b/evaligned_alloczn.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/evaligned_reallocn.c b/evaligned_reallocn.c index 676fbb6..37e7133 100644 --- a/evaligned_reallocn.c +++ b/evaligned_reallocn.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/evalloczn.c b/evalloczn.c index 9be9c16..9e231c3 100644 --- a/evalloczn.c +++ b/evalloczn.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/evcallocn.c b/evcallocn.c index d577ebc..25770bc 100644 --- a/evcallocn.c +++ b/evcallocn.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/evmallocn.c b/evmallocn.c index f15b8d6..67003f0 100644 --- a/evmallocn.c +++ b/evmallocn.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/evmalloczn.c b/evmalloczn.c index 3afa855..7cf4abe 100644 --- a/evmalloczn.c +++ b/evmalloczn.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/evmemalignn.c b/evmemalignn.c index 5cacc95..5e1de37 100644 --- a/evmemalignn.c +++ b/evmemalignn.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/evmemalignzn.c b/evmemalignzn.c index 643d5a6..304d5b8 100644 --- a/evmemalignzn.c +++ b/evmemalignzn.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/evmemalloc.c b/evmemalloc.c index 2f04b4b..cb929ec 100644 --- a/evmemalloc.c +++ b/evmemalloc.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/evposix_memalignn.c b/evposix_memalignn.c index bd13743..e5e95bc 100644 --- a/evposix_memalignn.c +++ b/evposix_memalignn.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/evposix_memalignzn.c b/evposix_memalignzn.c index 71a5250..e1a0b43 100644 --- a/evposix_memalignzn.c +++ b/evposix_memalignzn.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/evputenvf.c b/evputenvf.c index b35aae3..e3647ba 100644 --- a/evputenvf.c +++ b/evputenvf.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/evpvallocn.c b/evpvallocn.c index 4ce9e69..6dc643d 100644 --- a/evpvallocn.c +++ b/evpvallocn.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/evpvalloczn.c b/evpvalloczn.c index ddc593b..dbec77c 100644 --- a/evpvalloczn.c +++ b/evpvalloczn.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/evreallocn.c b/evreallocn.c index 5bddb0e..e576866 100644 --- a/evreallocn.c +++ b/evreallocn.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/evvallocn.c b/evvallocn.c index a87d171..5e52d4f 100644 --- a/evvallocn.c +++ b/evvallocn.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/evvalloczn.c b/evvalloczn.c index dee0a1c..9776ab2 100644 --- a/evvalloczn.c +++ b/evvalloczn.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/getenv_ne.c b/getenv_ne.c index e3b962a..6806992 100644 --- a/getenv_ne.c +++ b/getenv_ne.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #include <sys/timex.h> #ifndef TEST diff --git a/inchrcaseset.c b/inchrcaseset.c new file mode 100644 index 0000000..bd50fa3 --- /dev/null +++ b/inchrcaseset.c @@ -0,0 +1,18 @@ +/* See LICENSE file for copyright and license details. */ +#include "common.h" +#ifndef TEST + + +extern inline int libsimple_inchrcaseset(int, const char *); + + +#else +#include "test.h" + +int +main(void) +{ + return 0; +} + +#endif diff --git a/inchrset.c b/inchrset.c new file mode 100644 index 0000000..7358ede --- /dev/null +++ b/inchrset.c @@ -0,0 +1,18 @@ +/* See LICENSE file for copyright and license details. */ +#include "common.h" +#ifndef TEST + + +extern inline int libsimple_inchrset(int, const char *); + + +#else +#include "test.h" + +int +main(void) +{ + return 0; +} + +#endif diff --git a/libsimple-arg.c b/libsimple-arg.c index 7fcb91a..0fafdde 100644 --- a/libsimple-arg.c +++ b/libsimple-arg.c @@ -475,7 +475,8 @@ parser8(int argc, char *argv[]) {"--missing", 'm', 1}, {NULL, '\0', 0}, })); - /* fall through */ + usage(); + break; default: usage(); } ARGALT('+') { @@ -495,7 +496,8 @@ parser8(int argc, char *argv[]) {"++missing", 'm', 1}, {NULL, '\0', 0}, })); - /* fall through */ + usage(); + break; default: usage(); } ARGEND; diff --git a/libsimple-arg.h b/libsimple-arg.h index 1d52b33..6aa3c2a 100644 --- a/libsimple-arg.h +++ b/libsimple-arg.h @@ -8,11 +8,11 @@ #ifdef LIBSIMPLY_CONFIG_MULTICALL_BINARY /* Define by the application */ -# define _LIBSIMPLY_IF_MULTICALL_BINARY(...) __VA_ARGS__ -# define _LIBSIMPLY_UNLESS_MULTICALL_BINARY(...) +# define LIBSIMPLY_IF_MULTICALL_BINARY__(...) __VA_ARGS__ +# define LIBSIMPLY_UNLESS_MULTICALL_BINARY__(...) #else -# define _LIBSIMPLY_IF_MULTICALL_BINARY(...) -# define _LIBSIMPLY_UNLESS_MULTICALL_BINARY(...) __VA_ARGS__ +# define LIBSIMPLY_IF_MULTICALL_BINARY__(...) +# define LIBSIMPLY_UNLESS_MULTICALL_BINARY__(...) __VA_ARGS__ #endif @@ -48,10 +48,19 @@ struct longopt { */ char short_flag; +#if defined(__clang__) +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wpadded" +#endif + /** * Whether the option takes an argument */ int with_arg; + +#if defined(__clang__) +# pragma clang diagnostic pop +#endif }; @@ -410,11 +419,11 @@ struct longopt { /* Intended for internal use only */ #if __STDC_VERSION__ >= 201112L -# define _LIBSIMPLE_NORETURN _Noreturn +# define LIBSIMPLE_NORETURN__ _Noreturn #elif defined(__GNUC__) || defined(__clang__) -# define _LIBSIMPLE_NORETURN __attribute__((noreturn)) +# define LIBSIMPLE_NORETURN__ __attribute__((noreturn)) #else -# define _LIBSIMPLE_NORETURN +# define LIBSIMPLE_NORETURN__ #endif @@ -433,15 +442,15 @@ struct longopt { * @parma STATUS:int The exit value for the process */ #define NUSAGE(STATUS, SYNOPSIS)\ - static _LIBSIMPLE_NORETURN void\ + static LIBSIMPLE_NORETURN__ void\ usage(void)\ {\ const char *syn = (const char *)SYNOPSIS ? SYNOPSIS : "";\ fprintf(stderr, "usage: %s%s%s\n", argv0, *syn ? " " : "", syn);\ exit(STATUS);\ }\ - _LIBSIMPLY_UNLESS_MULTICALL_BINARY(char *argv0 = NULL)\ - _LIBSIMPLY_IF_MULTICALL_BINARY(int main(int, char *[])) + LIBSIMPLY_UNLESS_MULTICALL_BINARY__(char *argv0 = NULL)\ + LIBSIMPLY_IF_MULTICALL_BINARY__(int main(int, char *[])) #endif diff --git a/libsimple.c b/libsimple.c index 0140b84..3380e29 100644 --- a/libsimple.c +++ b/libsimple.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -223,20 +223,20 @@ main(void) assert(MAX3(-3, -1, -2) == -1); assert(MAX3(-3, -2, -1) == -1); -#define _1 0 -#define _2 0, 0 -#define _3 0, 0, 0 - assert(ELEMSOF((char []){_1}) == 1); - assert(ELEMSOF((char []){_2}) == 2); - assert(ELEMSOF((char []){_3}) == 3); - assert(ELEMSOF((short int []){_3}) == 3); - assert(ELEMSOF((int []){_3}) == 3); - assert(ELEMSOF((long int []){_3}) == 3); - assert(ELEMSOF((float []){_3}) == 3); - assert(ELEMSOF((double []){_3}) == 3); -#undef _1 -#undef _2 -#undef _3 +#define X1 0 +#define X2 0, 0 +#define X3 0, 0, 0 + assert(ELEMSOF((char []){X1}) == 1); + assert(ELEMSOF((char []){X2}) == 2); + assert(ELEMSOF((char []){X3}) == 3); + assert(ELEMSOF((short int []){X3}) == 3); + assert(ELEMSOF((int []){X3}) == 3); + assert(ELEMSOF((long int []){X3}) == 3); + assert(ELEMSOF((float []){X3}) == 3); + assert(ELEMSOF((double []){X3}) == 3); +#undef X1 +#undef X2 +#undef X3 assert(STRLEN("") == 0); assert(STRLEN("a") == 1); @@ -1700,229 +1700,276 @@ main(void) assert(!memcmp(buf, "hello world\0goodbye world", 26)); - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(buf, "hello world"); assert(libsimple_strmove(&buf[3], buf) == &buf[3]); assert(!strcmp(buf, "helhello world")); - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(buf, "hello world"); assert(libsimple_strmove(buf, &buf[3]) == buf); assert(!strcmp(buf, "lo world")); - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(buf, "hello world"); assert(libsimple_strmove(buf, buf) == buf); assert(!strcmp(buf, "hello world")); - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(buf, "hello world"); assert(libsimple_strnmove(&buf[3], buf, SIZE_MAX) == &buf[3]); assert(!strcmp(buf, "helhello world")); - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(buf, "hello world"); assert(libsimple_strnmove(buf, &buf[3], SIZE_MAX) == buf); assert(!strcmp(buf, "lo world")); - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(buf, "hello world"); assert(libsimple_strnmove(buf, buf, SIZE_MAX) == buf); assert(!strcmp(buf, "hello world")); - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(buf, "hello world"); assert(libsimple_strnmove(&buf[3], buf, 12) == &buf[3]); assert(!strcmp(buf, "helhello world")); - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(buf, "hello world"); assert(libsimple_strnmove(buf, &buf[3], 9) == buf); assert(!strcmp(buf, "lo world")); - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(buf, "hello world"); assert(libsimple_strnmove(buf, buf, 12) == buf); assert(!strcmp(buf, "hello world")); - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(buf, "hello world"); assert(libsimple_strnmove(&buf[3], buf, 11) == &buf[3]); assert(!strncmp(buf, "helhello worldx", 15)); - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(buf, "hello world"); assert(libsimple_strnmove(buf, &buf[3], 8) == buf); assert(!strcmp(buf, "lo worldrld")); - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(buf, "hello world"); assert(libsimple_strnmove(buf, buf, 11) == buf); assert(!strcmp(buf, "hello world")); - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(buf, "hello world"); assert(libsimple_strnmove(&buf[3], buf, 2) == &buf[3]); assert(!strcmp(buf, "helhe world")); - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(buf, "hello world"); assert(libsimple_strnmove(buf, &buf[3], 2) == buf); assert(!strcmp(buf, "lollo world")); - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(buf, "hello world"); assert(libsimple_strnmove(buf, buf, 2) == buf); assert(!strcmp(buf, "hello world")); - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(buf, "hello world"); assert(libsimple_stpmove(&buf[3], buf) == &buf[11 + 3]); assert(!strcmp(buf, "helhello world")); - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(buf, "hello world"); assert(libsimple_stpmove(buf, &buf[3]) == &buf[11 - 3]); assert(!strcmp(buf, "lo world")); - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(buf, "hello world"); assert(libsimple_stpmove(buf, buf) == &buf[11]); assert(!strcmp(buf, "hello world")); - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(buf, "hello world"); assert(libsimple_stpnmove(&buf[3], buf, SIZE_MAX) == &buf[11 + 3]); assert(!strcmp(buf, "helhello world")); - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(buf, "hello world"); assert(libsimple_stpnmove(buf, &buf[3], SIZE_MAX) == &buf[11 - 3]); assert(!strcmp(buf, "lo world")); - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(buf, "hello world"); assert(libsimple_stpnmove(buf, buf, SIZE_MAX) == &buf[11]); assert(!strcmp(buf, "hello world")); - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(buf, "hello world"); assert(libsimple_stpnmove(&buf[3], buf, 12) == &buf[11 + 3]); assert(!strcmp(buf, "helhello world")); - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(buf, "hello world"); assert(libsimple_stpnmove(buf, &buf[3], 9) == &buf[11 - 3]); assert(!strcmp(buf, "lo world")); - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(buf, "hello world"); assert(libsimple_stpnmove(buf, buf, 12) == &buf[11]); assert(!strcmp(buf, "hello world")); - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(buf, "hello world"); assert(libsimple_stpnmove(&buf[3], buf, 11) == &buf[11 + 3]); assert(!strncmp(buf, "helhello worldx", 15)); - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(buf, "hello world"); assert(libsimple_stpnmove(buf, &buf[3], 8) == &buf[8]); assert(!strcmp(buf, "lo worldrld")); - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(buf, "hello world"); assert(libsimple_stpnmove(buf, buf, 11) == &buf[11]); assert(!strcmp(buf, "hello world")); - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(buf, "hello world"); assert(libsimple_stpnmove(&buf[3], buf, 2) == &buf[3 + 2]); assert(!strcmp(buf, "helhe world")); - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(buf, "hello world"); assert(libsimple_stpnmove(buf, &buf[3], 2) == &buf[2]); assert(!strcmp(buf, "lollo world")); - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(buf, "hello world"); assert(libsimple_stpnmove(buf, buf, 2) == &buf[2]); assert(!strcmp(buf, "hello world")); - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; assert(libsimple_strccpy(buf, "hello", '\0') == &buf[6]); assert(!strcmp(buf, "hello")); - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; assert(libsimple_strccpy(buf, "hello", 'o') == &buf[5]); assert(!strcmp(buf, "hello")); - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; assert(libsimple_strccpy(buf, "hello", 'l') == &buf[3]); assert(!strcmp(buf, "hel")); - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; assert(libsimple_strccpy(buf, "hello", 'x') == NULL); assert(!strcmp(buf, "hello")); - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; assert(libsimple_strnccpy(buf, "hello", '\0', 1024) == &buf[6]); assert(!strcmp(buf, "hello")); - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; assert(libsimple_strnccpy(buf, "hello", 'o', 1024) == &buf[5]); assert(!strcmp(buf, "hello")); - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; assert(libsimple_strnccpy(buf, "hello", 'l', 1024) == &buf[3]); assert(!strcmp(buf, "hel")); - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; assert(libsimple_strnccpy(buf, "hello", 'x', 1024) == NULL); assert(!strcmp(buf, "hello")); - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; assert(libsimple_strnccpy(buf, "hello", '\0', 6) == &buf[6]); assert(!strcmp(buf, "hello")); - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; assert(libsimple_strnccpy(buf, "hello", 'o', 6) == &buf[5]); assert(!strcmp(buf, "hello")); - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; assert(libsimple_strnccpy(buf, "hello", 'l', 6) == &buf[3]); assert(!strcmp(buf, "hel")); - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; assert(libsimple_strnccpy(buf, "hello", 'x', 6) == NULL); assert(!strcmp(buf, "hello")); - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; assert(libsimple_strnccpy(buf, "hello", '\0', 5) == NULL); assert(!strncmp(buf, "hellox", 6)); - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; assert(libsimple_strnccpy(buf, "hello", 'o', 5) == &buf[5]); assert(!strncmp(buf, "hellox", 6)); - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; assert(libsimple_strnccpy(buf, "hello", 'l', 5) == &buf[3]); assert(!strcmp(buf, "hel")); - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; assert(libsimple_strnccpy(buf, "hello", 'x', 5) == NULL); assert(!strncmp(buf, "hellox", 6)); - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; assert(libsimple_strnccpy(buf, "hello", 'o', 3) == NULL); assert(!strncmp(buf, "helx", 4)); diff --git a/libsimple.h b/libsimple.h index 8af98e8..b9e263c 100644 --- a/libsimple.h +++ b/libsimple.h @@ -3,6 +3,14 @@ #define LIBSIMPLE_H +#if defined(__clang__) +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wdocumentation" +# pragma clang diagnostic ignored "-Wdocumentation-unknown-command" +# pragma clang diagnostic ignored "-Wreserved-identifier" +# pragma clang diagnostic ignored "-Wdisabled-macro-expansion" +#endif + #include <arpa/inet.h> #include <netinet/in.h> #include <netinet/tcp.h> @@ -50,6 +58,13 @@ #if defined(__GNUC__) && !defined(__clang__) +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Winline" +#endif + + + +#if defined(__GNUC__) && !defined(__clang__) # define LIBSIMPLE_GCC_ONLY__(x) x # define LIBSIMPLE_NON_GCC_ONLY__(x) #else @@ -57,6 +72,12 @@ # define LIBSIMPLE_NON_GCC_ONLY__(x) x #endif +#if defined(__GNUC__) +# define LIBSIMPLE_EXTENSION__ __extension__ +#else +# define LIBSIMPLE_EXTENSION__ +#endif + #if __STDC_VERSION__ >= 199409L # define LIBSIMPLE_C95_ONLY__(x) x # define LIBSIMPLE_PRE_C95_ONLY__(x) @@ -218,13 +239,11 @@ libsimple_unlist(void *list__, size_t i__, size_t *np__, size_t width__) #define LIBSIMPLE_ASSUME_ALIGNED__(PTR, ALIGNMENT, ...)\ - LIBSIMPLE_GCC_ONLY__(__builtin_assume_aligned(PTR, ALIGNMENT)) -#if defined(__GNUC__) && !defined(__clang__) -# define LIBSIMPLE_ASSUME_ALIGNED(PTR, ...) /* returns PTR */ /* TODO test, doc, man */\ - LIBSIMPLE_GCC_ONLY__(__builtin_assume_aligned(PTR, ##__VA_ARGS__,\ - LIBSIMPLE_C11_ONLY__(_Alignof(PTR))\ - _LIBSIMPLE_PREC11_ONLY(__alignof(PTR)))) -#endif + LIBSIMPLE_GCC_ONLY__(__builtin_assume_aligned(PTR, ALIGNMENT))\ + LIBSIMPLE_NON_GCC_ONLY__(PTR) +#define LIBSIMPLE_ASSUME_ALIGNED(PTR, ...) /* returns PTR */ /* TODO test, doc, man */\ + LIBSIMPLE_ASSUME_ALIGNED__(PTR, ##__VA_ARGS__, LIBSIMPLE_C11_ONLY__(_Alignof(*PTR)) /* no , */\ + LIBSIMPLE_PRE_C11_ONLY__(__alignof(*PTR))) #ifndef ASSUME_ALIGNED # define ASSUME_ALIGNED(...) LIBSIMPLE_ASSUME_ALIGNED(__VA_ARGS__) #endif @@ -250,4 +269,13 @@ libsimple_unlist(void *list__, size_t i__, size_t *np__, size_t width__) +#if defined(__GNUC__) && !defined(__clang__) +# pragma GCC diagnostic pop +#endif + +#if defined(__clang__) +# pragma clang diagnostic pop +#endif + + #endif diff --git a/libsimple/aligned_memdup.h b/libsimple/aligned_memdup.h index d612be0..6cb9415 100644 --- a/libsimple/aligned_memdup.h +++ b/libsimple/aligned_memdup.h @@ -11,21 +11,21 @@ */ #if defined(__GNUC__) || defined(__clang__) # define libsimple_aligned_memdupa(s, alignment, n)\ - LIBSIMPLE_GCC_ONLY__(__extension__)\ + LIBSIMPLE_EXTENSION__\ ({\ - const char *__s = (s);\ - size_t __n = (n);\ - size_t __a = (alignment);\ - size_t __size;\ - uintptr_t __misalignment;\ - char *__r;\ - __a += !__a;\ - __size = __n + (__a - 1);\ - __r = alloca(__size + !__size);\ - __misalignment = (uintptr_t)__r % (uintptr_t)__a;\ - if (__misalignment)\ - __r += (uintptr_t)__a - __misalignment;\ - memcpy(__r, __s, __n);\ + const char *s__ = (s);\ + size_t n__ = (n);\ + size_t a__ = (alignment);\ + size_t size__;\ + uintptr_t misalignment__;\ + char *r__;\ + a__ += !a__;\ + size__ = n__ + (a__ - 1);\ + r__ = alloca(size__ + !size__);\ + misalignment__ = (uintptr_t)r__ % (uintptr_t)a__;\ + if (misalignment__)\ + r__ += (uintptr_t)a__ - misalignment__;\ + memcpy(r__, s__, n__);\ }) # ifndef aligned_memdupa # define aligned_memdupa(s, alignment, n) libsimple_aligned_memdupa(s, alignment, n) diff --git a/libsimple/aligned_strdup.h b/libsimple/aligned_strdup.h index c7b713e..2488f96 100644 --- a/libsimple/aligned_strdup.h +++ b/libsimple/aligned_strdup.h @@ -10,7 +10,7 @@ */ #if defined(__GNUC__) || defined(__clang__) # define libsimple_aligned_strdupa(s, alignment)\ - LIBSIMPLE_GCC_ONLY__(__extension__)\ + LIBSIMPLE_EXTENSION__\ ({\ const char *s__ = (s);\ size_t n__ = strlen(s__) + 1;\ diff --git a/libsimple/aligned_strndup.h b/libsimple/aligned_strndup.h index 201afef..84f2218 100644 --- a/libsimple/aligned_strndup.h +++ b/libsimple/aligned_strndup.h @@ -11,7 +11,7 @@ */ #if defined(__GNUC__) || defined(__clang__) # define libsimple_aligned_strndupa(s, alignment, n)\ - LIBSIMPLE_GCC_ONLY__(__extension__)\ + LIBSIMPLE_EXTENSION__\ ({\ const char *s__ = (s);\ size_t n__ = strnlen(s__, n);\ diff --git a/libsimple/aligned_wcsdup.h b/libsimple/aligned_wcsdup.h index c9fc0cf..3b33338 100644 --- a/libsimple/aligned_wcsdup.h +++ b/libsimple/aligned_wcsdup.h @@ -10,7 +10,7 @@ */ #if defined(__GNUC__) || defined(__clang__) # define libsimple_aligned_wcsdupa(s, alignment)\ - LIBSIMPLE_GCC_ONLY__(__extension__)\ + LIBSIMPLE_EXTENSION__\ ({\ const wchar_t *s__ = (s);\ size_t n__ = wcslen(s__) + 1;\ diff --git a/libsimple/aligned_wcsndup.h b/libsimple/aligned_wcsndup.h index cd06ff8..a5d2641 100644 --- a/libsimple/aligned_wcsndup.h +++ b/libsimple/aligned_wcsndup.h @@ -11,7 +11,7 @@ */ #if defined(__GNUC__) || defined(__clang__) # define libsimple_aligned_wcsndupa(s, alignment, n)\ - LIBSIMPLE_GCC_ONLY__(__extension__)\ + LIBSIMPLE_EXTENSION__\ ({\ const wchar_t *s__ = (s);\ size_t n__ = wcsnlen(s__, n);\ diff --git a/libsimple/aligned_wmemdup.h b/libsimple/aligned_wmemdup.h index 56148d8..51f00a9 100644 --- a/libsimple/aligned_wmemdup.h +++ b/libsimple/aligned_wmemdup.h @@ -11,7 +11,7 @@ */ #if defined(__GNUC__) || defined(__clang__) # define libsimple_aligned_wmemdupa(s, alignment, n)\ - LIBSIMPLE_GCC_ONLY__(__extension__)\ + LIBSIMPLE_EXTENSION__\ ({\ const wchar_t *s__ = (s);\ size_t n__ = (n);\ diff --git a/libsimple/memdup.h b/libsimple/memdup.h index f799eee..528782f 100644 --- a/libsimple/memdup.h +++ b/libsimple/memdup.h @@ -10,7 +10,7 @@ */ #if defined(__GNUC__) || defined(__clang__) # define libsimple_memdupa(s, n)\ - LIBSIMPLE_GCC_ONLY__(__extension__)\ + LIBSIMPLE_EXTENSION__\ ({\ const char *s__ = (s);\ size_t n__ = (n);\ diff --git a/libsimple/printf.h b/libsimple/printf.h index 95f6935..3b426ec 100644 --- a/libsimple/printf.h +++ b/libsimple/printf.h @@ -96,7 +96,7 @@ int libsimple_vasprintf(char **, const char *, va_list); */ #if defined(__GNUC__) || defined(__clang__) # define libsimple_asprintfa(fmt__, ...)\ - LIBSIMPLE_GCC_ONLY__(__extension__)\ + LIBSIMPLE_EXTENSION__\ ({\ const char *f__ = (fmt__);\ char *ret__ = NULL;\ @@ -128,7 +128,7 @@ int libsimple_vasprintf(char **, const char *, va_list); */ #if defined(__GNUC__) || defined(__clang__) # define libsimple_vasprintfa(fmt__, ap__)\ - LIBSIMPLE_GCC_ONLY__(__extension__)\ + LIBSIMPLE_EXTENSION__\ ({\ const char *f__ = (fmt__);\ va_list a1__;\ diff --git a/libsimple/str.h b/libsimple/str.h index d01086e..b0345bd 100644 --- a/libsimple/str.h +++ b/libsimple/str.h @@ -164,7 +164,7 @@ char *libsimple_strrcasechr_inv(const char *, int); * @return `s` with an offset such `!*r`, where `r` is the returned pointer */ LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __nonnull__, __warn_unused_result__))) -static inline char * +inline char * libsimple_strend(const char *s__) { return strchr(s__, '\0'); @@ -196,7 +196,7 @@ int libsimple_strstarts(const char *, const char *); * @return 1 if `s` starts with `t`, 0 otherwise */ LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __nonnull__, __warn_unused_result__))) -static inline int +inline int libsimple_strcasestarts(const char *s__, const char *t__) { return !strncasecmp(s__, t__, strlen(t__)); @@ -293,7 +293,7 @@ char *libsimple_strrcasestr(const char *, const char *); * 0 otherwise */ LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __warn_unused_result__))) -static inline int +inline int libsimple_strcmpnul(const char *a__, const char *b__) { return (!a__ || !b__) ? !b__ - !a__ : strcmp(a__, b__); @@ -314,7 +314,7 @@ libsimple_strcmpnul(const char *a__, const char *b__) * 0 otherwise */ LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __warn_unused_result__))) -static inline int +inline int libsimple_strcasecmpnul(const char *a__, const char *b__) { return (!a__ || !b__) ? !b__ - !a__ : strcasecmp(a__, b__); @@ -333,7 +333,7 @@ libsimple_strcasecmpnul(const char *a__, const char *b__) * @return 1 if the strings are equal, 0 otherwise */ LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __nonnull__, __warn_unused_result__))) -static inline int +inline int libsimple_streq(const char *a__, const char *b__) { return !strcmp(a__, b__); @@ -352,7 +352,7 @@ libsimple_streq(const char *a__, const char *b__) * @return 1 if the strings are equal, 0 otherwise */ LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __warn_unused_result__))) -static inline int +inline int libsimple_streqnul(const char *a__, const char *b__) { return !libsimple_strcmpnul(a__, b__); @@ -371,7 +371,7 @@ libsimple_streqnul(const char *a__, const char *b__) * @return 1 if the strings are equal, 0 otherwise */ LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __nonnull__, __warn_unused_result__))) -static inline int +inline int libsimple_strcaseeq(const char *a__, const char *b__) { return !strcasecmp(a__, b__); @@ -390,7 +390,7 @@ libsimple_strcaseeq(const char *a__, const char *b__) * @return 1 if the strings are equal, 0 otherwise */ LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __warn_unused_result__))) -static inline int +inline int libsimple_strcaseeqnul(const char *a__, const char *b__) { return !libsimple_strcasecmpnul(a__, b__); @@ -439,7 +439,7 @@ size_t libsimple_strcaseeqlen(const char *, const char *); * in common in their ends */ LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __nonnull__, __warn_unused_result__))) -static inline size_t +inline size_t libsimple_strreqlen(const char *a__, const char *b__) { return libsimple_memreqlen(a__, strlen(a__), b__, strlen(b__)); @@ -458,7 +458,7 @@ libsimple_strreqlen(const char *a__, const char *b__) * in common in their ends */ LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __nonnull__, __warn_unused_result__))) -static inline size_t +inline size_t libsimple_strrcaseeqlen(const char *a__, const char *b__) { return libsimple_memrcaseeqlen(a__, strlen(a__), b__, strlen(b__)); @@ -477,7 +477,7 @@ libsimple_strrcaseeqlen(const char *a__, const char *b__) * 0 otherwise */ LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __nonnull__, __warn_unused_result__))) -static inline int +inline int libsimple_inchrset(int c__, const char *s__) { return c__ && strchr(s__, c__); @@ -496,7 +496,7 @@ libsimple_inchrset(int c__, const char *s__) * 0 otherwise */ LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __nonnull__, __warn_unused_result__))) -static inline int +inline int libsimple_inchrcaseset(int c__, const char *s__) { return c__ && strcasechr(s__, c__); @@ -515,7 +515,7 @@ libsimple_inchrcaseset(int c__, const char *s__) * @return `d` */ LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__))) -static inline char * +inline char * libsimple_strmove(char *d__, const char *s__) { return memmove(d__, s__, strlen(s__) + 1); @@ -534,7 +534,7 @@ libsimple_strmove(char *d__, const char *s__) * @return `&d[strlen(s)]` (this byte will be a NUL byte) */ LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__))) -static inline char * +inline char * libsimple_stpmove(char *d__, const char *s__) { size_t n__ = strlen(s__); @@ -554,7 +554,7 @@ libsimple_stpmove(char *d__, const char *s__) * @return `s` */ LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__))) -static inline char * +inline char * libsimple_strset(char *s__, int c___) { char c__ = (char)c___, *r__ = s__; @@ -574,7 +574,7 @@ libsimple_strset(char *s__, int c___) * @return `&s[strlen(s)]` */ LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__))) -static inline char * +inline char * libsimple_stpset(char *s__, int c___) { char c__ = (char)c___; @@ -597,7 +597,7 @@ libsimple_stpset(char *s__, int c___) * found in `s`, `NULL` otherwise */ LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__))) -static inline char * +inline char * libsimple_strccpy(char *restrict d__, const char *restrict s__, int c___) { char c__ = (char)c___; @@ -640,7 +640,7 @@ char *libsimple_strcmove(char *, const char *, int); * @return `strchr(s, '\0')` */ LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__, __returns_nonnull__))) -static inline char * +inline char * libsimple_strreplace(char *s__, int old___, int new___) { char old__ = (char)old___, new__ = (char)new___; @@ -705,7 +705,7 @@ char *libsimple_stptoupper(char *, const char *); * @return `d` */ LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__, __returns_nonnull__))) -static inline char * +inline char * libsimple_strtolower(char *d__, const char *s__) { libsimple_stptolower(d__, s__); @@ -729,7 +729,7 @@ libsimple_strtolower(char *d__, const char *s__) * @return `d` */ LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__, __returns_nonnull__))) -static inline char * +inline char * libsimple_strtoupper(char *d__, const char *s__) { libsimple_stptoupper(d__, s__); @@ -749,7 +749,7 @@ libsimple_strtoupper(char *d__, const char *s__) * @return 1 if good, 0 on encoding error */ LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __nonnull__, __warn_unused_result__))) -static inline int +inline int libsimple_strisutf8(const char *string__, int allow_modified_nul__) { return libsimple_memisutf8(string__, strlen(string__), allow_modified_nul__); diff --git a/libsimple/strdup.h b/libsimple/strdup.h index cc3b67a..cf48119 100644 --- a/libsimple/strdup.h +++ b/libsimple/strdup.h @@ -9,7 +9,7 @@ */ #if defined(__GNUC__) || defined(__clang__) # define libsimple_strdupa(s)\ - LIBSIMPLE_GCC_ONLY__(__extension__)\ + LIBSIMPLE_EXTENSION__\ ({\ const char *s__ = (s);\ size_t n__ = strlen(s__) + 1;\ diff --git a/libsimple/strndup.h b/libsimple/strndup.h index ccf3842..70c3db5 100644 --- a/libsimple/strndup.h +++ b/libsimple/strndup.h @@ -10,7 +10,7 @@ */ #if defined(__GNUC__) || defined(__clang__) # define libsimple_strndupa(s, n)\ - LIBSIMPLE_GCC_ONLY__(__extension__)\ + LIBSIMPLE_EXTENSION__\ ({\ const char *s__ = (s);\ size_t n__ = strnlen(s__, n);\ diff --git a/libsimple/wcsdup.h b/libsimple/wcsdup.h index 9b15103..0573d64 100644 --- a/libsimple/wcsdup.h +++ b/libsimple/wcsdup.h @@ -9,7 +9,7 @@ */ #if defined(__GNUC__) || defined(__clang__) # define libsimple_wcsdupa(s)\ - LIBSIMPLE_GCC_ONLY__(__extension__)\ + LIBSIMPLE_EXTENSION__\ ({\ const wchar_t *s__ = (s);\ size_t n__ = wcslen(s__) + 1;\ diff --git a/libsimple/wcsndup.h b/libsimple/wcsndup.h index 0d36a25..d9ffaa5 100644 --- a/libsimple/wcsndup.h +++ b/libsimple/wcsndup.h @@ -10,7 +10,7 @@ */ #if defined(__GNUC__) || defined(__clang__) # define libsimple_wcsndupa(s, n)\ - LIBSIMPLE_GCC_ONLY__(__extension__)\ + LIBSIMPLE_EXTENSION__\ ({\ const wchar_t *s__ = (s);\ size_t n__ = wcsnlen(s__, n);\ diff --git a/libsimple/wmemdup.h b/libsimple/wmemdup.h index 467aa61..898acdd 100644 --- a/libsimple/wmemdup.h +++ b/libsimple/wmemdup.h @@ -10,7 +10,7 @@ */ #if defined(__GNUC__) || defined(__clang__) # define libsimple_wmemdupa(s, n)\ - LIBSIMPLE_GCC_ONLY__(__extension__)\ + LIBSIMPLE_EXTENSION__\ ({\ const wchar_t *s__ = (s);\ size_t n__ = (n);\ diff --git a/localtime.c b/localtime.c index 0b075a0..96bd1e1 100644 --- a/localtime.c +++ b/localtime.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #include <sys/timex.h> #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/memalignn.c b/memalignn.c index 14d1051..526ae3b 100644 --- a/memalignn.c +++ b/memalignn.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/memalignz.c b/memalignz.c index 979f640..1802dbf 100644 --- a/memalignz.c +++ b/memalignz.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/memalignzn.c b/memalignzn.c index 42f3448..7b842aa 100644 --- a/memalignzn.c +++ b/memalignzn.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/memcasechr.c b/memcasechr.c index 4277849..9abdd2b 100644 --- a/memcasechr.c +++ b/memcasechr.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/memcasechr_inv.c b/memcasechr_inv.c index 6b89e66..0eb1cd3 100644 --- a/memcasechr_inv.c +++ b/memcasechr_inv.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/memcasecmp.c b/memcasecmp.c index efc9b47..357aedb 100644 --- a/memcasecmp.c +++ b/memcasecmp.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/memcaseends.c b/memcaseends.c index 8c938c4..09c12f7 100644 --- a/memcaseends.c +++ b/memcaseends.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/memcaseeq.c b/memcaseeq.c index bbcf1b0..3c814f0 100644 --- a/memcaseeq.c +++ b/memcaseeq.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/memcaseeqlen.c b/memcaseeqlen.c index 79ab198..067eb96 100644 --- a/memcaseeqlen.c +++ b/memcaseeqlen.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/memcasemem.c b/memcasemem.c index e118da8..b3ea476 100644 --- a/memcasemem.c +++ b/memcasemem.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/memcasescan.c b/memcasescan.c index a5b22b3..6c59089 100644 --- a/memcasescan.c +++ b/memcasescan.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/memcasescan_inv.c b/memcasescan_inv.c index 28d7848..91f91e9 100644 --- a/memcasescan_inv.c +++ b/memcasescan_inv.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/memcasestarts.c b/memcasestarts.c index f9c30ee..4196e64 100644 --- a/memcasestarts.c +++ b/memcasestarts.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/memchr_inv.c b/memchr_inv.c index 2eed2e0..2bca9cd 100644 --- a/memchr_inv.c +++ b/memchr_inv.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -38,49 +38,58 @@ main(void) { char buf[1024]; - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], "hello")[0] = '-'; assert(libsimple_memcmove(&buf[5], &buf[5], 'o', 5) == &buf[5 + 5]); assert(!strncmp(buf, "-----hello-", 11)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], "hello")[0] = '-'; assert(libsimple_memcmove(&buf[5], &buf[5], 'l', 5) == &buf[5 + 3]); assert(!strncmp(buf, "-----hello-", 11)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], "hello")[0] = '-'; assert(libsimple_memcmove(&buf[5], &buf[5], 'x', 5) == NULL); assert(!strncmp(buf, "-----hello-", 11)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], "hello")[0] = '-'; assert(libsimple_memcmove(&buf[3], &buf[5], 'o', 5) == &buf[3 + 5]); assert(!strncmp(buf, "---hellolo-", 11)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], "hello")[0] = '-'; assert(libsimple_memcmove(&buf[3], &buf[5], 'l', 5) == &buf[3 + 3]); assert(!strncmp(buf, "---helello-", 11)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], "hello")[0] = '-'; assert(libsimple_memcmove(&buf[3], &buf[5], 'x', 5) == NULL); assert(!strncmp(buf, "---hellolo-", 11)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], "hello")[0] = '-'; assert(libsimple_memcmove(&buf[8], &buf[5], 'o', 5) == &buf[8 + 5]); assert(!strncmp(buf, "-----helhello-", 14)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], "hello")[0] = '-'; assert(libsimple_memcmove(&buf[8], &buf[5], 'l', 5) == &buf[8 + 3]); assert(!strncmp(buf, "-----helhel-", 12)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], "hello")[0] = '-'; assert(libsimple_memcmove(&buf[8], &buf[5], 'x', 5) == NULL); assert(!strncmp(buf, "-----helhello-", 14)); @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/memelem_inv.c b/memelem_inv.c index 7e87d4c..5ec93d5 100644 --- a/memelem_inv.c +++ b/memelem_inv.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/memelemcpy.c b/memelemcpy.c index 3fafa65..19c937c 100644 --- a/memelemcpy.c +++ b/memelemcpy.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -91,96 +91,118 @@ main(void) char buf[1024]; - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; assert(libsimple_memelemcpy(buf, "hello", "o", 0, 5) == &buf[0]); assert(!strncmp(buf, "x", 1)); - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; assert(libsimple_memelemcpy(buf, "hello", "l", 0, 5) == &buf[0]); assert(!strncmp(buf, "x", 1)); - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; assert(libsimple_memelemcpy(buf, "hello", "x", 0, 5) == &buf[0]); assert(!strncmp(buf, "x", 1)); - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; assert(libsimple_memelemcpy(buf, "hello", "o", 1, 5) == &buf[5]); assert(!strncmp(buf, "hellox", 6)); - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; assert(libsimple_memelemcpy(buf, "hello", "l", 1, 5) == &buf[3]); assert(!strncmp(buf, "helx", 4)); - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; assert(libsimple_memelemcpy(buf, "hello", "x", 1, 5) == NULL); assert(!strncmp(buf, "hellox", 6)); - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; assert(libsimple_memelemcpy(buf, ".h.e.l.l.o", ".o", 2, 5) == &buf[5 * 2]); assert(!strncmp(buf, ".h.e.l.l.ox", 11)); - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; assert(libsimple_memelemcpy(buf, ".h.e.l.l.o", ".l", 2, 5) == &buf[3 * 2]); assert(!strncmp(buf, ".h.e.lx", 7)); - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; assert(libsimple_memelemcpy(buf, ".h.e.l.l.o", ".x", 2, 5) == NULL); assert(!strncmp(buf, ".h.e.l.l.ox", 11)); - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; assert(libsimple_memelemcpy(buf, ".h.l.ll..o", "l.", 2, 5) == &buf[4 * 2]); assert(!strncmp(buf, ".h.l.ll.x", 9)); - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; assert(libsimple_memelemcpy(buf, "..h..e..l..l..o", "..o", 3, 5) == &buf[5 * 3]); assert(!strncmp(buf, "..h..e..l..l..ox", 16)); - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; assert(libsimple_memelemcpy(buf, "..h..e..l..l..o", "..l", 3, 5) == &buf[3 * 3]); assert(!strncmp(buf, "..h..e..lx", 10)); - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; assert(libsimple_memelemcpy(buf, "..h..e..l..l..o", "..x", 3, 5) == NULL); assert(!strncmp(buf, "..h..e..l..l..ox", 16)); - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; assert(libsimple_memelemcpy(buf, "..h..l..ll....o", "l..", 3, 5) == &buf[4 * 3]); assert(!strncmp(buf, "..h..l..ll..x", 13)); - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; assert(libsimple_memelemcpy(buf, "...h...e...l...l...o", "...o", 4, 5) == &buf[5 * 4]); assert(!strncmp(buf, "...h...e...l...l...ox", 21)); - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; assert(libsimple_memelemcpy(buf, "...h...e...l...l...o", "...l", 4, 5) == &buf[3 * 4]); assert(!strncmp(buf, "...h...e...lx", 13)); - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; assert(libsimple_memelemcpy(buf, "...h...e...l...l...o", "...x", 4, 5) == NULL); assert(!strncmp(buf, "...h...e...l...l...ox", 21)); - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; assert(libsimple_memelemcpy(buf, "...h...l...ll......o", "l...", 4, 5) == &buf[4 * 4]); assert(!strncmp(buf, "...h...l...ll...x", 17)); - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; assert(libsimple_memelemcpy(buf, ".......h.......e.......l.......l.......o", ".......o", 8, 5) == &buf[5 * 8]); assert(!strncmp(buf, ".......h.......e.......l.......l.......ox", 21)); - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; assert(libsimple_memelemcpy(buf, ".......h.......e.......l.......l.......o", ".......l", 8, 5) == &buf[3 * 8]); assert(!strncmp(buf, ".......h.......e.......lx", 13)); - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; assert(libsimple_memelemcpy(buf, ".......h.......e.......l.......l.......o", ".......x", 8, 5) == NULL); assert(!strncmp(buf, ".......h.......e.......l.......l.......ox", 21)); - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; assert(libsimple_memelemcpy(buf, ".......h.......l.......ll..............o", "l.......", 8, 5) == &buf[4 * 8]); assert(!strncmp(buf, ".......h.......l.......ll.......x", 21)); diff --git a/memelemmove.c b/memelemmove.c index d790a87..22908ca 100644 --- a/memelemmove.c +++ b/memelemmove.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -123,300 +123,360 @@ main(void) char buf[1024]; - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], "hello")[0] = '-'; assert(libsimple_memelemmove(&buf[5], &buf[5], "", 0, 5) == &buf[5]); assert(!strncmp(buf, "-----hello-", 11)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], "hello")[0] = '-'; assert(libsimple_memelemmove(&buf[3], &buf[5], "", 0, 5) == &buf[3]); assert(!strncmp(buf, "-----hello-", 11)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], "hello")[0] = '-'; assert(libsimple_memelemmove(&buf[5], &buf[3], "", 0, 5) == &buf[5]); assert(!strncmp(buf, "-----hello-", 11)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], "hello")[0] = '-'; assert(libsimple_memelemmove(&buf[5], &buf[5], "o", 1, 5) == &buf[5 + 5]); assert(!strncmp(buf, "-----hello-", 11)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], "hello")[0] = '-'; assert(libsimple_memelemmove(&buf[5], &buf[5], "l", 1, 5) == &buf[5 + 3]); assert(!strncmp(buf, "-----hello-", 11)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], "hello")[0] = '-'; assert(libsimple_memelemmove(&buf[5], &buf[5], "x", 1, 5) == NULL); assert(!strncmp(buf, "-----hello-", 11)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], "hello")[0] = '-'; assert(libsimple_memelemmove(&buf[3], &buf[5], "o", 1, 5) == &buf[3 + 5]); assert(!strncmp(buf, "---hellolo-", 11)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], "hello")[0] = '-'; assert(libsimple_memelemmove(&buf[3], &buf[5], "l", 1, 5) == &buf[3 + 3]); assert(!strncmp(buf, "---helello-", 11)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], "hello")[0] = '-'; assert(libsimple_memelemmove(&buf[3], &buf[5], "x", 1, 5) == NULL); assert(!strncmp(buf, "---hellolo-", 11)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], "hello")[0] = '-'; assert(libsimple_memelemmove(&buf[8], &buf[5], "o", 1, 5) == &buf[8 + 5]); assert(!strncmp(buf, "-----helhello-", 14)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], "hello")[0] = '-'; assert(libsimple_memelemmove(&buf[8], &buf[5], "l", 1, 5) == &buf[8 + 3]); assert(!strncmp(buf, "-----helhel-", 12)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], "hello")[0] = '-'; assert(libsimple_memelemmove(&buf[8], &buf[5], "x", 1, 5) == NULL); assert(!strncmp(buf, "-----helhello-", 14)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], ".h.e.l.l.o")[0] = '-'; assert(libsimple_memelemmove(&buf[5], &buf[5], ".o", 2, 5) == &buf[5 + 5 * 2]); assert(!strncmp(buf, "-----.h.e.l.l.o-", 16)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], ".h.e.l.l.o")[0] = '-'; assert(libsimple_memelemmove(&buf[5], &buf[5], ".l", 2, 5) == &buf[5 + 3 * 2]); assert(!strncmp(buf, "-----.h.e.l.l.o-", 16)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], ".h.e.l.l.o")[0] = '-'; assert(libsimple_memelemmove(&buf[5], &buf[5], ".x", 2, 5) == NULL); assert(!strncmp(buf, "-----.h.e.l.l.o-", 16)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], ".h.e.l.l.o")[0] = '-'; assert(libsimple_memelemmove(&buf[3], &buf[5], ".o", 2, 5) == &buf[3 + 5 * 2]); assert(!strncmp(buf, "---.h.e.l.l.o.o-", 16)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], ".h.e.l.l.o")[0] = '-'; assert(libsimple_memelemmove(&buf[3], &buf[5], ".l", 2, 5) == &buf[3 + 3 * 2]); assert(!strncmp(buf, "---.h.e.l.l.l.o-", 16)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], ".h.e.l.l.o")[0] = '-'; assert(libsimple_memelemmove(&buf[3], &buf[5], ".x", 2, 5) == NULL); assert(!strncmp(buf, "---.h.e.l.l.o.o-", 16)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], ".h.e.l.l.o")[0] = '-'; assert(libsimple_memelemmove(&buf[8], &buf[5], ".o", 2, 5) == &buf[8 + 5 * 2]); assert(!strncmp(buf, "-----.h..h.e.l.l.o-", 19)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], ".h.e.l.l.o")[0] = '-'; assert(libsimple_memelemmove(&buf[8], &buf[5], ".l", 2, 5) == &buf[8 + 3 * 2]); assert(!strncmp(buf, "-----.h..h.e.lo-", 16)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], ".h.e.l.l.o")[0] = '-'; assert(libsimple_memelemmove(&buf[8], &buf[5], ".x", 2, 5) == NULL); assert(!strncmp(buf, "-----.h..h.e.l.l.o-", 19)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], "..h..e..l..l..o")[0] = '-'; assert(libsimple_memelemmove(&buf[5], &buf[5], "..o", 3, 5) == &buf[5 + 5 * 3]); assert(!strncmp(buf, "-----..h..e..l..l..o-", 21)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], "..h..e..l..l..o")[0] = '-'; assert(libsimple_memelemmove(&buf[5], &buf[5], "..l", 3, 5) == &buf[5 + 3 * 3]); assert(!strncmp(buf, "-----..h..e..l..l..o-", 21)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], "..h..e..l..l..o")[0] = '-'; assert(libsimple_memelemmove(&buf[5], &buf[5], "..x", 3, 5) == NULL); assert(!strncmp(buf, "-----..h..e..l..l..o-", 21)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], "..h..e..l..l..o")[0] = '-'; assert(libsimple_memelemmove(&buf[3], &buf[5], "..o", 3, 5) == &buf[3 + 5 * 3]); assert(!strncmp(buf, "---..h..e..l..l..o.o-", 21)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], "..h..e..l..l..o")[0] = '-'; assert(libsimple_memelemmove(&buf[3], &buf[5], "..l", 3, 5) == &buf[3 + 3 * 3]); assert(!strncmp(buf, "---..h..e..l.l..l..o-", 21)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], "..h..e..l..l..o")[0] = '-'; assert(libsimple_memelemmove(&buf[3], &buf[5], "..x", 3, 5) == NULL); assert(!strncmp(buf, "---..h..e..l..l..o.o-", 21)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], "..h..e..l..l..o")[0] = '-'; assert(libsimple_memelemmove(&buf[8], &buf[5], "..o", 3, 5) == &buf[8 + 5 * 3]); assert(!strncmp(buf, "-----..h..h..e..l..l..o-", 24)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], "..h..e..l..l..o")[0] = '-'; assert(libsimple_memelemmove(&buf[8], &buf[5], "..l", 3, 5) == &buf[8 + 3 * 3]); assert(!strncmp(buf, "-----..h..h..e..l..o-", 21)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], "..h..e..l..l..o")[0] = '-'; assert(libsimple_memelemmove(&buf[8], &buf[5], "..x", 3, 5) == NULL); assert(!strncmp(buf, "-----..h..h..e..l..l..o-", 24)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], "...h...e...l...l...o")[0] = '-'; assert(libsimple_memelemmove(&buf[5], &buf[5], "...o", 4, 5) == &buf[5 + 5 * 4]); assert(!strncmp(buf, "-----...h...e...l...l...o-", 26)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], "...h...e...l...l...o")[0] = '-'; assert(libsimple_memelemmove(&buf[5], &buf[5], "...l", 4, 5) == &buf[5 + 3 * 4]); assert(!strncmp(buf, "-----...h...e...l...l...o-", 26)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], "...h...e...l...l...o")[0] = '-'; assert(libsimple_memelemmove(&buf[5], &buf[5], "...x", 4, 5) == NULL); assert(!strncmp(buf, "-----...h...e...l...l...o-", 26)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], "...h...e...l...l...o")[0] = '-'; assert(libsimple_memelemmove(&buf[3], &buf[5], "...o", 4, 5) == &buf[3 + 5 * 4]); assert(!strncmp(buf, "---...h...e...l...l...o.o-", 26)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], "...h...e...l...l...o")[0] = '-'; assert(libsimple_memelemmove(&buf[3], &buf[5], "...l", 4, 5) == &buf[3 + 3 * 4]); assert(!strncmp(buf, "---...h...e...l.l...l...o-", 26)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], "...h...e...l...l...o")[0] = '-'; assert(libsimple_memelemmove(&buf[3], &buf[5], "...x", 4, 5) == NULL); assert(!strncmp(buf, "---...h...e...l...l...o.o-", 26)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], "...h...e...l...l...o")[0] = '-'; assert(libsimple_memelemmove(&buf[8], &buf[5], "...o", 4, 5) == &buf[8 + 5 * 4]); assert(!strncmp(buf, "-----......h...e...l...l...o-", 29)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], "...h...e...l...l...o")[0] = '-'; assert(libsimple_memelemmove(&buf[8], &buf[5], "...l", 4, 5) == &buf[8 + 3 * 4]); assert(!strncmp(buf, "-----......h...e...ll...o-", 26)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], "...h...e...l...l...o")[0] = '-'; assert(libsimple_memelemmove(&buf[8], &buf[5], "...x", 4, 5) == NULL); assert(!strncmp(buf, "-----......h...e...l...l...o-", 29)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], ".......h.......e.......l.......l.......o")[0] = '-'; assert(libsimple_memelemmove(&buf[5], &buf[5], ".......o", 8, 5) == &buf[5 + 5 * 8]); assert(!strncmp(buf, "-----.......h.......e.......l.......l.......o-", 46)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], ".......h.......e.......l.......l.......o")[0] = '-'; assert(libsimple_memelemmove(&buf[5], &buf[5], ".......l", 8, 5) == &buf[5 + 3 * 8]); assert(!strncmp(buf, "-----.......h.......e.......l.......l.......o-", 46)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], ".......h.......e.......l.......l.......o")[0] = '-'; assert(libsimple_memelemmove(&buf[5], &buf[5], ".......x", 8, 5) == NULL); assert(!strncmp(buf, "-----.......h.......e.......l.......l.......o-", 46)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], ".......h.......e.......l.......l.......o")[0] = '-'; assert(libsimple_memelemmove(&buf[3], &buf[5], ".......o", 8, 5) == &buf[3 + 5 * 8]); assert(!strncmp(buf, "---.......h.......e.......l.......l.......o.o-", 46)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], ".......h.......e.......l.......l.......o")[0] = '-'; assert(libsimple_memelemmove(&buf[3], &buf[5], ".......l", 8, 5) == &buf[3 + 3 * 8]); assert(!strncmp(buf, "---.......h.......e.......l.l.......l.......o-", 46)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], ".......h.......e.......l.......l.......o")[0] = '-'; assert(libsimple_memelemmove(&buf[3], &buf[5], ".......x", 8, 5) == NULL); assert(!strncmp(buf, "---.......h.......e.......l.......l.......o.o-", 46)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], ".......h.......e.......l.......l.......o")[0] = '-'; assert(libsimple_memelemmove(&buf[8], &buf[5], ".......o", 8, 5) == &buf[8 + 5 * 8]); assert(!strncmp(buf, "-----..........h.......e.......l.......l.......o-", 49)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], ".......h.......e.......l.......l.......o")[0] = '-'; assert(libsimple_memelemmove(&buf[8], &buf[5], ".......l", 8, 5) == &buf[8 + 3 * 8]); assert(!strncmp(buf, "-----..........h.......e.......l....l.......o-", 46)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], ".......h.......e.......l.......l.......o")[0] = '-'; assert(libsimple_memelemmove(&buf[8], &buf[5], ".......x", 8, 5) == NULL); assert(!strncmp(buf, "-----..........h.......e.......l.......l.......o-", 49)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], ".a.a.aa..a")[0] = '-'; assert(libsimple_memelemmove(&buf[5], &buf[5], "a.", 2, 5) == &buf[5 + 4 * 2]); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], ".a.a.aa..a")[0] = '-'; assert(libsimple_memelemmove(&buf[3], &buf[5], "a.", 2, 5) == &buf[3 + 4 * 2]); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], ".a.a.aa..a")[0] = '-'; assert(libsimple_memelemmove(&buf[8], &buf[5], "a.", 2, 5) == &buf[8 + 4 * 2]); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], "..a..a..aa....a")[0] = '-'; assert(libsimple_memelemmove(&buf[5], &buf[5], "a..", 3, 5) == &buf[5 + 4 * 3]); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], "..a..a..aa....a")[0] = '-'; assert(libsimple_memelemmove(&buf[3], &buf[5], "a..", 3, 5) == &buf[3 + 4 * 3]); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], "..a..a..aa....a")[0] = '-'; assert(libsimple_memelemmove(&buf[8], &buf[5], "a..", 3, 5) == &buf[8 + 4 * 3]); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], "...a...a...aa......a")[0] = '-'; assert(libsimple_memelemmove(&buf[5], &buf[5], "a...", 4, 5) == &buf[5 + 4 * 4]); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], "...a...a...aa......a")[0] = '-'; assert(libsimple_memelemmove(&buf[3], &buf[5], "a...", 4, 5) == &buf[3 + 4 * 4]); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], "...a...a...aa......a")[0] = '-'; assert(libsimple_memelemmove(&buf[8], &buf[5], "a...", 4, 5) == &buf[8 + 4 * 4]); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], ".......a.......a.......aa..............a")[0] = '-'; assert(libsimple_memelemmove(&buf[5], &buf[5], "a.......", 8, 5) == &buf[5 + 4 * 8]); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], ".......a.......a.......aa..............a")[0] = '-'; assert(libsimple_memelemmove(&buf[3], &buf[5], "a.......", 8, 5) == &buf[3 + 4 * 8]); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], ".......a.......a.......aa..............a")[0] = '-'; assert(libsimple_memelemmove(&buf[8], &buf[5], "a.......", 8, 5) == &buf[8 + 4 * 8]); diff --git a/memelemscan.c b/memelemscan.c index b402570..b541319 100644 --- a/memelemscan.c +++ b/memelemscan.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/memelemscan_inv.c b/memelemscan_inv.c index 48d35b2..cdbae3c 100644 --- a/memelemscan_inv.c +++ b/memelemscan_inv.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/memisutf8.c b/memisutf8.c index b3d321e..c7ffbd8 100644 --- a/memisutf8.c +++ b/memisutf8.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -14,17 +14,20 @@ main(void) { char buf[100]; - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], "hello")[0] = '-'; assert(libsimple_mempmove(&buf[5], &buf[5], 5) == &buf[5 + 5]); assert(!strncmp(buf, "-----hello-", 11)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], "hello")[0] = '-'; assert(libsimple_mempmove(&buf[3], &buf[5], 5) == &buf[3 + 5]); assert(!strncmp(buf, "---hellolo-", 11)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], "hello")[0] = '-'; assert(libsimple_mempmove(&buf[8], &buf[5], 5) == &buf[8 + 5]); assert(!strncmp(buf, "-----helhello-", 14)); @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/mempsetelem.c b/mempsetelem.c index cf84702..61b202b 100644 --- a/mempsetelem.c +++ b/mempsetelem.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -12,6 +12,8 @@ libsimple_mempsetelem(void *buf_, const void *item, size_t width, size_t n) case 1: return &((char *)memset(buf_, *(const char *)item, n))[n]; case 2: + if ((uintptr_t)buf_ % _Alignof(uint16_t) || (uintptr_t)item % _Alignof(uint16_t)) + goto misaligned; { uint16_t *buf = buf_; uint16_t *end = &buf[n]; @@ -21,6 +23,8 @@ libsimple_mempsetelem(void *buf_, const void *item, size_t width, size_t n) return buf; } case 4: + if ((uintptr_t)buf_ % _Alignof(uint32_t) || (uintptr_t)item % _Alignof(uint32_t)) + goto misaligned; { uint32_t *buf = buf_; uint32_t *end = &buf[n]; @@ -30,6 +34,8 @@ libsimple_mempsetelem(void *buf_, const void *item, size_t width, size_t n) return buf; } case 8: + if ((uintptr_t)buf_ % _Alignof(uint64_t) || (uintptr_t)item % _Alignof(uint64_t)) + goto misaligned; { uint64_t *buf = buf_; uint64_t *end = &buf[n]; @@ -39,6 +45,7 @@ libsimple_mempsetelem(void *buf_, const void *item, size_t width, size_t n) return buf; } default: + misaligned: { char *buf = buf_; size_t i; @@ -57,8 +64,8 @@ libsimple_mempsetelem(void *buf_, const void *item, size_t width, size_t n) int main(void) { - char buf_[4096]; - char *buf = buf_; + _Alignas(8) char buf_[4096]; + _Alignas(8) char *buf = buf_; size_t i; memset(buf, 0, sizeof(buf_)); @@ -76,6 +83,10 @@ main(void) assert(libsimple_mempsetelem(buf, &(uint64_t){0x0102030450607080ULL}, 8, 100) == &buf[800]); assert(libsimple_mempsetelem(buf, (char []){(char)0xA0, (char)0xB0, (char)0xC0}, 3, 16) == &buf[48]); +#if defined(__clang__) +# pragma clang diagnostic ignored "-Wcast-align" +#endif + for (i = 0; i < 48; i++) assert(buf[i] == ((char []){(char)0xA0, (char)0xB0, (char)0xC0})[i % 3]); for (; i < 800; i += 8) diff --git a/memptolower.c b/memptolower.c index f9b05e5..6ef3577 100644 --- a/memptolower.c +++ b/memptolower.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/memptoupper.c b/memptoupper.c index c02cb3c..1ad61ce 100644 --- a/memptoupper.c +++ b/memptoupper.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/memrcasechr.c b/memrcasechr.c index 1e6662e..e06586c 100644 --- a/memrcasechr.c +++ b/memrcasechr.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/memrcasechr_inv.c b/memrcasechr_inv.c index 1bcf221..ffb29a3 100644 --- a/memrcasechr_inv.c +++ b/memrcasechr_inv.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/memrcaseeqlen.c b/memrcaseeqlen.c index 91b98d3..6042f4a 100644 --- a/memrcaseeqlen.c +++ b/memrcaseeqlen.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/memrcasemem.c b/memrcasemem.c index a7e9462..1ed9bb2 100644 --- a/memrcasemem.c +++ b/memrcasemem.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/memrchr_inv.c b/memrchr_inv.c index 9ebba42..16dcbcd 100644 --- a/memrchr_inv.c +++ b/memrchr_inv.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/memrelem_inv.c b/memrelem_inv.c index 3bb0f89..a442eff 100644 --- a/memrelem_inv.c +++ b/memrelem_inv.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/memreplace.c b/memreplace.c index 563e76c..7a2eac4 100644 --- a/memreplace.c +++ b/memreplace.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/memreplaceelem.c b/memreplaceelem.c index 9a56c98..c36d2e6 100644 --- a/memreplaceelem.c +++ b/memreplaceelem.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/memreqlen.c b/memreqlen.c index 64a2e83..b3cba03 100644 --- a/memreqlen.c +++ b/memreqlen.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/memscan_inv.c b/memscan_inv.c index 29bdfce..f99c10f 100644 --- a/memscan_inv.c +++ b/memscan_inv.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/memsetelem.c b/memsetelem.c index 32c3f74..75190f2 100644 --- a/memsetelem.c +++ b/memsetelem.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -12,37 +12,41 @@ extern inline void *libsimple_memsetelem(void *, const void *, size_t, size_t); int main(void) { - char p_[4096]; - char *p = p_; + _Alignas(8) char buf_[4096]; + _Alignas(8) char *buf = buf_; size_t i; - memset(p, 0, sizeof(p_)); - assert(libsimple_memsetelem(p, &(uint64_t){~(uint64_t)0}, 0, 0) == p); - assert(libsimple_memsetelem(p, &(uint64_t){~(uint64_t)0}, 0, 10) == p); - assert(libsimple_memsetelem(p, &(uint64_t){~(uint64_t)0}, 1, 0) == p); - assert(libsimple_memsetelem(p, &(uint64_t){~(uint64_t)0}, 2, 0) == p); - assert(libsimple_memsetelem(p, &(uint64_t){~(uint64_t)0}, 4, 0) == p); - assert(libsimple_memsetelem(p, &(uint64_t){~(uint64_t)0}, 8, 0) == p); - assert(libsimple_memsetelem(p, &(uint64_t){~(uint64_t)0}, 16, 0) == p); - assert(libsimple_memsetelem(p, &(uint64_t){~(uint64_t)0}, 3, 0) == p); - assert(libsimple_memsetelem(p, &(uint8_t){0x09}, 1, 3000) == p); - assert(libsimple_memsetelem(p, &(uint16_t){0x0807}, 2, 1000) == p); - assert(libsimple_memsetelem(p, &(uint32_t){0x10203040UL}, 4, 300) == p); - assert(libsimple_memsetelem(p, &(uint64_t){0x0102030450607080ULL}, 8, 100) == p); - assert(libsimple_memsetelem(p, (char []){(char)0xA0, (char)0xB0, (char)0xC0}, 3, 16) == p); + memset(buf, 0, sizeof(buf_)); + assert(libsimple_memsetelem(buf, &(uint64_t){~(uint64_t)0}, 0, 0) == buf); + assert(libsimple_memsetelem(buf, &(uint64_t){~(uint64_t)0}, 0, 10) == buf); + assert(libsimple_memsetelem(buf, &(uint64_t){~(uint64_t)0}, 1, 0) == buf); + assert(libsimple_memsetelem(buf, &(uint64_t){~(uint64_t)0}, 2, 0) == buf); + assert(libsimple_memsetelem(buf, &(uint64_t){~(uint64_t)0}, 4, 0) == buf); + assert(libsimple_memsetelem(buf, &(uint64_t){~(uint64_t)0}, 8, 0) == buf); + assert(libsimple_memsetelem(buf, &(uint64_t){~(uint64_t)0}, 16, 0) == buf); + assert(libsimple_memsetelem(buf, &(uint64_t){~(uint64_t)0}, 3, 0) == buf); + assert(libsimple_memsetelem(buf, &(uint8_t){0x09}, 1, 3000) == buf); + assert(libsimple_memsetelem(buf, &(uint16_t){0x0807}, 2, 1000) == buf); + assert(libsimple_memsetelem(buf, &(uint32_t){0x10203040UL}, 4, 300) == buf); + assert(libsimple_memsetelem(buf, &(uint64_t){0x0102030450607080ULL}, 8, 100) == buf); + assert(libsimple_memsetelem(buf, (char []){(char)0xA0, (char)0xB0, (char)0xC0}, 3, 16) == buf); + +#if defined(__clang__) +# pragma clang diagnostic ignored "-Wcast-align" +#endif for (i = 0; i < 48; i++) - assert(p[i] == ((char []){(char)0xA0, (char)0xB0, (char)0xC0})[i % 3]); + assert(buf[i] == ((char []){(char)0xA0, (char)0xB0, (char)0xC0})[i % 3]); for (; i < 800; i += 8) - assert(*(uint64_t *)&p[i] == 0x0102030450607080ULL); + assert(*(uint64_t *)&buf[i] == 0x0102030450607080ULL); for (; i < 1200; i += 4) - assert(*(uint32_t *)&p[i] == 0x10203040UL); + assert(*(uint32_t *)&buf[i] == 0x10203040UL); for (; i < 2000; i += 2) - assert(*(uint16_t *)&p[i] == 0x0807); + assert(*(uint16_t *)&buf[i] == 0x0807); for (; i < 3000; i++) - assert(p[i] == 0x09); - for (; i < sizeof(p_); i++) - assert(p[i] == 0); + assert(buf[i] == 0x09); + for (; i < sizeof(buf_); i++) + assert(buf[i] == 0); return 0; } diff --git a/memstarts.c b/memstarts.c index ace2b70..aa128f7 100644 --- a/memstarts.c +++ b/memstarts.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/memtolower.c b/memtolower.c index 364776a..30d66ad 100644 --- a/memtolower.c +++ b/memtolower.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/memtoupper.c b/memtoupper.c index 376037a..38eb0ab 100644 --- a/memtoupper.c +++ b/memtoupper.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/minimise_number_string.c b/minimise_number_string.c index 5993564..4a90916 100644 --- a/minimise_number_string.c +++ b/minimise_number_string.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/multimespec.c b/multimespec.c index bc73055..ee0e1f3 100644 --- a/multimespec.c +++ b/multimespec.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -72,139 +72,166 @@ main(void) { struct timespec r, a; - a.tv_sec = 0, a.tv_nsec = 0L; + a.tv_sec = 0; + a.tv_nsec = 0L; assert(!libsimple_multimespec(&r, &a, 0)); assert(r.tv_sec == 0); assert(r.tv_nsec == 0L); - a.tv_sec = 10, a.tv_nsec = 0L; + a.tv_sec = 10; + a.tv_nsec = 0L; assert(!libsimple_multimespec(&r, &a, 0)); assert(r.tv_sec == 0); assert(r.tv_nsec == 0L); - a.tv_sec = 0, a.tv_nsec = 10L; + a.tv_sec = 0; + a.tv_nsec = 10L; assert(!libsimple_multimespec(&r, &a, 0)); assert(r.tv_sec == 0); assert(r.tv_nsec == 0L); - a.tv_sec = 10, a.tv_nsec = 10L; + a.tv_sec = 10; + a.tv_nsec = 10L; assert(!libsimple_multimespec(&r, &a, 0)); assert(r.tv_sec == 0); assert(r.tv_nsec == 0L); - a.tv_sec = 0, a.tv_nsec = 0L; + a.tv_sec = 0; + a.tv_nsec = 0L; assert(!libsimple_multimespec(&r, &a, 1)); assert(r.tv_sec == 0); assert(r.tv_nsec == 0L); - a.tv_sec = 10, a.tv_nsec = 0L; + a.tv_sec = 10; + a.tv_nsec = 0L; assert(!libsimple_multimespec(&r, &a, 1)); assert(r.tv_sec == 10); assert(r.tv_nsec == 0L); - a.tv_sec = 0, a.tv_nsec = 10L; + a.tv_sec = 0; + a.tv_nsec = 10L; assert(!libsimple_multimespec(&r, &a, 1)); assert(r.tv_sec == 0); assert(r.tv_nsec == 10L); - a.tv_sec = 10, a.tv_nsec = 10L; + a.tv_sec = 10; + a.tv_nsec = 10L; assert(!libsimple_multimespec(&r, &a, 1)); assert(r.tv_sec == 10); assert(r.tv_nsec == 10L); - a.tv_sec = 0, a.tv_nsec = 0L; + a.tv_sec = 0; + a.tv_nsec = 0L; assert(!libsimple_multimespec(&r, &a, 10)); assert(r.tv_sec == 0); assert(r.tv_nsec == 0L); - a.tv_sec = 10, a.tv_nsec = 0L; + a.tv_sec = 10; + a.tv_nsec = 0L; assert(!libsimple_multimespec(&r, &a, 10)); assert(r.tv_sec == 100); assert(r.tv_nsec == 0L); - a.tv_sec = 0, a.tv_nsec = 10L; + a.tv_sec = 0; + a.tv_nsec = 10L; assert(!libsimple_multimespec(&r, &a, 10)); assert(r.tv_sec == 0); assert(r.tv_nsec == 100L); - a.tv_sec = 10, a.tv_nsec = 10L; + a.tv_sec = 10; + a.tv_nsec = 10L; assert(!libsimple_multimespec(&r, &a, 10)); assert(r.tv_sec == 100); assert(r.tv_nsec == 100L); - a.tv_sec = 0, a.tv_nsec = 0L; + a.tv_sec = 0; + a.tv_nsec = 0L; assert(!libsimple_multimespec(&r, &a, -1)); assert(r.tv_sec == 0); assert(r.tv_nsec == 0L); - a.tv_sec = 10, a.tv_nsec = 0L; + a.tv_sec = 10; + a.tv_nsec = 0L; assert(!libsimple_multimespec(&r, &a, -1)); assert(r.tv_sec == -10); assert(r.tv_nsec == 0L); - a.tv_sec = 0, a.tv_nsec = 10L; + a.tv_sec = 0; + a.tv_nsec = 10L; assert(!libsimple_multimespec(&r, &a, -1)); assert(r.tv_sec == -1); assert(r.tv_nsec == 1000000000L - 10L); - a.tv_sec = 10, a.tv_nsec = 10L; + a.tv_sec = 10; + a.tv_nsec = 10L; assert(!libsimple_multimespec(&r, &a, -1)); assert(r.tv_sec == -11); assert(r.tv_nsec == 1000000000L - 10L); - a.tv_sec = 0, a.tv_nsec = 0L; + a.tv_sec = 0; + a.tv_nsec = 0L; assert(!libsimple_multimespec(&r, &a, -10)); assert(r.tv_sec == 0); assert(r.tv_nsec == 0L); - a.tv_sec = 10, a.tv_nsec = 0L; + a.tv_sec = 10; + a.tv_nsec = 0L; assert(!libsimple_multimespec(&r, &a, -10)); assert(r.tv_sec == -100); assert(r.tv_nsec == 0L); - a.tv_sec = 0, a.tv_nsec = 10L; + a.tv_sec = 0; + a.tv_nsec = 10L; assert(!libsimple_multimespec(&r, &a, -10)); assert(r.tv_sec == -1); assert(r.tv_nsec == 1000000000L - 100L); - a.tv_sec = 10, a.tv_nsec = 10L; + a.tv_sec = 10; + a.tv_nsec = 10L; assert(!libsimple_multimespec(&r, &a, -10)); assert(r.tv_sec == -101); assert(r.tv_nsec == 1000000000L - 100L); - a.tv_sec = TIME_MAX, a.tv_nsec = 999999999L; + a.tv_sec = TIME_MAX; + a.tv_nsec = 999999999L; assert(!libsimple_multimespec(&r, &a, 0)); assert(r.tv_sec == 0); assert(r.tv_nsec == 0); - a.tv_sec = TIME_MAX, a.tv_nsec = 999999999L; + a.tv_sec = TIME_MAX; + a.tv_nsec = 999999999L; assert(!libsimple_multimespec(&r, &a, 1)); assert(r.tv_sec == TIME_MAX); assert(r.tv_nsec == 999999999L); - a.tv_sec = TIME_MAX, a.tv_nsec = 0L; + a.tv_sec = TIME_MAX; + a.tv_nsec = 0L; assert(libsimple_multimespec(&r, &a, 2) == -1 && errno == ERANGE); assert(r.tv_sec == TIME_MAX); assert(r.tv_nsec == 999999999L); - a.tv_sec = TIME_MAX, a.tv_nsec = 0L; + a.tv_sec = TIME_MAX; + a.tv_nsec = 0L; assert(libsimple_multimespec(&r, &a, -2) == -1 && errno == ERANGE); assert(r.tv_sec == TIME_MIN); assert(r.tv_nsec == 0L); - a.tv_sec = TIME_MAX, a.tv_nsec = 0L; + a.tv_sec = TIME_MAX; + a.tv_nsec = 0L; assert(!libsimple_multimespec(&r, &a, -1)); assert(r.tv_sec == -TIME_MAX); assert(r.tv_nsec == 0L); if (-TIME_MAX > TIME_MIN) { - a.tv_sec = TIME_MAX, a.tv_nsec = 999999999L; + a.tv_sec = TIME_MAX; + a.tv_nsec = 999999999L; assert(!libsimple_multimespec(&r, &a, -1)); assert(r.tv_sec == -TIME_MAX - (time_t)1); assert(r.tv_nsec == 1L); } - a.tv_sec = 10, a.tv_nsec = 100000001L; + a.tv_sec = 10; + a.tv_nsec = 100000001L; assert(!libsimple_multimespec(&r, &a, 10)); assert(r.tv_sec == 101); assert(r.tv_nsec == 10L); diff --git a/multimeval.c b/multimeval.c index 5f8010e..b974bf6 100644 --- a/multimeval.c +++ b/multimeval.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -26,139 +26,166 @@ main(void) { struct timeval r, a; - a.tv_sec = 0, a.tv_usec = 0L; + a.tv_sec = 0; + a.tv_usec = 0L; assert(!libsimple_multimeval(&r, &a, 0)); assert(r.tv_sec == 0); assert(r.tv_usec == 0L); - a.tv_sec = 10, a.tv_usec = 0L; + a.tv_sec = 10; + a.tv_usec = 0L; assert(!libsimple_multimeval(&r, &a, 0)); assert(r.tv_sec == 0); assert(r.tv_usec == 0L); - a.tv_sec = 0, a.tv_usec = 10L; + a.tv_sec = 0; + a.tv_usec = 10L; assert(!libsimple_multimeval(&r, &a, 0)); assert(r.tv_sec == 0); assert(r.tv_usec == 0L); - a.tv_sec = 10, a.tv_usec = 10L; + a.tv_sec = 10; + a.tv_usec = 10L; assert(!libsimple_multimeval(&r, &a, 0)); assert(r.tv_sec == 0); assert(r.tv_usec == 0L); - a.tv_sec = 0, a.tv_usec = 0L; + a.tv_sec = 0; + a.tv_usec = 0L; assert(!libsimple_multimeval(&r, &a, 1)); assert(r.tv_sec == 0); assert(r.tv_usec == 0L); - a.tv_sec = 10, a.tv_usec = 0L; + a.tv_sec = 10; + a.tv_usec = 0L; assert(!libsimple_multimeval(&r, &a, 1)); assert(r.tv_sec == 10); assert(r.tv_usec == 0L); - a.tv_sec = 0, a.tv_usec = 10L; + a.tv_sec = 0; + a.tv_usec = 10L; assert(!libsimple_multimeval(&r, &a, 1)); assert(r.tv_sec == 0); assert(r.tv_usec == 10L); - a.tv_sec = 10, a.tv_usec = 10L; + a.tv_sec = 10; + a.tv_usec = 10L; assert(!libsimple_multimeval(&r, &a, 1)); assert(r.tv_sec == 10); assert(r.tv_usec == 10L); - a.tv_sec = 0, a.tv_usec = 0L; + a.tv_sec = 0; + a.tv_usec = 0L; assert(!libsimple_multimeval(&r, &a, 10)); assert(r.tv_sec == 0); assert(r.tv_usec == 0L); - a.tv_sec = 10, a.tv_usec = 0L; + a.tv_sec = 10; + a.tv_usec = 0L; assert(!libsimple_multimeval(&r, &a, 10)); assert(r.tv_sec == 100); assert(r.tv_usec == 0L); - a.tv_sec = 0, a.tv_usec = 10L; + a.tv_sec = 0; + a.tv_usec = 10L; assert(!libsimple_multimeval(&r, &a, 10)); assert(r.tv_sec == 0); assert(r.tv_usec == 100L); - a.tv_sec = 10, a.tv_usec = 10L; + a.tv_sec = 10; + a.tv_usec = 10L; assert(!libsimple_multimeval(&r, &a, 10)); assert(r.tv_sec == 100); assert(r.tv_usec == 100L); - a.tv_sec = 0, a.tv_usec = 0L; + a.tv_sec = 0; + a.tv_usec = 0L; assert(!libsimple_multimeval(&r, &a, -1)); assert(r.tv_sec == 0); assert(r.tv_usec == 0L); - a.tv_sec = 10, a.tv_usec = 0L; + a.tv_sec = 10; + a.tv_usec = 0L; assert(!libsimple_multimeval(&r, &a, -1)); assert(r.tv_sec == -10); assert(r.tv_usec == 0L); - a.tv_sec = 0, a.tv_usec = 10L; + a.tv_sec = 0; + a.tv_usec = 10L; assert(!libsimple_multimeval(&r, &a, -1)); assert(r.tv_sec == -1); assert(r.tv_usec == 1000000L - 10L); - a.tv_sec = 10, a.tv_usec = 10L; + a.tv_sec = 10; + a.tv_usec = 10L; assert(!libsimple_multimeval(&r, &a, -1)); assert(r.tv_sec == -11); assert(r.tv_usec == 1000000L - 10L); - a.tv_sec = 0, a.tv_usec = 0L; + a.tv_sec = 0; + a.tv_usec = 0L; assert(!libsimple_multimeval(&r, &a, -10)); assert(r.tv_sec == 0); assert(r.tv_usec == 0L); - a.tv_sec = 10, a.tv_usec = 0L; + a.tv_sec = 10; + a.tv_usec = 0L; assert(!libsimple_multimeval(&r, &a, -10)); assert(r.tv_sec == -100); assert(r.tv_usec == 0L); - a.tv_sec = 0, a.tv_usec = 10L; + a.tv_sec = 0; + a.tv_usec = 10L; assert(!libsimple_multimeval(&r, &a, -10)); assert(r.tv_sec == -1); assert(r.tv_usec == 1000000L - 100L); - a.tv_sec = 10, a.tv_usec = 10L; + a.tv_sec = 10; + a.tv_usec = 10L; assert(!libsimple_multimeval(&r, &a, -10)); assert(r.tv_sec == -101); assert(r.tv_usec == 1000000L - 100L); - a.tv_sec = TIME_MAX, a.tv_usec = 999999L; + a.tv_sec = TIME_MAX; + a.tv_usec = 999999L; assert(!libsimple_multimeval(&r, &a, 0)); assert(r.tv_sec == 0); assert(r.tv_usec == 0); - a.tv_sec = TIME_MAX, a.tv_usec = 999999L; + a.tv_sec = TIME_MAX; + a.tv_usec = 999999L; assert(!libsimple_multimeval(&r, &a, 1)); assert(r.tv_sec == TIME_MAX); assert(r.tv_usec == 999999L); - a.tv_sec = TIME_MAX, a.tv_usec = 0L; + a.tv_sec = TIME_MAX; + a.tv_usec = 0L; assert(libsimple_multimeval(&r, &a, 2) == -1 && errno == ERANGE); assert(r.tv_sec == TIME_MAX); assert(r.tv_usec == 999999L); - a.tv_sec = TIME_MAX, a.tv_usec = 0L; + a.tv_sec = TIME_MAX; + a.tv_usec = 0L; assert(libsimple_multimeval(&r, &a, -2) == -1 && errno == ERANGE); assert(r.tv_sec == TIME_MIN); assert(r.tv_usec == 0L); - a.tv_sec = TIME_MAX, a.tv_usec = 0L; + a.tv_sec = TIME_MAX; + a.tv_usec = 0L; assert(!libsimple_multimeval(&r, &a, -1)); assert(r.tv_sec == -TIME_MAX); assert(r.tv_usec == 0L); if (-TIME_MAX > TIME_MIN) { - a.tv_sec = TIME_MAX, a.tv_usec = 999999L; + a.tv_sec = TIME_MAX; + a.tv_usec = 999999L; assert(!libsimple_multimeval(&r, &a, -1)); assert(r.tv_sec == -TIME_MAX - (time_t)1); assert(r.tv_usec == 1L); } - a.tv_sec = 10, a.tv_usec = 100001L; + a.tv_sec = 10; + a.tv_usec = 100001L; assert(!libsimple_multimeval(&r, &a, 10)); assert(r.tv_sec == 101); assert(r.tv_usec == 10L); diff --git a/posix_memalignn.c b/posix_memalignn.c index 9f2617b..1400451 100644 --- a/posix_memalignn.c +++ b/posix_memalignn.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/posix_memalignz.c b/posix_memalignz.c index 18530ca..7c32bdd 100644 --- a/posix_memalignz.c +++ b/posix_memalignz.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/posix_memalignzn.c b/posix_memalignzn.c index d91924e..a00ca84 100644 --- a/posix_memalignzn.c +++ b/posix_memalignzn.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/pvalloczn.c b/pvalloczn.c index 9349f47..b586863 100644 --- a/pvalloczn.c +++ b/pvalloczn.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/rawmemcasechr.c b/rawmemcasechr.c index 3d3a101..b81d6d8 100644 --- a/rawmemcasechr.c +++ b/rawmemcasechr.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/rawmemcasechr_inv.c b/rawmemcasechr_inv.c index 13101cf..e0f2401 100644 --- a/rawmemcasechr_inv.c +++ b/rawmemcasechr_inv.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/rawmemccpy.c b/rawmemccpy.c index cba8476..bdc4c7c 100644 --- a/rawmemccpy.c +++ b/rawmemccpy.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -14,11 +14,13 @@ main(void) { char buf[100]; - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; assert(libsimple_rawmemccpy(buf, "hello", 'o') == &buf[5]); assert(!strncmp(buf, "hellox", 6)); - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; assert(libsimple_rawmemccpy(buf, "hello", 'l') == &buf[3]); assert(!strncmp(buf, "helx", 4)); diff --git a/rawmemchr.c b/rawmemchr.c index 2ed1709..b694f79 100644 --- a/rawmemchr.c +++ b/rawmemchr.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/rawmemchr_inv.c b/rawmemchr_inv.c index d566aba..1b126aa 100644 --- a/rawmemchr_inv.c +++ b/rawmemchr_inv.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/rawmemcmove.c b/rawmemcmove.c index fd831af..aeec55f 100644 --- a/rawmemcmove.c +++ b/rawmemcmove.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -14,34 +14,40 @@ main(void) { char buf[100]; - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], "hello")[0] = '-'; assert(libsimple_rawmemcmove(&buf[5], &buf[5], 'o') == &buf[5 + 5]); assert(!strncmp(buf, "-----hello-", 11)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], "hello")[0] = '-'; assert(libsimple_rawmemcmove(&buf[5], &buf[5], 'l') == &buf[5 + 3]); assert(!strncmp(buf, "-----hello-", 11)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], "hello")[0] = '-'; assert(libsimple_rawmemcmove(&buf[3], &buf[5], 'o') == &buf[3 + 5]); assert(!strncmp(buf, "---hellolo-", 11)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], "hello")[0] = '-'; assert(libsimple_rawmemcmove(&buf[3], &buf[5], 'l') == &buf[3 + 3]); assert(!strncmp(buf, "---helello-", 11)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], "hello")[0] = '-'; assert(libsimple_rawmemcmove(&buf[8], &buf[5], 'o') == &buf[8 + 5]); assert(!strncmp(buf, "-----helhello-", 14)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], "hello")[0] = '-'; assert(libsimple_rawmemcmove(&buf[8], &buf[5], 'l') == &buf[8 + 3]); assert(!strncmp(buf, "-----helhel-", 12)); diff --git a/rawmemelem.c b/rawmemelem.c index 798f275..1564937 100644 --- a/rawmemelem.c +++ b/rawmemelem.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/rawmemelem_inv.c b/rawmemelem_inv.c index d9ed507..1e8bc00 100644 --- a/rawmemelem_inv.c +++ b/rawmemelem_inv.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/rawmemelemcpy.c b/rawmemelemcpy.c index d5e52a2..ecd5337 100644 --- a/rawmemelemcpy.c +++ b/rawmemelemcpy.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -82,72 +82,88 @@ main(void) char buf[1024]; - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; assert(libsimple_rawmemelemcpy(buf, "hello", "o", 0) == &buf[0]); assert(!strncmp(buf, "x", 1)); - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; assert(libsimple_rawmemelemcpy(buf, "hello", "l", 0) == &buf[0]); assert(!strncmp(buf, "x", 1)); - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; assert(libsimple_rawmemelemcpy(buf, "hello", "o", 1) == &buf[5]); assert(!strncmp(buf, "hellox", 6)); - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; assert(libsimple_rawmemelemcpy(buf, "hello", "l", 1) == &buf[3]); assert(!strncmp(buf, "helx", 4)); - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; assert(libsimple_rawmemelemcpy(buf, ".h.e.l.l.o", ".o", 2) == &buf[5 * 2]); assert(!strncmp(buf, ".h.e.l.l.ox", 11)); - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; assert(libsimple_rawmemelemcpy(buf, ".h.e.l.l.o", ".l", 2) == &buf[3 * 2]); assert(!strncmp(buf, ".h.e.lx", 7)); - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; assert(libsimple_rawmemelemcpy(buf, ".h.l.ll..o", "l.", 2) == &buf[4 * 2]); assert(!strncmp(buf, ".h.l.ll.x", 9)); - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; assert(libsimple_rawmemelemcpy(buf, "..h..e..l..l..o", "..o", 3) == &buf[5 * 3]); assert(!strncmp(buf, "..h..e..l..l..ox", 16)); - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; assert(libsimple_rawmemelemcpy(buf, "..h..e..l..l..o", "..l", 3) == &buf[3 * 3]); assert(!strncmp(buf, "..h..e..lx", 10)); - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; assert(libsimple_rawmemelemcpy(buf, "..h..l..ll....o", "l..", 3) == &buf[4 * 3]); assert(!strncmp(buf, "..h..l..ll..x", 13)); - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; assert(libsimple_rawmemelemcpy(buf, "...h...e...l...l...o", "...o", 4) == &buf[5 * 4]); assert(!strncmp(buf, "...h...e...l...l...ox", 21)); - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; assert(libsimple_rawmemelemcpy(buf, "...h...e...l...l...o", "...l", 4) == &buf[3 * 4]); assert(!strncmp(buf, "...h...e...lx", 13)); - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; assert(libsimple_rawmemelemcpy(buf, "...h...l...ll......o", "l...", 4) == &buf[4 * 4]); assert(!strncmp(buf, "...h...l...ll...x", 17)); - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; assert(libsimple_rawmemelemcpy(buf, ".......h.......e.......l.......l.......o", ".......o", 8) == &buf[5 * 8]); assert(!strncmp(buf, ".......h.......e.......l.......l.......ox", 21)); - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; assert(libsimple_rawmemelemcpy(buf, ".......h.......e.......l.......l.......o", ".......l", 8) == &buf[3 * 8]); assert(!strncmp(buf, ".......h.......e.......lx", 13)); - memset(buf, 'x', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, 'x', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; assert(libsimple_rawmemelemcpy(buf, ".......h.......l.......ll..............o", "l.......", 8) == &buf[4 * 8]); assert(!strncmp(buf, ".......h.......l.......ll.......x", 21)); diff --git a/rawmemelemmove.c b/rawmemelemmove.c index 717a590..a145e7e 100644 --- a/rawmemelemmove.c +++ b/rawmemelemmove.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -113,225 +113,270 @@ main(void) char buf[1024]; - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], "hello")[0] = '-'; assert(libsimple_rawmemelemmove(&buf[5], &buf[5], "", 0) == &buf[5]); assert(!strncmp(buf, "-----hello-", 11)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], "hello")[0] = '-'; assert(libsimple_rawmemelemmove(&buf[3], &buf[5], "", 0) == &buf[3]); assert(!strncmp(buf, "-----hello-", 11)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], "hello")[0] = '-'; assert(libsimple_rawmemelemmove(&buf[5], &buf[3], "", 0) == &buf[5]); assert(!strncmp(buf, "-----hello-", 11)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], "hello")[0] = '-'; assert(libsimple_rawmemelemmove(&buf[5], &buf[5], "o", 1) == &buf[5 + 5]); assert(!strncmp(buf, "-----hello-", 11)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], "hello")[0] = '-'; assert(libsimple_rawmemelemmove(&buf[5], &buf[5], "l", 1) == &buf[5 + 3]); assert(!strncmp(buf, "-----hello-", 11)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], "hello")[0] = '-'; assert(libsimple_rawmemelemmove(&buf[3], &buf[5], "o", 1) == &buf[3 + 5]); assert(!strncmp(buf, "---hellolo-", 11)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], "hello")[0] = '-'; assert(libsimple_rawmemelemmove(&buf[3], &buf[5], "l", 1) == &buf[3 + 3]); assert(!strncmp(buf, "---helello-", 11)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], "hello")[0] = '-'; assert(libsimple_rawmemelemmove(&buf[8], &buf[5], "o", 1) == &buf[8 + 5]); assert(!strncmp(buf, "-----helhello-", 14)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], "hello")[0] = '-'; assert(libsimple_rawmemelemmove(&buf[8], &buf[5], "l", 1) == &buf[8 + 3]); assert(!strncmp(buf, "-----helhel-", 12)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], ".h.e.l.l.o")[0] = '-'; assert(libsimple_rawmemelemmove(&buf[5], &buf[5], ".o", 2) == &buf[5 + 5 * 2]); assert(!strncmp(buf, "-----.h.e.l.l.o-", 16)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], ".h.e.l.l.o")[0] = '-'; assert(libsimple_rawmemelemmove(&buf[5], &buf[5], ".l", 2) == &buf[5 + 3 * 2]); assert(!strncmp(buf, "-----.h.e.l.l.o-", 16)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], ".h.e.l.l.o")[0] = '-'; assert(libsimple_rawmemelemmove(&buf[3], &buf[5], ".o", 2) == &buf[3 + 5 * 2]); assert(!strncmp(buf, "---.h.e.l.l.o.o-", 16)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], ".h.e.l.l.o")[0] = '-'; assert(libsimple_rawmemelemmove(&buf[3], &buf[5], ".l", 2) == &buf[3 + 3 * 2]); assert(!strncmp(buf, "---.h.e.l.l.l.o-", 16)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], ".h.e.l.l.o")[0] = '-'; assert(libsimple_rawmemelemmove(&buf[8], &buf[5], ".o", 2) == &buf[8 + 5 * 2]); assert(!strncmp(buf, "-----.h..h.e.l.l.o-", 19)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], ".h.e.l.l.o")[0] = '-'; assert(libsimple_rawmemelemmove(&buf[8], &buf[5], ".l", 2) == &buf[8 + 3 * 2]); assert(!strncmp(buf, "-----.h..h.e.lo-", 16)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], "..h..e..l..l..o")[0] = '-'; assert(libsimple_rawmemelemmove(&buf[5], &buf[5], "..o", 3) == &buf[5 + 5 * 3]); assert(!strncmp(buf, "-----..h..e..l..l..o-", 21)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], "..h..e..l..l..o")[0] = '-'; assert(libsimple_rawmemelemmove(&buf[5], &buf[5], "..l", 3) == &buf[5 + 3 * 3]); assert(!strncmp(buf, "-----..h..e..l..l..o-", 21)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], "..h..e..l..l..o")[0] = '-'; assert(libsimple_rawmemelemmove(&buf[3], &buf[5], "..o", 3) == &buf[3 + 5 * 3]); assert(!strncmp(buf, "---..h..e..l..l..o.o-", 21)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], "..h..e..l..l..o")[0] = '-'; assert(libsimple_rawmemelemmove(&buf[3], &buf[5], "..l", 3) == &buf[3 + 3 * 3]); assert(!strncmp(buf, "---..h..e..l.l..l..o-", 21)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], "..h..e..l..l..o")[0] = '-'; assert(libsimple_rawmemelemmove(&buf[8], &buf[5], "..o", 3) == &buf[8 + 5 * 3]); assert(!strncmp(buf, "-----..h..h..e..l..l..o-", 24)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], "..h..e..l..l..o")[0] = '-'; assert(libsimple_rawmemelemmove(&buf[8], &buf[5], "..l", 3) == &buf[8 + 3 * 3]); assert(!strncmp(buf, "-----..h..h..e..l..o-", 21)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], "...h...e...l...l...o")[0] = '-'; assert(libsimple_rawmemelemmove(&buf[5], &buf[5], "...o", 4) == &buf[5 + 5 * 4]); assert(!strncmp(buf, "-----...h...e...l...l...o-", 26)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], "...h...e...l...l...o")[0] = '-'; assert(libsimple_rawmemelemmove(&buf[5], &buf[5], "...l", 4) == &buf[5 + 3 * 4]); assert(!strncmp(buf, "-----...h...e...l...l...o-", 26)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], "...h...e...l...l...o")[0] = '-'; assert(libsimple_rawmemelemmove(&buf[3], &buf[5], "...o", 4) == &buf[3 + 5 * 4]); assert(!strncmp(buf, "---...h...e...l...l...o.o-", 26)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], "...h...e...l...l...o")[0] = '-'; assert(libsimple_rawmemelemmove(&buf[3], &buf[5], "...l", 4) == &buf[3 + 3 * 4]); assert(!strncmp(buf, "---...h...e...l.l...l...o-", 26)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], "...h...e...l...l...o")[0] = '-'; assert(libsimple_rawmemelemmove(&buf[8], &buf[5], "...o", 4) == &buf[8 + 5 * 4]); assert(!strncmp(buf, "-----......h...e...l...l...o-", 29)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], "...h...e...l...l...o")[0] = '-'; assert(libsimple_rawmemelemmove(&buf[8], &buf[5], "...l", 4) == &buf[8 + 3 * 4]); assert(!strncmp(buf, "-----......h...e...ll...o-", 26)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], ".......h.......e.......l.......l.......o")[0] = '-'; assert(libsimple_rawmemelemmove(&buf[5], &buf[5], ".......o", 8) == &buf[5 + 5 * 8]); assert(!strncmp(buf, "-----.......h.......e.......l.......l.......o-", 46)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], ".......h.......e.......l.......l.......o")[0] = '-'; assert(libsimple_rawmemelemmove(&buf[5], &buf[5], ".......l", 8) == &buf[5 + 3 * 8]); assert(!strncmp(buf, "-----.......h.......e.......l.......l.......o-", 46)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], ".......h.......e.......l.......l.......o")[0] = '-'; assert(libsimple_rawmemelemmove(&buf[3], &buf[5], ".......o", 8) == &buf[3 + 5 * 8]); assert(!strncmp(buf, "---.......h.......e.......l.......l.......o.o-", 46)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], ".......h.......e.......l.......l.......o")[0] = '-'; assert(libsimple_rawmemelemmove(&buf[3], &buf[5], ".......l", 8) == &buf[3 + 3 * 8]); assert(!strncmp(buf, "---.......h.......e.......l.l.......l.......o-", 46)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], ".......h.......e.......l.......l.......o")[0] = '-'; assert(libsimple_rawmemelemmove(&buf[8], &buf[5], ".......o", 8) == &buf[8 + 5 * 8]); assert(!strncmp(buf, "-----..........h.......e.......l.......l.......o-", 49)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], ".......h.......e.......l.......l.......o")[0] = '-'; assert(libsimple_rawmemelemmove(&buf[8], &buf[5], ".......l", 8) == &buf[8 + 3 * 8]); assert(!strncmp(buf, "-----..........h.......e.......l....l.......o-", 46)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], ".a.a.aa..a")[0] = '-'; assert(libsimple_rawmemelemmove(&buf[5], &buf[5], "a.", 2) == &buf[5 + 4 * 2]); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], ".a.a.aa..a")[0] = '-'; assert(libsimple_rawmemelemmove(&buf[3], &buf[5], "a.", 2) == &buf[3 + 4 * 2]); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], ".a.a.aa..a")[0] = '-'; assert(libsimple_rawmemelemmove(&buf[8], &buf[5], "a.", 2) == &buf[8 + 4 * 2]); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], "..a..a..aa....a")[0] = '-'; assert(libsimple_rawmemelemmove(&buf[5], &buf[5], "a..", 3) == &buf[5 + 4 * 3]); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], "..a..a..aa....a")[0] = '-'; assert(libsimple_rawmemelemmove(&buf[3], &buf[5], "a..", 3) == &buf[3 + 4 * 3]); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], "..a..a..aa....a")[0] = '-'; assert(libsimple_rawmemelemmove(&buf[8], &buf[5], "a..", 3) == &buf[8 + 4 * 3]); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], "...a...a...aa......a")[0] = '-'; assert(libsimple_rawmemelemmove(&buf[5], &buf[5], "a...", 4) == &buf[5 + 4 * 4]); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], "...a...a...aa......a")[0] = '-'; assert(libsimple_rawmemelemmove(&buf[3], &buf[5], "a...", 4) == &buf[3 + 4 * 4]); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], "...a...a...aa......a")[0] = '-'; assert(libsimple_rawmemelemmove(&buf[8], &buf[5], "a...", 4) == &buf[8 + 4 * 4]); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], ".......a.......a.......aa..............a")[0] = '-'; assert(libsimple_rawmemelemmove(&buf[5], &buf[5], "a.......", 8) == &buf[5 + 4 * 8]); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], ".......a.......a.......aa..............a")[0] = '-'; assert(libsimple_rawmemelemmove(&buf[3], &buf[5], "a.......", 8) == &buf[3 + 4 * 8]); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], ".......a.......a.......aa..............a")[0] = '-'; assert(libsimple_rawmemelemmove(&buf[8], &buf[5], "a.......", 8) == &buf[8 + 4 * 8]); diff --git a/rawmemrcasechr.c b/rawmemrcasechr.c index de33b8f..d562279 100644 --- a/rawmemrcasechr.c +++ b/rawmemrcasechr.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/rawmemrcasechr_inv.c b/rawmemrcasechr_inv.c index 74ec992..63ef818 100644 --- a/rawmemrcasechr_inv.c +++ b/rawmemrcasechr_inv.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/rawmemrchr.c b/rawmemrchr.c index 80ddc41..7d08967 100644 --- a/rawmemrchr.c +++ b/rawmemrchr.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/rawmemrchr_inv.c b/rawmemrchr_inv.c index c6a9b22..b703ae7 100644 --- a/rawmemrchr_inv.c +++ b/rawmemrchr_inv.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/rawmemrelem.c b/rawmemrelem.c index 08e3377..699ce03 100644 --- a/rawmemrelem.c +++ b/rawmemrelem.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/rawmemrelem_inv.c b/rawmemrelem_inv.c index e39a271..25dc76b 100644 --- a/rawmemrelem_inv.c +++ b/rawmemrelem_inv.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/reallocarray.c b/reallocarray.c index 640e84a..d54e2eb 100644 --- a/reallocarray.c +++ b/reallocarray.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -42,14 +42,14 @@ main(void) assert(!alloc_fail_in); } -#if defined(__GNUC__) && !defined(__clang) +#if defined(__GNUC__) && !defined(__clang__) # pragma GCC diagnostic push # pragma GCC diagnostic ignored "-Walloc-size-larger-than=" #endif assert(!libsimple_reallocarray(NULL, SIZE_MAX, SIZE_MAX) && errno == ENOMEM); -#if defined(__GNUC__) && !defined(__clang) +#if defined(__GNUC__) && !defined(__clang__) # pragma GCC diagnostic pop #endif diff --git a/reallocarrayf.c b/reallocarrayf.c index f95c5ff..9d7e61e 100644 --- a/reallocarrayf.c +++ b/reallocarrayf.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/reallocfn.c b/reallocfn.c index b22b1c7..1432f78 100644 --- a/reallocfn.c +++ b/reallocfn.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/stpmove.c b/stpmove.c new file mode 100644 index 0000000..5457c21 --- /dev/null +++ b/stpmove.c @@ -0,0 +1,18 @@ +/* See LICENSE file for copyright and license details. */ +#include "common.h" +#ifndef TEST + + +extern inline char *libsimple_stpmove(char *, const char *); + + +#else +#include "test.h" + +int +main(void) +{ + return 0; +} + +#endif @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/stpntolower.c b/stpntolower.c index 86adb89..90e38d0 100644 --- a/stpntolower.c +++ b/stpntolower.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/stpntoupper.c b/stpntoupper.c index a434153..732a9d3 100644 --- a/stpntoupper.c +++ b/stpntoupper.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/stpset.c b/stpset.c new file mode 100644 index 0000000..4e5c134 --- /dev/null +++ b/stpset.c @@ -0,0 +1,18 @@ +/* See LICENSE file for copyright and license details. */ +#include "common.h" +#ifndef TEST + + +extern inline char *libsimple_stpset(char *, int); + + +#else +#include "test.h" + +int +main(void) +{ + return 0; +} + +#endif diff --git a/stptolower.c b/stptolower.c index 73259f9..7c21372 100644 --- a/stptolower.c +++ b/stptolower.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/stptoupper.c b/stptoupper.c index ee56b75..3b5f008 100644 --- a/stptoupper.c +++ b/stptoupper.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/strcasechr.c b/strcasechr.c index 83e8f73..3fe8ad1 100644 --- a/strcasechr.c +++ b/strcasechr.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/strcasechr_inv.c b/strcasechr_inv.c index 03e88c7..70e727c 100644 --- a/strcasechr_inv.c +++ b/strcasechr_inv.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/strcasechrnul.c b/strcasechrnul.c index 5afcd54..2a09862 100644 --- a/strcasechrnul.c +++ b/strcasechrnul.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/strcasechrnul_inv.c b/strcasechrnul_inv.c index 9c59d71..5a4c396 100644 --- a/strcasechrnul_inv.c +++ b/strcasechrnul_inv.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/strcasecmpnul.c b/strcasecmpnul.c new file mode 100644 index 0000000..b6a9b7a --- /dev/null +++ b/strcasecmpnul.c @@ -0,0 +1,18 @@ +/* See LICENSE file for copyright and license details. */ +#include "common.h" +#ifndef TEST + + +extern inline int libsimple_strcasecmpnul(const char *, const char *); + + +#else +#include "test.h" + +int +main(void) +{ + return 0; +} + +#endif diff --git a/strcaseends.c b/strcaseends.c index adbebe4..7980b98 100644 --- a/strcaseends.c +++ b/strcaseends.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/strcaseeq.c b/strcaseeq.c new file mode 100644 index 0000000..778c5b0 --- /dev/null +++ b/strcaseeq.c @@ -0,0 +1,18 @@ +/* See LICENSE file for copyright and license details. */ +#include "common.h" +#ifndef TEST + + +extern inline int libsimple_strcaseeq(const char *, const char *); + + +#else +#include "test.h" + +int +main(void) +{ + return 0; +} + +#endif diff --git a/strcaseeqlen.c b/strcaseeqlen.c index 625a3ad..256cb08 100644 --- a/strcaseeqlen.c +++ b/strcaseeqlen.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/strcaseeqnul.c b/strcaseeqnul.c new file mode 100644 index 0000000..a40aaf7 --- /dev/null +++ b/strcaseeqnul.c @@ -0,0 +1,18 @@ +/* See LICENSE file for copyright and license details. */ +#include "common.h" +#ifndef TEST + + +extern inline int libsimple_strcaseeqnul(const char *, const char *); + + +#else +#include "test.h" + +int +main(void) +{ + return 0; +} + +#endif diff --git a/strcasestarts.c b/strcasestarts.c new file mode 100644 index 0000000..7262f1e --- /dev/null +++ b/strcasestarts.c @@ -0,0 +1,18 @@ +/* See LICENSE file for copyright and license details. */ +#include "common.h" +#ifndef TEST + + +extern inline int libsimple_strcasestarts(const char *, const char *); + + +#else +#include "test.h" + +int +main(void) +{ + return 0; +} + +#endif diff --git a/strcasestr.c b/strcasestr.c index 071b7df..7449e64 100644 --- a/strcasestr.c +++ b/strcasestr.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/strccpy.c b/strccpy.c new file mode 100644 index 0000000..f4f7630 --- /dev/null +++ b/strccpy.c @@ -0,0 +1,18 @@ +/* See LICENSE file for copyright and license details. */ +#include "common.h" +#ifndef TEST + + +extern inline char *libsimple_strccpy(char *restrict, const char *restrict, int); + + +#else +#include "test.h" + +int +main(void) +{ + return 0; +} + +#endif diff --git a/strchr_inv.c b/strchr_inv.c index 4c1e242..13843f5 100644 --- a/strchr_inv.c +++ b/strchr_inv.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/strchrnul.c b/strchrnul.c index e4ed5ab..d22e761 100644 --- a/strchrnul.c +++ b/strchrnul.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/strchrnul_inv.c b/strchrnul_inv.c index 1f79eb3..26ff63d 100644 --- a/strchrnul_inv.c +++ b/strchrnul_inv.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -40,64 +40,76 @@ main(void) char buf[1024]; - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(&buf[5], "hello"); assert(libsimple_strcmove(&buf[5], &buf[5], '\0') == &buf[5 + 6]); assert(!strcmp(buf, "-----hello")); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(&buf[5], "hello"); assert(libsimple_strcmove(&buf[5], &buf[5], 'o') == &buf[5 + 5]); assert(!strcmp(buf, "-----hello")); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(&buf[5], "hello"); assert(libsimple_strcmove(&buf[5], &buf[5], 'l') == &buf[5 + 3]); assert(!strcmp(buf, "-----hel")); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(&buf[5], "hello"); assert(libsimple_strcmove(&buf[5], &buf[5], 'x') == NULL); assert(!strcmp(buf, "-----hello")); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(&buf[5], "hello"); assert(libsimple_strcmove(&buf[3], &buf[5], '\0') == &buf[3 + 6]); assert(!strcmp(buf, "---hello")); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(&buf[5], "hello"); assert(libsimple_strcmove(&buf[3], &buf[5], 'o') == &buf[3 + 5]); assert(!strcmp(buf, "---hello")); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(&buf[5], "hello"); assert(libsimple_strcmove(&buf[3], &buf[5], 'l') == &buf[3 + 3]); assert(!strcmp(buf, "---hel")); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(&buf[5], "hello"); assert(libsimple_strcmove(&buf[3], &buf[5], 'x') == NULL); assert(!strcmp(buf, "---hello")); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(&buf[5], "hello"); assert(libsimple_strcmove(&buf[8], &buf[5], '\0') == &buf[8 + 6]); assert(!strcmp(buf, "-----helhello")); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(&buf[5], "hello"); assert(libsimple_strcmove(&buf[8], &buf[5], 'o') == &buf[8 + 5]); assert(!strcmp(buf, "-----helhello")); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(&buf[5], "hello"); assert(libsimple_strcmove(&buf[8], &buf[5], 'l') == &buf[8 + 3]); assert(!strcmp(buf, "-----helhel")); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(&buf[5], "hello"); assert(libsimple_strcmove(&buf[8], &buf[5], 'x') == NULL); assert(!strcmp(buf, "-----helhello")); diff --git a/strcmpnul.c b/strcmpnul.c new file mode 100644 index 0000000..0a70610 --- /dev/null +++ b/strcmpnul.c @@ -0,0 +1,18 @@ +/* See LICENSE file for copyright and license details. */ +#include "common.h" +#ifndef TEST + + +extern inline int libsimple_strcmpnul(const char *, const char *); + + +#else +#include "test.h" + +int +main(void) +{ + return 0; +} + +#endif diff --git a/strend.c b/strend.c new file mode 100644 index 0000000..4754daf --- /dev/null +++ b/strend.c @@ -0,0 +1,18 @@ +/* See LICENSE file for copyright and license details. */ +#include "common.h" +#ifndef TEST + + +extern inline char *libsimple_strend(const char *); + + +#else +#include "test.h" + +int +main(void) +{ + return 0; +} + +#endif @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -0,0 +1,18 @@ +/* See LICENSE file for copyright and license details. */ +#include "common.h" +#ifndef TEST + + +extern inline int libsimple_streq(const char *, const char *); + + +#else +#include "test.h" + +int +main(void) +{ + return 0; +} + +#endif @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/streqnul.c b/streqnul.c new file mode 100644 index 0000000..b557a9a --- /dev/null +++ b/streqnul.c @@ -0,0 +1,18 @@ +/* See LICENSE file for copyright and license details. */ +#include "common.h" +#ifndef TEST + + +extern inline int libsimple_streqnul(const char *, const char *); + + +#else +#include "test.h" + +int +main(void) +{ + return 0; +} + +#endif diff --git a/strisutf8.c b/strisutf8.c new file mode 100644 index 0000000..ac0f4ca --- /dev/null +++ b/strisutf8.c @@ -0,0 +1,18 @@ +/* See LICENSE file for copyright and license details. */ +#include "common.h" +#ifndef TEST + + +extern inline int libsimple_strisutf8(const char *, int); + + +#else +#include "test.h" + +int +main(void) +{ + return 0; +} + +#endif diff --git a/strmove.c b/strmove.c new file mode 100644 index 0000000..bd1f89f --- /dev/null +++ b/strmove.c @@ -0,0 +1,18 @@ +/* See LICENSE file for copyright and license details. */ +#include "common.h" +#ifndef TEST + + +extern inline char *libsimple_strmove(char *, const char *); + + +#else +#include "test.h" + +int +main(void) +{ + return 0; +} + +#endif diff --git a/strncasechr.c b/strncasechr.c index 9ba2b93..526acc0 100644 --- a/strncasechr.c +++ b/strncasechr.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/strncasechr_inv.c b/strncasechr_inv.c index cd30867..80bff5d 100644 --- a/strncasechr_inv.c +++ b/strncasechr_inv.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/strncasechrnul.c b/strncasechrnul.c index 608f097..b49bf82 100644 --- a/strncasechrnul.c +++ b/strncasechrnul.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/strncasechrnul_inv.c b/strncasechrnul_inv.c index 6d6af35..0806195 100644 --- a/strncasechrnul_inv.c +++ b/strncasechrnul_inv.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/strncasecmpnul.c b/strncasecmpnul.c index f4a208c..e15bcfd 100644 --- a/strncasecmpnul.c +++ b/strncasecmpnul.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/strncaseends.c b/strncaseends.c index 708c16a..6d69acc 100644 --- a/strncaseends.c +++ b/strncaseends.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/strncaseeq.c b/strncaseeq.c index bd60472..4cec369 100644 --- a/strncaseeq.c +++ b/strncaseeq.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/strncaseeqlen.c b/strncaseeqlen.c index 56ace80..c70f1e7 100644 --- a/strncaseeqlen.c +++ b/strncaseeqlen.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/strncaseeqnul.c b/strncaseeqnul.c index 5330732..6a4c42e 100644 --- a/strncaseeqnul.c +++ b/strncaseeqnul.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/strncasestarts.c b/strncasestarts.c index d7c6350..f8646c9 100644 --- a/strncasestarts.c +++ b/strncasestarts.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/strncasestr.c b/strncasestr.c index 08adaf2..3543002 100644 --- a/strncasestr.c +++ b/strncasestr.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/strnchr_inv.c b/strnchr_inv.c index 7854d13..66f5238 100644 --- a/strnchr_inv.c +++ b/strnchr_inv.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/strnchrnul.c b/strnchrnul.c index 4e7e1b8..b6b3a39 100644 --- a/strnchrnul.c +++ b/strnchrnul.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/strnchrnul_inv.c b/strnchrnul_inv.c index a887221..8bbbdab 100644 --- a/strnchrnul_inv.c +++ b/strnchrnul_inv.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/strncmove.c b/strncmove.c index 1a03d2d..37b2bb4 100644 --- a/strncmove.c +++ b/strncmove.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -50,277 +50,329 @@ main(void) char buf[1024]; - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(&buf[5], "hello"); assert(libsimple_strncmove(&buf[5], &buf[5], '\0', 1024) == &buf[5 + 6]); assert(!strcmp(buf, "-----hello")); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(&buf[5], "hello"); assert(libsimple_strncmove(&buf[5], &buf[5], 'o', 1024) == &buf[5 + 5]); assert(!strcmp(buf, "-----hello")); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(&buf[5], "hello"); assert(libsimple_strncmove(&buf[5], &buf[5], 'l', 1024) == &buf[5 + 3]); assert(!strcmp(buf, "-----hel")); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(&buf[5], "hello"); assert(libsimple_strncmove(&buf[5], &buf[5], 'x', 1024) == NULL); assert(!strcmp(buf, "-----hello")); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(&buf[5], "hello"); assert(libsimple_strncmove(&buf[3], &buf[5], '\0', 1024) == &buf[3 + 6]); assert(!strcmp(buf, "---hello")); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(&buf[5], "hello"); assert(libsimple_strncmove(&buf[3], &buf[5], 'o', 1024) == &buf[3 + 5]); assert(!strcmp(buf, "---hello")); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(&buf[5], "hello"); assert(libsimple_strncmove(&buf[3], &buf[5], 'l', 1024) == &buf[3 + 3]); assert(!strcmp(buf, "---hel")); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(&buf[5], "hello"); assert(libsimple_strncmove(&buf[3], &buf[5], 'x', 1024) == NULL); assert(!strcmp(buf, "---hello")); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(&buf[5], "hello"); assert(libsimple_strncmove(&buf[8], &buf[5], '\0', 1024) == &buf[8 + 6]); assert(!strcmp(buf, "-----helhello")); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(&buf[5], "hello"); assert(libsimple_strncmove(&buf[8], &buf[5], 'o', 1024) == &buf[8 + 5]); assert(!strcmp(buf, "-----helhello")); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(&buf[5], "hello"); assert(libsimple_strncmove(&buf[8], &buf[5], 'l', 1024) == &buf[8 + 3]); assert(!strcmp(buf, "-----helhel")); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(&buf[5], "hello"); assert(libsimple_strncmove(&buf[8], &buf[5], 'x', 1024) == NULL); assert(!strcmp(buf, "-----helhello")); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(&buf[5], "hello"); assert(libsimple_strncmove(&buf[5], &buf[5], '\0', 6) == &buf[5 + 6]); assert(!strcmp(buf, "-----hello")); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(&buf[5], "hello"); assert(libsimple_strncmove(&buf[5], &buf[5], 'o', 6) == &buf[5 + 5]); assert(!strcmp(buf, "-----hello")); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(&buf[5], "hello"); assert(libsimple_strncmove(&buf[5], &buf[5], 'l', 6) == &buf[5 + 3]); assert(!strcmp(buf, "-----hel")); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(&buf[5], "hello"); assert(libsimple_strncmove(&buf[5], &buf[5], 'x', 6) == NULL); assert(!strcmp(buf, "-----hello")); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(&buf[5], "hello"); assert(libsimple_strncmove(&buf[3], &buf[5], '\0', 6) == &buf[3 + 6]); assert(!strcmp(buf, "---hello")); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(&buf[5], "hello"); assert(libsimple_strncmove(&buf[3], &buf[5], 'o', 6) == &buf[3 + 5]); assert(!strcmp(buf, "---hello")); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(&buf[5], "hello"); assert(libsimple_strncmove(&buf[3], &buf[5], 'l', 6) == &buf[3 + 3]); assert(!strcmp(buf, "---hel")); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(&buf[5], "hello"); assert(libsimple_strncmove(&buf[3], &buf[5], 'x', 6) == NULL); assert(!strcmp(buf, "---hello")); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(&buf[5], "hello"); assert(libsimple_strncmove(&buf[8], &buf[5], '\0', 6) == &buf[8 + 6]); assert(!strcmp(buf, "-----helhello")); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(&buf[5], "hello"); assert(libsimple_strncmove(&buf[8], &buf[5], 'o', 6) == &buf[8 + 5]); assert(!strcmp(buf, "-----helhello")); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(&buf[5], "hello"); assert(libsimple_strncmove(&buf[8], &buf[5], 'l', 6) == &buf[8 + 3]); assert(!strcmp(buf, "-----helhel")); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(&buf[5], "hello"); assert(libsimple_strncmove(&buf[8], &buf[5], 'x', 6) == NULL); assert(!strcmp(buf, "-----helhello")); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], "hello")[0] = '-'; assert(libsimple_strncmove(&buf[5], &buf[5], '\0', 5) == NULL); assert(!strncmp(buf, "-----hello-", 11)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], "hello")[0] = '-'; assert(libsimple_strncmove(&buf[5], &buf[5], 'o', 5) == &buf[5 + 5]); assert(!strncmp(buf, "-----hello-", 11)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], "hello")[0] = '-'; assert(libsimple_strncmove(&buf[5], &buf[5], 'l', 5) == &buf[5 + 3]); assert(!strcmp(buf, "-----hel")); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; stpcpy(&buf[5], "hello")[0] = '-'; assert(libsimple_strncmove(&buf[5], &buf[5], 'x', 5) == NULL); assert(!strncmp(buf, "-----hello-", 11)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(&buf[5], "hello"); assert(libsimple_strncmove(&buf[5], &buf[5], '\0', 5) == NULL); assert(!strcmp(buf, "-----hello")); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(&buf[5], "hello"); assert(libsimple_strncmove(&buf[5], &buf[5], 'o', 5) == &buf[5 + 5]); assert(!strcmp(buf, "-----hello")); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(&buf[5], "hello"); assert(libsimple_strncmove(&buf[5], &buf[5], 'l', 5) == &buf[5 + 3]); assert(!strcmp(buf, "-----hel")); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(&buf[5], "hello"); assert(libsimple_strncmove(&buf[5], &buf[5], 'x', 5) == NULL); assert(!strcmp(buf, "-----hello")); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(&buf[5], "hello"); assert(libsimple_strncmove(&buf[3], &buf[5], '\0', 5) == NULL); assert(!strcmp(buf, "---hellolo")); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(&buf[5], "hello"); assert(libsimple_strncmove(&buf[3], &buf[5], 'o', 5) == &buf[3 + 5]); assert(!strcmp(buf, "---hellolo")); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(&buf[5], "hello"); assert(libsimple_strncmove(&buf[3], &buf[5], 'l', 5) == &buf[3 + 3]); assert(!strcmp(buf, "---hel")); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(&buf[5], "hello"); assert(libsimple_strncmove(&buf[3], &buf[5], 'x', 5) == NULL); assert(!strcmp(buf, "---hellolo")); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(&buf[5], "hello"); assert(libsimple_strncmove(&buf[8], &buf[5], '\0', 5) == NULL); assert(!strncmp(buf, "-----helhello-", 14)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(&buf[5], "hello"); assert(libsimple_strncmove(&buf[8], &buf[5], 'o', 5) == &buf[8 + 5]); assert(!strncmp(buf, "-----helhello-", 14)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(&buf[5], "hello"); assert(libsimple_strncmove(&buf[8], &buf[5], 'l', 5) == &buf[8 + 3]); assert(!strcmp(buf, "-----helhel")); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(&buf[5], "hello"); assert(libsimple_strncmove(&buf[8], &buf[5], 'x', 5) == NULL); assert(!strncmp(buf, "-----helhello-", 14)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(&buf[5], "hello"); assert(libsimple_strncmove(&buf[5], &buf[5], '\0', 3) == NULL); assert(!strcmp(buf, "-----hello")); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(&buf[5], "hello"); assert(libsimple_strncmove(&buf[5], &buf[5], 'o', 3) == NULL); assert(!strcmp(buf, "-----hello")); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(&buf[5], "hello"); assert(libsimple_strncmove(&buf[5], &buf[5], 'l', 3) == &buf[5 + 3]); assert(!strcmp(buf, "-----hello")); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(&buf[5], "hello"); assert(libsimple_strncmove(&buf[5], &buf[5], 'x', 3) == NULL); assert(!strcmp(buf, "-----hello")); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(&buf[5], "hello"); assert(libsimple_strncmove(&buf[3], &buf[5], '\0', 3) == NULL); assert(!strcmp(buf, "---helello")); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(&buf[5], "hello"); assert(libsimple_strncmove(&buf[3], &buf[5], 'o', 3) == NULL); assert(!strcmp(buf, "---helello")); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(&buf[5], "hello"); assert(libsimple_strncmove(&buf[3], &buf[5], 'l', 3) == &buf[3 + 3]); assert(!strcmp(buf, "---helello")); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(&buf[5], "hello"); assert(libsimple_strncmove(&buf[3], &buf[5], 'x', 3) == NULL); assert(!strcmp(buf, "---helello")); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(&buf[5], "hello"); assert(libsimple_strncmove(&buf[8], &buf[5], '\0', 3) == NULL); assert(!strncmp(buf, "-----helhel-", 12)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(&buf[5], "hello"); assert(libsimple_strncmove(&buf[8], &buf[5], 'o', 3) == NULL); assert(!strncmp(buf, "-----helhel-", 12)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(&buf[5], "hello"); assert(libsimple_strncmove(&buf[8], &buf[5], 'l', 3) == &buf[8 + 3]); assert(!strncmp(buf, "-----helhel-", 12)); - memset(buf, '-', sizeof(buf)), buf[sizeof(buf) - 1] = '\0'; + memset(buf, '-', sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; strcpy(&buf[5], "hello"); assert(libsimple_strncmove(&buf[8], &buf[5], 'x', 3) == NULL); assert(!strncmp(buf, "-----helhel-", 12)); diff --git a/strncmpnul.c b/strncmpnul.c index 05751a1..a5c9d7a 100644 --- a/strncmpnul.c +++ b/strncmpnul.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/strneqlen.c b/strneqlen.c index 5ef50e3..09d3b8f 100644 --- a/strneqlen.c +++ b/strneqlen.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/strneqnul.c b/strneqnul.c index 191c2d4..b21fbe2 100644 --- a/strneqnul.c +++ b/strneqnul.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/strnisutf8.c b/strnisutf8.c index c62817c..dc76fd5 100644 --- a/strnisutf8.c +++ b/strnisutf8.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/strnreplace.c b/strnreplace.c index 9e735fb..f8a2036 100644 --- a/strnreplace.c +++ b/strnreplace.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/strnstarts.c b/strnstarts.c index 727cf3e..1fbeed3 100644 --- a/strnstarts.c +++ b/strnstarts.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/strntolower.c b/strntolower.c index f88aac5..0dcad2a 100644 --- a/strntolower.c +++ b/strntolower.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/strntoupper.c b/strntoupper.c index 58d8a0c..801a7f3 100644 --- a/strntoupper.c +++ b/strntoupper.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/strrcasechr.c b/strrcasechr.c index 979e61b..26abb7e 100644 --- a/strrcasechr.c +++ b/strrcasechr.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/strrcasechr_inv.c b/strrcasechr_inv.c index 5572a38..091779d 100644 --- a/strrcasechr_inv.c +++ b/strrcasechr_inv.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/strrcaseeqlen.c b/strrcaseeqlen.c new file mode 100644 index 0000000..d5176a1 --- /dev/null +++ b/strrcaseeqlen.c @@ -0,0 +1,18 @@ +/* See LICENSE file for copyright and license details. */ +#include "common.h" +#ifndef TEST + + +extern inline size_t libsimple_strrcaseeqlen(const char *, const char *); + + +#else +#include "test.h" + +int +main(void) +{ + return 0; +} + +#endif diff --git a/strrcasestr.c b/strrcasestr.c index 3a3edce..7a17051 100644 --- a/strrcasestr.c +++ b/strrcasestr.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/strrchr_inv.c b/strrchr_inv.c index 37b7e79..eb93c0e 100644 --- a/strrchr_inv.c +++ b/strrchr_inv.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/strreplace.c b/strreplace.c new file mode 100644 index 0000000..f32da11 --- /dev/null +++ b/strreplace.c @@ -0,0 +1,18 @@ +/* See LICENSE file for copyright and license details. */ +#include "common.h" +#ifndef TEST + + +extern inline char *libsimple_strreplace(char *, int, int); + + +#else +#include "test.h" + +int +main(void) +{ + return 0; +} + +#endif diff --git a/strreqlen.c b/strreqlen.c new file mode 100644 index 0000000..29f85fc --- /dev/null +++ b/strreqlen.c @@ -0,0 +1,18 @@ +/* See LICENSE file for copyright and license details. */ +#include "common.h" +#ifndef TEST + + +extern inline size_t libsimple_strreqlen(const char *, const char *); + + +#else +#include "test.h" + +int +main(void) +{ + return 0; +} + +#endif diff --git a/strrncasechr.c b/strrncasechr.c index f4046d1..60ab4ac 100644 --- a/strrncasechr.c +++ b/strrncasechr.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/strrncasechr_inv.c b/strrncasechr_inv.c index eb68b49..a471420 100644 --- a/strrncasechr_inv.c +++ b/strrncasechr_inv.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/strrncaseeqlen.c b/strrncaseeqlen.c index 82b1db3..5963afc 100644 --- a/strrncaseeqlen.c +++ b/strrncaseeqlen.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/strrncasestr.c b/strrncasestr.c index f1874c7..be57822 100644 --- a/strrncasestr.c +++ b/strrncasestr.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/strrnchr_inv.c b/strrnchr_inv.c index fe657f9..060d3b0 100644 --- a/strrnchr_inv.c +++ b/strrnchr_inv.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/strrneqlen.c b/strrneqlen.c index 913b359..b5f56b4 100644 --- a/strrneqlen.c +++ b/strrneqlen.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/strset.c b/strset.c new file mode 100644 index 0000000..2c62c0d --- /dev/null +++ b/strset.c @@ -0,0 +1,18 @@ +/* See LICENSE file for copyright and license details. */ +#include "common.h" +#ifndef TEST + + +extern inline char *libsimple_strset(char *, int); + + +#else +#include "test.h" + +int +main(void) +{ + return 0; +} + +#endif diff --git a/strstarts.c b/strstarts.c index b476222..321d3c5 100644 --- a/strstarts.c +++ b/strstarts.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST #define RET_MAX 32767LL @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST #define RET_MAX 2147483647LL @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST #define RET_MAX 9223372036854775807LL @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST #define RET_MAX 127LL diff --git a/strtolower.c b/strtolower.c new file mode 100644 index 0000000..34006d7 --- /dev/null +++ b/strtolower.c @@ -0,0 +1,18 @@ +/* See LICENSE file for copyright and license details. */ +#include "common.h" +#ifndef TEST + + +extern inline char *libsimple_strtolower(char *, const char *); + + +#else +#include "test.h" + +int +main(void) +{ + return 0; +} + +#endif diff --git a/strtotimespec.c b/strtotimespec.c index 7c1494e..eb02112 100644 --- a/strtotimespec.c +++ b/strtotimespec.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/strtotimeval.c b/strtotimeval.c index 0305fb9..1e3dc9b 100644 --- a/strtotimeval.c +++ b/strtotimeval.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST #define RET_MAX 65535ULL @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST #define RET_MAX 4294967295ULL @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST #define RET_MAX 18446744073709551615ULL @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST #define RET_MAX 255ULL @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/strtoupper.c b/strtoupper.c new file mode 100644 index 0000000..ce7c147 --- /dev/null +++ b/strtoupper.c @@ -0,0 +1,18 @@ +/* See LICENSE file for copyright and license details. */ +#include "common.h" +#ifndef TEST + + +extern inline char *libsimple_strtoupper(char *, const char *); + + +#else +#include "test.h" + +int +main(void) +{ + return 0; +} + +#endif @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/sumtimespec.c b/sumtimespec.c index 2b2e935..b9dfdd6 100644 --- a/sumtimespec.c +++ b/sumtimespec.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -47,62 +47,82 @@ main(void) { struct timespec r, a, b; - a.tv_sec = 0, a.tv_nsec = 0; - b.tv_sec = 0, b.tv_nsec = 0; + a.tv_sec = 0; + a.tv_nsec = 0; + b.tv_sec = 0; + b.tv_nsec = 0; assert(!libsimple_sumtimespec(&r, &a, &b)); assert(r.tv_sec == 0); assert(r.tv_nsec == 0); - a.tv_sec = 10, a.tv_nsec = 10000L; - b.tv_sec = 0, b.tv_nsec = 0L; + a.tv_sec = 10; + a.tv_nsec = 10000L; + b.tv_sec = 0; + b.tv_nsec = 0L; assert(!libsimple_sumtimespec(&r, &a, &b)); assert(r.tv_sec == 10); assert(r.tv_nsec == 10000L); - a.tv_sec = 10, a.tv_nsec = 10000L; - b.tv_sec = -10, b.tv_nsec = 0L; + a.tv_sec = 10; + a.tv_nsec = 10000L; + b.tv_sec = -10; + b.tv_nsec = 0L; assert(!libsimple_sumtimespec(&r, &a, &b)); assert(r.tv_sec == 0); assert(r.tv_nsec == 10000L); - a.tv_sec = 10, a.tv_nsec = 10000L; - b.tv_sec = -20, b.tv_nsec = 20000L; + a.tv_sec = 10; + a.tv_nsec = 10000L; + b.tv_sec = -20; + b.tv_nsec = 20000L; assert(!libsimple_sumtimespec(&r, &a, &b)); assert(r.tv_sec == -10); assert(r.tv_nsec == 30000L); - a.tv_sec = 1, a.tv_nsec = 999999999L; - b.tv_sec = 1, b.tv_nsec = 1L; + a.tv_sec = 1; + a.tv_nsec = 999999999L; + b.tv_sec = 1; + b.tv_nsec = 1L; assert(!libsimple_sumtimespec(&r, &a, &b)); assert(r.tv_sec == 3); assert(r.tv_nsec == 0L); - a.tv_sec = TIME_MAX, a.tv_nsec = 0L; - b.tv_sec = TIME_MAX, b.tv_nsec = 0L; + a.tv_sec = TIME_MAX; + a.tv_nsec = 0L; + b.tv_sec = TIME_MAX; + b.tv_nsec = 0L; assert(libsimple_sumtimespec(&r, &a, &b) == -1); assert(r.tv_sec == TIME_MAX); assert(r.tv_nsec == 999999999L); - a.tv_sec = TIME_MAX, a.tv_nsec = 999999999L; - b.tv_sec = 0, b.tv_nsec = 1L; + a.tv_sec = TIME_MAX; + a.tv_nsec = 999999999L; + b.tv_sec = 0; + b.tv_nsec = 1L; assert(libsimple_sumtimespec(&r, &a, &b) == -1); assert(r.tv_sec == TIME_MAX); assert(r.tv_nsec == 999999999L); - a.tv_sec = TIME_MAX, a.tv_nsec = 1L; - b.tv_sec = 0, b.tv_nsec = 999999999L; + a.tv_sec = TIME_MAX; + a.tv_nsec = 1L; + b.tv_sec = 0; + b.tv_nsec = 999999999L; assert(libsimple_sumtimespec(&r, &a, &b) == -1); assert(r.tv_sec == TIME_MAX); assert(r.tv_nsec == 999999999L); - a.tv_sec = TIME_MIN, a.tv_nsec = 0L; - b.tv_sec = TIME_MIN, b.tv_nsec = 0L; + a.tv_sec = TIME_MIN; + a.tv_nsec = 0L; + b.tv_sec = TIME_MIN; + b.tv_nsec = 0L; assert(libsimple_sumtimespec(&r, &a, &b) == -1); assert(r.tv_sec == TIME_MIN); assert(r.tv_nsec == 0L); - a.tv_sec = TIME_MIN, a.tv_nsec = 100L; - b.tv_sec = TIME_MIN, b.tv_nsec = 100L; + a.tv_sec = TIME_MIN; + a.tv_nsec = 100L; + b.tv_sec = TIME_MIN; + b.tv_nsec = 100L; assert(libsimple_sumtimespec(&r, &a, &b) == -1); assert(r.tv_sec == TIME_MIN); assert(r.tv_nsec == 0L); diff --git a/sumtimeval.c b/sumtimeval.c index 09cadb1..5cc01ac 100644 --- a/sumtimeval.c +++ b/sumtimeval.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #include "test.h" #include <sys/syscall.h> @@ -337,7 +337,7 @@ test_vfprintf(FILE *restrict stream, const char *restrict format, va_list ap) va_list ap2; int r; char *buf; - size_t n; + size_t i, n; va_copy(ap2, ap); r = vsnprintf(NULL, 0, format, ap2); @@ -353,7 +353,8 @@ test_vfprintf(FILE *restrict stream, const char *restrict format, va_list ap) } else { assert(stderr_ok); assert(stderr_n + n <= sizeof(stderr_buf)); - memcpy((char *)(void *)(&stderr_buf[stderr_n]), buf, n); + for (i = 0; i < n; i++) + stderr_buf[stderr_n + i] = buf[i]; stderr_n += n; } free(buf); @@ -1,6 +1,18 @@ /* See LICENSE file for copyright and license details. */ +#if defined(__GNUC__) && !defined(__clang__) +# pragma GCC diagnostic ignored "-Wunsuffixed-float-constants" +# pragma GCC diagnostic ignored "-Wformat-nonliteral" +#endif + +#if defined(__clang__) +# pragma clang diagnostic ignored "-Wformat-nonliteral" +# pragma clang diagnostic ignored "-Wdisabled-macro-expansion" +# pragma clang diagnostic ignored "-Walloca" +#endif + + #define assert(EXPR)\ do {\ if (EXPR)\ @@ -48,10 +60,14 @@ do {\ char buf__[1024];\ int len__;\ + size_t i__;\ + int not_same__ = 0;\ len__ = sprintf(buf__, __VA_ARGS__);\ assert(len__ >= 0);\ assert((size_t)len__ == stderr_n);\ - assert(!memcmp(buf__, (char **)(void *)(&stderr_buf), stderr_n)); \ + for (i__ = 0; i__ < stderr_n; i__++)\ + not_same__ |= buf__[i__] ^ stderr_buf[i__];\ + assert(!not_same__);\ } while (0) diff --git a/timespec2timeval.c b/timespec2timeval.c index e71585a..c7ab175 100644 --- a/timespec2timeval.c +++ b/timespec2timeval.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/timespectodouble.c b/timespectodouble.c index e2d1bcc..325709b 100644 --- a/timespectodouble.c +++ b/timespectodouble.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/timespectostr.c b/timespectostr.c index bd99fe1..9440620 100644 --- a/timespectostr.c +++ b/timespectostr.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/timeval2timespec.c b/timeval2timespec.c index e7e529e..4d2a71f 100644 --- a/timeval2timespec.c +++ b/timeval2timespec.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/timevaltodouble.c b/timevaltodouble.c index 1d3dacb..d8bf8d9 100644 --- a/timevaltodouble.c +++ b/timevaltodouble.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/timevaltostr.c b/timevaltostr.c index 702b46b..daa2ff0 100644 --- a/timevaltostr.c +++ b/timevaltostr.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/valigned_allocn.c b/valigned_allocn.c index 8f4faf3..0fa84ac 100644 --- a/valigned_allocn.c +++ b/valigned_allocn.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/valigned_reallocfn.c b/valigned_reallocfn.c index fcafcd6..3c116b4 100644 --- a/valigned_reallocfn.c +++ b/valigned_reallocfn.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/vasprintf.c b/vasprintf.c index fd14650..65c494e 100644 --- a/vasprintf.c +++ b/vasprintf.c @@ -1,7 +1,11 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST +#if defined(__clang__) +# pragma clang diagnostic ignored "-Wformat-nonliteral" +#endif + int libsimple_vasprintf(char **strp, const char *fmt, va_list ap) @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/venprintf.c b/venprintf.c index 1657954..a8a39aa 100644 --- a/venprintf.c +++ b/venprintf.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/vmemalignn.c b/vmemalignn.c index 40abfb6..f0eae81 100644 --- a/vmemalignn.c +++ b/vmemalignn.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/vmemalignzn.c b/vmemalignzn.c index a0983e7..8ae1831 100644 --- a/vmemalignzn.c +++ b/vmemalignzn.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/vmemalloc.c b/vmemalloc.c index cbaecea..450affb 100644 --- a/vmemalloc.c +++ b/vmemalloc.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #include <stdalign.h> #ifndef TEST diff --git a/vposix_memalignn.c b/vposix_memalignn.c index 6001cdc..9179b09 100644 --- a/vposix_memalignn.c +++ b/vposix_memalignn.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,7 +1,11 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST +#if defined(__clang__) +# pragma clang diagnostic ignored "-Wformat-nonliteral" +#endif + int libsimple_vputenvf(const char *fmt, va_list ap) diff --git a/vpvallocn.c b/vpvallocn.c index 2a17882..f90224c 100644 --- a/vpvallocn.c +++ b/vpvallocn.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/vpvalloczn.c b/vpvalloczn.c index 0aad778..3f3fbc1 100644 --- a/vpvalloczn.c +++ b/vpvalloczn.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/vreallocfn.c b/vreallocfn.c index fcd9c84..1aa770d 100644 --- a/vreallocfn.c +++ b/vreallocfn.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/vvalloczn.c b/vvalloczn.c index c387583..d3e1b55 100644 --- a/vvalloczn.c +++ b/vvalloczn.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST diff --git a/vweprintf.c b/vweprintf.c index 9c93037..f684553 100644 --- a/vweprintf.c +++ b/vweprintf.c @@ -1,7 +1,11 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST +#if defined(__clang__) +# pragma clang diagnostic ignored "-Wformat-nonliteral" +#endif + extern char *argv0; @@ -32,8 +36,15 @@ libsimple_vweprintf(const char *fmt, va_list ap) va_copy(ap2, ap); r = vsnprintf(NULL, 0, fmt, ap1); if (0 <= r && r < 8096) { +#if defined(__clang__) +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Walloca" +#endif message = alloca((size_t)r + 1); vsprintf(message, fmt, ap2); +#if defined(__clang__) +# pragma clang diagnostic pop +#endif } va_end(ap2); va_end(ap1); @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST |