diff options
author | Mattias Andrée <maandree@kth.se> | 2024-08-18 10:04:07 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2024-08-18 10:04:07 +0200 |
commit | 68337473cca8523ebf657109598ff82ff4ba794c (patch) | |
tree | aefc13183c04fc527f67b25c6b14d651488110cb | |
parent | Add @since for definitions added in version 1.4 (diff) | |
parent | Fix return value for libsimple_{local,gm}time.c (diff) | |
download | libsimple-68337473cca8523ebf657109598ff82ff4ba794c.tar.gz libsimple-68337473cca8523ebf657109598ff82ff4ba794c.tar.bz2 libsimple-68337473cca8523ebf657109598ff82ff4ba794c.tar.xz |
Merge tag '1.5' into since
Version 1.5
-rw-r--r-- | LICENSE | 2 | ||||
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | gmtime.c | 1 | ||||
-rw-r--r-- | libsimple/array.h | 16 | ||||
-rw-r--r-- | localtime.c | 1 |
5 files changed, 16 insertions, 6 deletions
@@ -1,6 +1,6 @@ ISC License -© 2017, 2018, 2021, 2022, 2023 Mattias Andrée <maandree@kth.se> +© 2017, 2018, 2021, 2022, 2023, 2024 Mattias Andrée <maandree@kth.se> Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above @@ -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 @@ -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/libsimple/array.h b/libsimple/array.h index 2016540..ae347f9 100644 --- a/libsimple/array.h +++ b/libsimple/array.h @@ -130,14 +130,14 @@ /* @since 1.1 */ -#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 /* @since 1.1 */ -#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 @@ -190,3 +190,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 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)) |