From e74de6938b5e3c0da101d5bbb0866fda1e4a330d Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sun, 17 Dec 2023 19:30:55 +0100 Subject: Fix libsimple_arrayset and libsimple_arraypset and add libsimple_arrayfill and libsimple_arraynull MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- libsimple/array.h | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/libsimple/array.h b/libsimple/array.h index b17966b..5530e24 100644 --- a/libsimple/array.h +++ b/libsimple/array.h @@ -111,13 +111,13 @@ #endif -#define libsimple_arrayset(buf, item, n) libsimple_memsetelem(buf, item, (n) * sizeof *(buf)) +#define libsimple_arrayset(buf, item, n) libsimple_memsetelem(buf, item, sizeof *(buf), n) #ifndef arrayset # define arrayset(...) libsimple_arrayset(__VA_ARGS__) #endif -#define libsimple_arraypset(buf, item, n) libsimple_mempsetelem(buf, item, (n) * sizeof *(buf)) +#define libsimple_arraypset(buf, item, n) libsimple_mempsetelem(buf, item, sizeof *(buf), n) #ifndef arraypset # define arraypset(...) libsimple_arraypset(__VA_ARGS__) #endif @@ -163,3 +163,15 @@ #ifndef arrayreplace # define arrayreplace(...) libsimple_arrayreplace(__VA_ARGS__) #endif + + +#define libsimple_arrayfill(buf, item) libsimple_memsetelem(buf, item, sizeof *(buf), sizeof (buf) / sizeof *(buf)) +#ifndef arrayfill +# define arrayfill(...) libsimple_arrayfill(__VA_ARGS__) +#endif + + +#define libsimple_arraynull(buf) libsimple_memsetelem(buf, (void *)0, sizeof *(buf), sizeof (buf) / sizeof *(buf)) +#ifndef arraynull +# define arraynull(...) libsimple_arraynull(__VA_ARGS__) +#endif -- cgit v1.2.3-70-g09d2 From 7af14d14fbc2faec9a5a50dc77a2d8ecf3747ec0 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sun, 17 Dec 2023 19:31:37 +0100 Subject: Update VERSION_MINOR MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 1a86fa7..63843ae 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,7 @@ include mk/$(OS).mk LIB_MAJOR = 1 -LIB_MINOR = 4 +LIB_MINOR = 5 LIB_VERSION = $(LIB_MAJOR).$(LIB_MINOR) LIB_NAME = simple -- cgit v1.2.3-70-g09d2 From 5386671eec7de485801b747b91e77828d20fa03f Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Wed, 10 Jan 2024 21:37:19 +0100 Subject: Fix return value for libsimple_{local,gm}time.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- LICENSE | 2 +- gmtime.c | 1 - localtime.c | 1 - 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/LICENSE b/LICENSE index 68df9b2..b29e37d 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ ISC License -© 2017, 2018, 2021, 2022, 2023 Mattias Andrée +© 2017, 2018, 2021, 2022, 2023, 2024 Mattias Andrée Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above diff --git a/gmtime.c b/gmtime.c index 7a84289..2fc1915 100644 --- a/gmtime.c +++ b/gmtime.c @@ -26,7 +26,6 @@ libsimple_gmtime(struct tm *tm, struct timespec *ts) if (!gmtime_r(&timex.time.tv_sec, tm)) return -1; tm->tm_sec += 1; - return 1; } else if (r == TIME_DEL) { timex.time.tv_sec += 1; if (!gmtime_r(&timex.time.tv_sec, tm)) diff --git a/localtime.c b/localtime.c index 96bd1e1..dd4acc2 100644 --- a/localtime.c +++ b/localtime.c @@ -26,7 +26,6 @@ libsimple_localtime(struct tm *tm, struct timespec *ts) if (!localtime_r(&timex.time.tv_sec, tm)) return -1; tm->tm_sec += 1; - return 1; } else if (r == TIME_DEL) { timex.time.tv_sec += 1; if (!localtime_r(&timex.time.tv_sec, tm)) -- cgit v1.2.3-70-g09d2