aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libsimple-arg.h38
-rw-r--r--libsimple.h20
-rw-r--r--libsimple/aligned_alloc.h16
-rw-r--r--libsimple/aligned_allocz.h18
-rw-r--r--libsimple/aligned_memdup.h8
-rw-r--r--libsimple/aligned_realloc.h32
-rw-r--r--libsimple/aligned_strdup.h8
-rw-r--r--libsimple/aligned_strndup.h8
-rw-r--r--libsimple/aligned_wcsdup.h8
-rw-r--r--libsimple/aligned_wcsndup.h8
-rw-r--r--libsimple/aligned_wmemdup.h8
-rw-r--r--libsimple/array.h27
-rw-r--r--libsimple/calloc.h16
-rw-r--r--libsimple/definitions.h28
-rw-r--r--libsimple/env.h16
-rw-r--r--libsimple/malloc.h16
-rw-r--r--libsimple/mallocz.h18
-rw-r--r--libsimple/mem.h92
-rw-r--r--libsimple/memalign.h18
-rw-r--r--libsimple/memalignz.h18
-rw-r--r--libsimple/memalloc.h20
-rw-r--r--libsimple/memdup.h8
-rw-r--r--libsimple/memelem.h34
-rw-r--r--libsimple/overflow.h64
-rw-r--r--libsimple/posix_memalign.h16
-rw-r--r--libsimple/posix_memalignz.h18
-rw-r--r--libsimple/printf.h26
-rw-r--r--libsimple/pvalloc.h18
-rw-r--r--libsimple/pvallocz.h18
-rw-r--r--libsimple/realloc.h30
-rw-r--r--libsimple/search.h4
-rw-r--r--libsimple/str.h84
-rw-r--r--libsimple/strdup.h6
-rw-r--r--libsimple/strn.h86
-rw-r--r--libsimple/strndup.h6
-rw-r--r--libsimple/strtoint.h32
-rw-r--r--libsimple/time.h38
-rw-r--r--libsimple/valloc.h18
-rw-r--r--libsimple/vallocz.h18
-rw-r--r--libsimple/wcsdup.h6
-rw-r--r--libsimple/wcsndup.h8
-rw-r--r--libsimple/wmemdup.h8
42 files changed, 977 insertions, 10 deletions
diff --git a/libsimple-arg.h b/libsimple-arg.h
index 6aa3c2a..3662b70 100644
--- a/libsimple-arg.h
+++ b/libsimple-arg.h
@@ -19,6 +19,8 @@
/**
* The zeroth command line argument, the name of the process,
* set by the command line parsing macros
+ *
+ * @since 1.0
*/
extern char *argv0;
@@ -32,6 +34,8 @@ extern char *argv0;
* where `.long_flag` does not end with '=' and
* `.with_arg` is zero. These *cannot* have the same
* `.short_flag`
+ *
+ * @since 1.0
*/
struct longopt {
/**
@@ -101,6 +105,8 @@ struct longopt {
* // print usage information for other flags
* usage();
* } ARGEND;
+ *
+ * @since 1.0
*/
#define ARGBEGIN ARGBEGIN2(1, 0)
@@ -109,6 +115,8 @@ struct longopt {
* `ARGBEGIN {} ARGEND;`, however, `argv0`
* is not set to `argv[0]`, instead `argv[0]`
* is handled like any other element in `argv`
+ *
+ * @since 1.0
*/
#define SUBARGBEGIN ARGBEGIN2(0, 0)
@@ -120,6 +128,8 @@ struct longopt {
* @param KEEP_DASHDASH If and only if 0, "--" is not removed
* `argv` before parsing is stopped when it
* is encountered
+ *
+ * @since 1.1
*/
#define ARGBEGIN2(WITH_ARGV0, KEEP_DASHDASH)\
do {\
@@ -164,6 +174,8 @@ struct longopt {
*
* @param LONGOPTS:struct longopt * The options, list shall end
* with `NULL` as `.long_flag`
+ *
+ * @since 1.0
*/
#define ARGMAPLONG(LONGOPTS)\
for (i_ = 0; (LONGOPTS)[i_].long_flag; i_++) {\
@@ -198,6 +210,8 @@ struct longopt {
* } ARGEND;
*
* @param SYMBOL:char The symbol flags should begin with
+ *
+ * @since 1.0
*/
#define ARGALT(SYMBOL)\
}\
@@ -222,7 +236,9 @@ struct longopt {
switch (flag_) {
/**
- * Refer to `ARGBEGIN`, `SUBARGBEGIN`, and `ARGBEGIN4`
+ * Refer to `ARGBEGIN`, `SUBARGBEGIN`, and `ARGBEGIN2`
+ *
+ * @since 1.0
*/
#define ARGEND\
}\
@@ -243,6 +259,8 @@ struct longopt {
/**
* `case ARGNUM` creates a switch statement case for each digit
+ *
+ * @since 1.0
*/
#define ARGNUM '0': case '1': case '2': case '3': case '4':\
case '5': case '6': case '7': case '8': case '9'
@@ -252,6 +270,8 @@ struct longopt {
* 'a' is returned
*
* @return :char The option's identifying character
+ *
+ * @since 1.0
*/
#define FLAG() (flag_)
@@ -263,6 +283,8 @@ struct longopt {
* value can also be in the next argument
*
* @return :char * The current command line argument
+ *
+ * @since 1.0
*/
#define LFLAG() (lflag_)
@@ -275,6 +297,8 @@ struct longopt {
* that the option has a value
*
* @return :char * The option's value, never `NULL`
+ *
+ * @since 1.0
*/
#define ARG() (arg_ ? (brk_ = 1, arg_) : (usage(), NULL))
@@ -291,6 +315,8 @@ struct longopt {
*
* @return :char * The option's value, `NULL` if
* the option does not have a value
+ *
+ * @since 1.1
*/
#define ARGNULL() (arg_ ? (brk_ = 1, arg_) : NULL)
@@ -326,6 +352,8 @@ struct longopt {
*
* @return :char * The option's value include the flag
* character, never `NULL` or ""
+ *
+ * @since 1.0
*/
#define ARGHERE() (brk_ = 1, argv[0])
@@ -355,6 +383,8 @@ struct longopt {
* must not have side-effects
* @param WARG:int Whether the option takes an argument,
* should not have side-effects
+ *
+ * @since 1.0
*/
#define TESTLONG(FLG, WARG)\
((WARG)\
@@ -386,6 +416,8 @@ struct longopt {
*
* @param ... If non-zero, the `usage` function
* will be called
+ *
+ * @since 1.0
*/
#define NOFLAGS(...)\
do {\
@@ -412,6 +444,8 @@ struct longopt {
* This macro also defines `char *argv0`
*
* @param SYNOPSIS:const char * Description of the command line argument syntax
+ *
+ * @since 1.0
*/
#define USAGE(SYNOPSIS)\
NUSAGE(1, SYNOPSIS)
@@ -440,6 +474,8 @@ struct longopt {
*
* @param SYNOPSIS:const char * Description of the command line argument syntax
* @parma STATUS:int The exit value for the process
+ *
+ * @since 1.0
*/
#define NUSAGE(STATUS, SYNOPSIS)\
static LIBSIMPLE_NORETURN__ void\
diff --git a/libsimple.h b/libsimple.h
index f4238cb..430dbe0 100644
--- a/libsimple.h
+++ b/libsimple.h
@@ -176,6 +176,8 @@
* be update to -1 if it is non-negative
* @return Return value of close(3) (0 on success,
* -1 on error), 0 if `*fdp < 0`
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__)))
inline int
@@ -200,6 +202,8 @@ libsimple_close(int *fdp__)
* @param list:non-void pointer The list
* @param i:size_t The index of the item to remove
* @param n:size_t Pointer to the number of items in the list, will be updated
+ *
+ * @since 1.0
*/
#define LIBSIMPLE_UNLIST(LIST, I, NP) libsimple_unlist((LIST), (I), (NP), sizeof(*(LIST)))
#ifndef UNLIST
@@ -214,6 +218,8 @@ libsimple_close(int *fdp__)
* @param i The index of the item to remove
* @param n Pointer to the number of items in the list, will be updated
* @param width The width, in bytes, of each item in the list
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__)))
inline void
@@ -228,20 +234,20 @@ libsimple_unlist(void *list__, size_t i__, size_t *np__, size_t width__)
#define LIBSIMPLE_REMOVE_CONST__(X, TYPE, ...) (*(TYPE *)(void *)&(X))
-#define LIBSIMPLE_REMOVE_CONST(...) LIBSIMPLE_REMOVE_CONST__(__VA_ARGS__, void *) /* TODO test, doc, man */
+#define LIBSIMPLE_REMOVE_CONST(...) LIBSIMPLE_REMOVE_CONST__(__VA_ARGS__, void *) /* TODO test, doc, man (since 1.2) */
#ifndef REMOVE_CONST
# define REMOVE_CONST(...) LIBSIMPLE_REMOVE_CONST(__VA_ARGS__)
#endif
-#define LIBSIMPLE_PREFETCH_RDONLY(ADDRESS, LOCALITY) /* void */ /* TODO test, doc, man */\
+#define LIBSIMPLE_PREFETCH_RDONLY(ADDRESS, LOCALITY) /* void */ /* TODO test, doc, man (since 1.2) */\
LIBSIMPLE_GCC_ONLY__(__builtin_prefetch(ADDRESS, 0, LOCALITY))
#ifndef PREFETCH_RDONLY
# define PREFETCH_RDONLY(...) LIBSIMPLE_PREFETCH_RDONLY(__VA_ARGS__)
#endif
-#define LIBSIMPLE_PREFETCH_RDWR(ADDRESS, LOCALITY) /* void */ /* TODO test, doc, man */\
+#define LIBSIMPLE_PREFETCH_RDWR(ADDRESS, LOCALITY) /* void */ /* TODO test, doc, man (since 1.2) */\
LIBSIMPLE_GCC_ONLY__(__builtin_prefetch(ADDRESS, 1, LOCALITY))
#ifndef PREFETCH_RDWR
# define PREFETCH_RDWR(...) LIBSIMPLE_PREFETCH_RDWR(__VA_ARGS__)
@@ -251,7 +257,7 @@ 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))\
LIBSIMPLE_NON_GCC_ONLY__(PTR)
-#define LIBSIMPLE_ASSUME_ALIGNED(PTR, ...) /* returns PTR */ /* TODO test, doc, man */\
+#define LIBSIMPLE_ASSUME_ALIGNED(PTR, ...) /* returns PTR */ /* TODO test, doc, man (since 1.2) */\
LIBSIMPLE_ASSUME_ALIGNED__(PTR, ##__VA_ARGS__, LIBSIMPLE_C11_ONLY__(_Alignof(*PTR)) /* no , */\
LIBSIMPLE_PRE_C11_ONLY__(__alignof(*PTR)))
#ifndef ASSUME_ALIGNED
@@ -259,20 +265,20 @@ libsimple_unlist(void *list__, size_t i__, size_t *np__, size_t width__)
#endif
-#define LIBSIMPLE_ASSUME_MISALIGNED(PTR, ALIGNMENT, OFFSET) /* returns PTR */ /* TODO test, doc, man */\
+#define LIBSIMPLE_ASSUME_MISALIGNED(PTR, ALIGNMENT, OFFSET) /* returns PTR */ /* TODO test, doc, man (since 1.2) */\
__builtin_assume_aligned(PTR, ALIGNMENT, OFFSET)
#ifndef ASSUME_MISALIGNED
# define ASSUME_MISALIGNED(...) LIBSIMPLE_ASSUME_MISALIGNED(__VA_ARGS__)
#endif
-#define LIBSIMPLE_UNROLLED(N) LIBSIMPLE_GCC_ONLY__(LIBSIMPLE_C11_ONLY__(_Pragma("GCC unroll "#N))) /* TODO test, doc, man */
+#define LIBSIMPLE_UNROLLED(N) LIBSIMPLE_GCC_ONLY__(LIBSIMPLE_C11_ONLY__(_Pragma("GCC unroll "#N))) /* TODO test, doc, man (since 1.2) */
#ifndef UNROLLED
# define UNROLLED(N) LIBSIMPLE_UNROLLED(N)
#endif
-#define LIBSIMPLE_SIMDLOOP LIBSIMPLE_GCC_ONLY__(LIBSIMPLE_C11_ONLY__(_Pragma("GCC ivdep"))) /* TODO test, doc, man */
+#define LIBSIMPLE_SIMDLOOP LIBSIMPLE_GCC_ONLY__(LIBSIMPLE_C11_ONLY__(_Pragma("GCC ivdep"))) /* TODO test, doc, man (since 1.2) */
#ifndef SIMDLOOP
# define SIMDLOOP LIBSIMPLE_SIMDLOOP
#endif
diff --git a/libsimple/aligned_alloc.h b/libsimple/aligned_alloc.h
index 6916b9a..9e05533 100644
--- a/libsimple/aligned_alloc.h
+++ b/libsimple/aligned_alloc.h
@@ -18,6 +18,8 @@
* and alignment; `NULL` on failure
* @throws EINVAL `n` is 0 or `alignment` is not a power of 2
* @throws ENOMEM Could not allocated enough memory
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __alloc_align__(1), __warn_unused_result__)))
inline void *
@@ -40,6 +42,8 @@ libsimple_valigned_allocn(size_t alignment__, size_t n__, va_list ap__)
* and alignment; `NULL` on failure
* @throws EINVAL `n` is 0 or `alignment` is not a power of 2
* @throws ENOMEM Could not allocated enough memory
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __alloc_align__(1), __warn_unused_result__)))
inline void *
@@ -69,6 +73,8 @@ libsimple_aligned_allocn(size_t alignment__, size_t n__, ... /*, (size_t)0 */)
* this function is unspecified for the value 0
* @return A unique pointer with at least the specified size
* and alignment
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __alloc_align__(2), __alloc_size__(3), __warn_unused_result__, __returns_nonnull__)))
inline void *
@@ -101,6 +107,8 @@ libsimple_enaligned_alloc(int status__, size_t alignment__, size_t n__)
* list must end with 0 (which is not factor)
* @return A unique pointer with at least the specified size
* and alignment
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __alloc_align__(2), __warn_unused_result__, __returns_nonnull__)))
inline void *
@@ -133,6 +141,8 @@ libsimple_envaligned_allocn(int status__, size_t alignment__, size_t n__, va_lis
* list must end with 0 (which is not factor)
* @return A unique pointer with at least the specified size
* and alignment
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __alloc_align__(2), __warn_unused_result__, __returns_nonnull__)))
inline void *
@@ -161,6 +171,8 @@ libsimple_enaligned_allocn(int status__, size_t alignment__, size_t n__, ... /*,
* this function is unspecified for the value 0
* @return A unique pointer with at least the specified size
* and alignment
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __alloc_align__(1), __alloc_size__(2), __warn_unused_result__, __returns_nonnull__)))
inline void *
@@ -192,6 +204,8 @@ libsimple_ealigned_alloc(size_t alignment__, size_t n__)
* list must end with 0 (which is not factor)
* @return A unique pointer with at least the specified size
* and alignment
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __alloc_align__(1), __warn_unused_result__, __returns_nonnull__)))
inline void *
@@ -223,6 +237,8 @@ libsimple_evaligned_allocn(size_t alignment__, size_t n__, va_list ap__)
* list must end with 0 (which is not factor)
* @return A unique pointer with at least the specified size
* and alignment
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __alloc_align__(1), __warn_unused_result__, __returns_nonnull__)))
inline void *
diff --git a/libsimple/aligned_allocz.h b/libsimple/aligned_allocz.h
index b27a17b..ea65c40 100644
--- a/libsimple/aligned_allocz.h
+++ b/libsimple/aligned_allocz.h
@@ -19,6 +19,8 @@
* and alignment; `NULL` on failure
* @throws EINVAL `n` is 0 or `alignment` is not a power of 2
* @throws ENOMEM Could not allocated enough memory
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __alloc_align__(2), __warn_unused_result__)))
void *libsimple_valigned_alloczn(int, size_t, size_t, va_list);
@@ -39,6 +41,8 @@ void *libsimple_valigned_alloczn(int, size_t, size_t, va_list);
* and alignment; `NULL` on failure
* @throws EINVAL `n` is 0 or `alignment` is not a power of 2
* @throws ENOMEM Could not allocated enough memory
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __alloc_align__(2), __alloc_size__(3), __warn_unused_result__)))
inline void *
@@ -72,6 +76,8 @@ libsimple_aligned_allocz(int clear__, size_t alignment__, size_t n__)
* and alignment; `NULL` on failure
* @throws EINVAL `n` is 0 or `alignment` is not a power of 2
* @throws ENOMEM Could not allocated enough memory
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __alloc_align__(2), __warn_unused_result__)))
inline void *
@@ -102,6 +108,8 @@ libsimple_aligned_alloczn(int clear__, size_t alignment__, size_t n__, ... /*, (
* this function is unspecified for the value 0
* @return A unique pointer with at least the specified size
* and alignment
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __alloc_align__(3), __alloc_size__(4), __warn_unused_result__, __returns_nonnull__)))
void *libsimple_enaligned_allocz(int, int, size_t, size_t);
@@ -131,6 +139,8 @@ void *libsimple_enaligned_allocz(int, int, size_t, size_t);
* list must end with 0 (which is not factor)
* @return A unique pointer with at least the specified size
* and alignment
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __alloc_align__(3), __warn_unused_result__, __returns_nonnull__)))
void *libsimple_envaligned_alloczn(int, int, size_t, size_t, va_list);
@@ -160,6 +170,8 @@ void *libsimple_envaligned_alloczn(int, int, size_t, size_t, va_list);
* list must end with 0 (which is not factor)
* @return A unique pointer with at least the specified size
* and alignment
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __alloc_align__(3), __warn_unused_result__, __returns_nonnull__)))
inline void *
@@ -188,6 +200,8 @@ libsimple_enaligned_alloczn(int status__, int clear__, size_t alignment__, size_
* this function is unspecified for the value 0
* @return A unique pointer with at least the specified size
* and alignment
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __alloc_align__(2), __alloc_size__(3), __warn_unused_result__, __returns_nonnull__)))
inline void *
@@ -220,6 +234,8 @@ libsimple_ealigned_allocz(int clear__, size_t alignment__, size_t n__)
* list must end with 0 (which is not factor)
* @return A unique pointer with at least the specified size
* and alignment
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __alloc_align__(2), __warn_unused_result__, __returns_nonnull__)))
inline void *
@@ -252,6 +268,8 @@ libsimple_evaligned_alloczn(int clear__, size_t alignment__, size_t n__, va_list
* list must end with 0 (which is not factor)
* @return A unique pointer with at least the specified size
* and alignment
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __alloc_align__(2), __warn_unused_result__, __returns_nonnull__)))
inline void *
diff --git a/libsimple/aligned_memdup.h b/libsimple/aligned_memdup.h
index 6cb9415..1bea686 100644
--- a/libsimple/aligned_memdup.h
+++ b/libsimple/aligned_memdup.h
@@ -8,6 +8,8 @@
* @param alignment:size_t The alignment of the returned pointer
* @param n:size_t The number of bytes to copy
* @return :void * Duplicate of `s` with automatic storage
+ *
+ * @since 1.1
*/
#if defined(__GNUC__) || defined(__clang__)
# define libsimple_aligned_memdupa(s, alignment, n)\
@@ -40,6 +42,8 @@
* @param alignment The alignment of the returned pointer
* @param n The number of bytes to copy
* @return Duplicate of `s`, `NULL` on failure
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__alloc_align__(2), __alloc_size__(3), __nonnull__, __warn_unused_result__)))
void *libsimple_aligned_memdup(const void *, size_t, size_t);
@@ -56,6 +60,8 @@ void *libsimple_aligned_memdup(const void *, size_t, size_t);
* @param alignment The alignment of the returned pointer
* @param n The number of bytes to copy
* @return Duplicate of `s`
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__alloc_align__(3), __alloc_size__(4), __warn_unused_result__, __returns_nonnull__)))
void *libsimple_enaligned_memdup(int, const void *, size_t, size_t);
@@ -71,6 +77,8 @@ void *libsimple_enaligned_memdup(int, const void *, size_t, size_t);
* @param alignment The alignment of the returned pointer
* @param n The number of bytes to copy
* @return Duplicate of `s`
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__alloc_align__(2), __alloc_size__(3), __warn_unused_result__, __returns_nonnull__)))
inline void *
diff --git a/libsimple/aligned_realloc.h b/libsimple/aligned_realloc.h
index 0c81cd7..10238ba 100644
--- a/libsimple/aligned_realloc.h
+++ b/libsimple/aligned_realloc.h
@@ -26,6 +26,8 @@
* @throws EINVAL `alignment` is not a valid alignment
* @throws ENOMEM Could not allocated enough memory
* @throws ENOSYS Not implemented (requires non-standard libc functions)
+ *
+ * @since 1.2
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__alloc_align__(2), __alloc_size__(3), __warn_unused_result__)))
#if defined(__GLIBC__)
@@ -88,6 +90,8 @@ libsimple_aligned_realloc(void *ptr__, size_t alignment__, size_t n__)
* this function is unspecified for the value 0
* @return Either `ptr` or a unique pointer with at least
* the specified size
+ *
+ * @since 1.2
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__alloc_align__(3), __alloc_size__(4), __warn_unused_result__, __returns_nonnull__)))
void *libsimple_enaligned_realloc(int, void *, size_t, size_t);
@@ -120,6 +124,8 @@ void *libsimple_enaligned_realloc(int, void *, size_t, size_t);
* this function is unspecified for the value 0
* @return Either `ptr` or a unique pointer with at least
* the specified size
+ *
+ * @since 1.2
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__alloc_align__(2), __alloc_size__(3), __warn_unused_result__, __returns_nonnull__)))
inline void *
@@ -157,6 +163,8 @@ libsimple_ealigned_realloc(void *ptr__, size_t alignment__, size_t n__)
* @throws EINVAL `n` is 0
* @throws EINVAL `alignment` is not a valid alignment
* @throws ENOMEM Could not allocated enough memory
+ *
+ * @since 1.2
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__alloc_align__(2), __alloc_size__(3), __warn_unused_result__)))
inline void *
@@ -200,6 +208,8 @@ libsimple_aligned_reallocf(void *ptr__, size_t alignment__, size_t n__)
* @throws EINVAL `alignment` is not a valid alignment
* @throws ENOMEM Could not allocated enough memory
* @throws ENOSYS Not implemented (requires non-standard libc functions)
+ *
+ * @since 1.2
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__alloc_align__(2), __alloc_size__(3, 4), __warn_unused_result__)))
inline void *
@@ -244,6 +254,8 @@ libsimple_aligned_reallocarray(void *ptr__, size_t alignment__, size_t n__, size
* this function is unspecified for the value 0
* @return Either `ptr` or a unique pointer with at least
* the specified size
+ *
+ * @since 1.2
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__alloc_align__(3), __alloc_size__(4, 5), __warn_unused_result__, __returns_nonnull__)))
void *libsimple_enaligned_reallocarray(int, void *, size_t, size_t, size_t);
@@ -280,6 +292,8 @@ void *libsimple_enaligned_reallocarray(int, void *, size_t, size_t, size_t);
* this function is unspecified for the value 0
* @return Either `ptr` or a unique pointer with at least
* the specified size
+ *
+ * @since 1.2
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__alloc_align__(2), __alloc_size__(3, 4), __warn_unused_result__, __returns_nonnull__)))
inline void *
@@ -316,6 +330,8 @@ libsimple_ealigned_reallocarray(void *ptr__, size_t alignment__, size_t n__, siz
* @throws EINVAL `alignment` is not a valid alignment
* @throws ENOMEM Could not allocated enough memory
* @throws ENOSYS Not implemented (requires non-standard libc functions)
+ *
+ * @since 1.2
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__alloc_align__(2), __alloc_size__(3, 4), __warn_unused_result__)))
inline void *
@@ -360,6 +376,8 @@ libsimple_aligned_reallocarrayf(void *ptr__, size_t alignment__, size_t n__, siz
* @throws EINVAL `alignment` is not a valid alignment
* @throws ENOMEM Could not allocated enough memory
* @throws ENOSYS Not implemented (requires non-standard libc functions)
+ *
+ * @since 1.2
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__alloc_align__(2), __warn_unused_result__)))
void *libsimple_valigned_reallocn(void *, size_t, size_t, va_list);
@@ -398,6 +416,8 @@ void *libsimple_valigned_reallocn(void *, size_t, size_t, va_list);
* list must end with 0 (which is not factor)
* @return Either `ptr` or a unique pointer with at least
* the specified size
+ *
+ * @since 1.2
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__alloc_align__(3), __warn_unused_result__, __returns_nonnull__)))
void *libsimple_envaligned_reallocn(int, void *, size_t, size_t, va_list);
@@ -435,6 +455,8 @@ void *libsimple_envaligned_reallocn(int, void *, size_t, size_t, va_list);
* list must end with 0 (which is not factor)
* @return Either `ptr` or a unique pointer with at least
* the specified size
+ *
+ * @since 1.2
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__alloc_align__(2), __warn_unused_result__, __returns_nonnull__)))
inline void *
@@ -472,6 +494,8 @@ libsimple_evaligned_reallocn(void *ptr__, size_t alignment__, size_t n__, va_lis
* @throws EINVAL `alignment` is not a valid alignment
* @throws ENOMEM Could not allocated enough memory
* @throws ENOSYS Not implemented (requires non-standard libc functions)
+ *
+ * @since 1.2
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__alloc_align__(2), __warn_unused_result__)))
inline void *
@@ -516,6 +540,8 @@ libsimple_valigned_reallocfn(void *ptr__, size_t alignment__, size_t n__, va_lis
* @throws EINVAL `alignment` is not a valid alignment
* @throws ENOMEM Could not allocated enough memory
* @throws ENOSYS Not implemented (requires non-standard libc functions)
+ *
+ * @since 1.2
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__alloc_align__(2), __warn_unused_result__)))
inline void *
@@ -561,6 +587,8 @@ libsimple_aligned_reallocn(void *ptr__, size_t alignment__, size_t n__, ... /*,
* list must end with 0 (which is not factor)
* @return Either `ptr` or a unique pointer with at least
* the specified size
+ *
+ * @since 1.2
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__alloc_align__(3), __warn_unused_result__, __returns_nonnull__)))
inline void *
@@ -605,6 +633,8 @@ libsimple_enaligned_reallocn(int status__, void *ptr__, size_t alignment__, size
* list must end with 0 (which is not factor)
* @return Either `ptr` or a unique pointer with at least
* the specified size
+ *
+ * @since 1.2
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__alloc_align__(2), __warn_unused_result__, __returns_nonnull__)))
inline void *
@@ -649,6 +679,8 @@ libsimple_ealigned_reallocn(void *ptr__, size_t alignment__, size_t n__, ... /*,
* @throws EINVAL `alignment` is not a valid alignment
* @throws ENOMEM Could not allocated enough memory
* @throws ENOSYS Not implemented (requires non-standard libc functions)
+ *
+ * @since 1.2
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__alloc_align__(2), __warn_unused_result__)))
inline void *
diff --git a/libsimple/aligned_strdup.h b/libsimple/aligned_strdup.h
index 2488f96..a69669d 100644
--- a/libsimple/aligned_strdup.h
+++ b/libsimple/aligned_strdup.h
@@ -7,6 +7,8 @@
* @param s:const char * The string to copy
* @param alignment:size_t The alignment of the returned pointer
* @return :char * Duplicate of `s` with automatic storage
+ *
+ * @since 1.2
*/
#if defined(__GNUC__) || defined(__clang__)
# define libsimple_aligned_strdupa(s, alignment)\
@@ -36,6 +38,8 @@
* @param s The string to copy
* @param alignment The alignment of the returned pointer
* @return Duplicate of `s`, `NULL` on failure
+ *
+ * @since 1.2
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __alloc_align__(2), __nonnull__, __warn_unused_result__)))
inline char *
@@ -55,6 +59,8 @@ libsimple_aligned_strdup(const char *s__, size_t alignment__)
* @param s The string to copy
* @param alignment The alignment of the returned pointer
* @return Duplicate of `s`
+ *
+ * @since 1.2
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __alloc_align__(3), __nonnull__, __warn_unused_result__, __returns_nonnull__)))
char *libsimple_enaligned_strdup(int, const char *, size_t);
@@ -69,6 +75,8 @@ char *libsimple_enaligned_strdup(int, const char *, size_t);
* @param s The string to copy
* @param alignment The alignment of the returned pointer
* @return Duplicate of `s`
+ *
+ * @since 1.2
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __alloc_align__(2), __nonnull__, __warn_unused_result__, __returns_nonnull__)))
inline char *
diff --git a/libsimple/aligned_strndup.h b/libsimple/aligned_strndup.h
index 84f2218..d5b85fd 100644
--- a/libsimple/aligned_strndup.h
+++ b/libsimple/aligned_strndup.h
@@ -8,6 +8,8 @@
* @param alignment:size_t The alignment of the returned pointer
* @param n:size_t The maximum number of bytes to copy
* @return :char * Duplicate of `s` with automatic storage
+ *
+ * @since 1.2
*/
#if defined(__GNUC__) || defined(__clang__)
# define libsimple_aligned_strndupa(s, alignment, n)\
@@ -40,6 +42,8 @@
* @param alignment The alignment of the returned pointer
* @param n The maximum number of bytes to copy
* @return Duplicate of `s`, `NULL` on failure
+ *
+ * @since 1.2
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __alloc_align__(2), __nonnull__, __warn_unused_result__)))
char *libsimple_aligned_strndup(const char * s__, size_t alignment__, size_t n__);
@@ -56,6 +60,8 @@ char *libsimple_aligned_strndup(const char * s__, size_t alignment__, size_t n__
* @param alignment The alignment of the returned pointer
* @param n The maximum number of bytes to copy
* @return Duplicate of `s`
+ *
+ * @since 1.2
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __alloc_align__(3), __nonnull__, __warn_unused_result__, __returns_nonnull__)))
char *libsimple_enaligned_strndup(int, const char *, size_t, size_t);
@@ -71,6 +77,8 @@ char *libsimple_enaligned_strndup(int, const char *, size_t, size_t);
* @param alignment The alignment of the returned pointer
* @param n The maximum number of bytes to copy
* @return Duplicate of `s`
+ *
+ * @since 1.2
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __alloc_align__(2), __nonnull__, __warn_unused_result__, __returns_nonnull__)))
inline char *
diff --git a/libsimple/aligned_wcsdup.h b/libsimple/aligned_wcsdup.h
index 3b33338..2ea0579 100644
--- a/libsimple/aligned_wcsdup.h
+++ b/libsimple/aligned_wcsdup.h
@@ -7,6 +7,8 @@
* @param s:const wchar_t * The string to copy
* @param alignment:size_t The alignment of the returned pointer
* @return :wchar_t * Duplicate of `s` with automatic storage
+ *
+ * @since 1.2
*/
#if defined(__GNUC__) || defined(__clang__)
# define libsimple_aligned_wcsdupa(s, alignment)\
@@ -36,6 +38,8 @@
* @param s The string to copy
* @param alignment The alignment of the returned pointer
* @return Duplicate of `s`, `NULL` on failure
+ *
+ * @since 1.2
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __alloc_align__(2), __nonnull__, __warn_unused_result__)))
inline wchar_t *
@@ -55,6 +59,8 @@ libsimple_aligned_wcsdup(const wchar_t *s__, size_t alignment__)
* @param s The string to copy
* @param alignment The alignment of the returned pointer
* @return Duplicate of `s`
+ *
+ * @since 1.2
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __alloc_align__(3), __nonnull__, __warn_unused_result__, __returns_nonnull__)))
wchar_t *libsimple_enaligned_wcsdup(int, const wchar_t *, size_t);
@@ -69,6 +75,8 @@ wchar_t *libsimple_enaligned_wcsdup(int, const wchar_t *, size_t);
* @param s The string to copy
* @param alignment The alignment of the returned pointer
* @return Duplicate of `s`
+ *
+ * @since 1.2
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __alloc_align__(2), __nonnull__, __warn_unused_result__, __returns_nonnull__)))
inline wchar_t *
diff --git a/libsimple/aligned_wcsndup.h b/libsimple/aligned_wcsndup.h
index a5d2641..faae22d 100644
--- a/libsimple/aligned_wcsndup.h
+++ b/libsimple/aligned_wcsndup.h
@@ -8,6 +8,8 @@
* @param alignment:size_t The alignment of the returned pointer
* @param n:size_t The maximum number of wide characters to copy
* @return :wchar_t * Duplicate of `s` with automatic storage
+ *
+ * @since 1.2
*/
#if defined(__GNUC__) || defined(__clang__)
# define libsimple_aligned_wcsndupa(s, alignment, n)\
@@ -40,6 +42,8 @@
* @param alignment The alignment of the returned pointer
* @param n The maximum number of wide characters to copy
* @return Duplicate of `s`, `NULL` on failure
+ *
+ * @since 1.2
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __alloc_align__(2), __nonnull__, __warn_unused_result__)))
wchar_t *libsimple_aligned_wcsndup(const wchar_t * s__, size_t alignment__, size_t n__);
@@ -56,6 +60,8 @@ wchar_t *libsimple_aligned_wcsndup(const wchar_t * s__, size_t alignment__, size
* @param alignment The alignment of the returned pointer
* @param n The maximum number of wide characters to copy
* @return Duplicate of `s`
+ *
+ * @since 1.2
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __alloc_align__(3), __nonnull__, __warn_unused_result__, __returns_nonnull__)))
wchar_t *libsimple_enaligned_wcsndup(int, const wchar_t *, size_t, size_t);
@@ -71,6 +77,8 @@ wchar_t *libsimple_enaligned_wcsndup(int, const wchar_t *, size_t, size_t);
* @param alignment The alignment of the returned pointer
* @param n The maximum number of wide characters to copy
* @return Duplicate of `s`
+ *
+ * @since 1.2
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __alloc_align__(2), __nonnull__, __warn_unused_result__, __returns_nonnull__)))
inline wchar_t *
diff --git a/libsimple/aligned_wmemdup.h b/libsimple/aligned_wmemdup.h
index 51f00a9..e6e68d9 100644
--- a/libsimple/aligned_wmemdup.h
+++ b/libsimple/aligned_wmemdup.h
@@ -8,6 +8,8 @@
* @param alignment:size_t The alignment of the returned pointer
* @param n:size_t The number of wide characters to copy
* @return :wchar_t * Duplicate of `s` with automatic storage
+ *
+ * @since 1.2
*/
#if defined(__GNUC__) || defined(__clang__)
# define libsimple_aligned_wmemdupa(s, alignment, n)\
@@ -40,6 +42,8 @@
* @param alignment The alignment of the returned pointer
* @param n The number of wide characters to copy
* @return Duplicate of `s`, `NULL` on failure
+ *
+ * @since 1.2
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __alloc_align__(2), __alloc_size__(3), __nonnull__, __warn_unused_result__)))
wchar_t *libsimple_aligned_wmemdup(const wchar_t *, size_t, size_t);
@@ -56,6 +60,8 @@ wchar_t *libsimple_aligned_wmemdup(const wchar_t *, size_t, size_t);
* @param alignment The alignment of the returned pointer
* @param n The number of wide characters to copy
* @return Duplicate of `s`
+ *
+ * @since 1.2
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __alloc_align__(3), __alloc_size__(4), __warn_unused_result__, __returns_nonnull__)))
wchar_t *libsimple_enaligned_wmemdup(int, const wchar_t *, size_t, size_t);
@@ -71,6 +77,8 @@ wchar_t *libsimple_enaligned_wmemdup(int, const wchar_t *, size_t, size_t);
* @param alignment The alignment of the returned pointer
* @param n The number of wide characters to copy
* @return Duplicate of `s`
+ *
+ * @since 1.2
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __alloc_align__(2), __alloc_size__(3), __warn_unused_result__, __returns_nonnull__)))
inline wchar_t *
diff --git a/libsimple/array.h b/libsimple/array.h
index 5530e24..ae347f9 100644
--- a/libsimple/array.h
+++ b/libsimple/array.h
@@ -3,162 +3,189 @@
/* TODO test, doc, man */
+/* @since 1.1 */
#define libsimple_arraydupa(array, alignment, n) libsimple_aligned_memdupa(array, _Alignof(*(array)), n)
#ifndef aligned_arraydupa
# define aligned_arraydupa(...) libsimple_aligned_arraydupa(__VA_ARGS__)
#endif
+/* @since 1.1 */
#define libsimple_arraydup(array, n) libsimple_aligned_memdup(array, _Alignof(*(array)), n)
#ifndef arraydup
# define arraydup(...) libsimple_arraydup(__VA_ARGS__)
#endif
+/* @since 1.1 */
#define libsimple_earraydup(array, n) libsimple_ealigned_memdup(array, _Alignof(*(array)), n)
#ifndef earraydup
# define earraydup(...) libsimple_earraydup(__VA_ARGS__)
#endif
+/* @since 1.1 */
#define libsimple_enarraydup(status, array, n) libsimple_enaligned_memdup(status, array, _Alignof(*(array)), n)
#ifndef enarraydup
# define enarraydup(...) libsimple_enarraydup(__VA_ARGS__)
#endif
+/* @since 1.1 */
#define libsimple_aligned_arraydupa(array, alignment, n) libsimple_aligned_memdupa(array, alignment, n)
#ifndef aligned_arraydupa
# define aligned_arraydupa(...) libsimple_aligned_arraydupa(__VA_ARGS__)
#endif
+/* @since 1.1 */
#define libsimple_aligned_arraydup(array, alignment, n) libsimple_aligned_memdup(array, alignment, n)
#ifndef aligned_arraydup
# define aligned_arraydup(...) libsimple_aligned_arraydup(__VA_ARGS__)
#endif
+/* @since 1.1 */
#define libsimple_ealigned_arraydup(array, alignment, n) libsimple_ealigned_memdup(array, alignment, n)
#ifndef ealigned_arraydup
# define ealigned_arraydup(...) libsimple_ealigned_arraydup(__VA_ARGS__)
#endif
+/* @since 1.1 */
#define libsimple_enaligned_arraydup(status, array, alignment, n) libsimple_enaligned_memdup(status, array, alignment, n)
#ifndef enaligned_arraydup
# define enaligned_arraydup(...) libsimple_enaligned_arraydup(__VA_ARGS__)
#endif
+/* @since 1.1 */
#define libsimple_arrayelem(haystack, needle, n) libsimple_memelem(haystack, needle, sizeof *(haystack), n)
#ifndef arrayelem
# define arrayelem(...) libsimple_arrayelem(__VA_ARGS__)
#endif
+/* @since 1.1 */
#define libsimple_rawarrayelem(haystack, needle, n) libsimple_rawmemelem(haystack, needle, sizeof *(haystack), n)
#ifndef rawarrayelem
# define rawarrayelem(...) libsimple_rawarrayelem(__VA_ARGS__)
#endif
+/* @since 1.1 */
#define libsimple_arrayscan(haystack, needle, n) libsimple_memelemscan(haystack, needle, sizeof *(haystack), n)
#ifndef arrayscan
# define arrayscan(...) libsimple_arrayscan(__VA_ARGS__)
#endif
+/* @since 1.1 */
#define libsimple_arrayrelem(haystack, needle, n) libsimple_memrelem(haystack, needle, sizeof *(haystack), n)
#ifndef arrayrelem
# define arrayrelem(...) libsimple_arrayrelem(__VA_ARGS__)
#endif
+/* @since 1.1 */
#define libsimple_rawarrayrelem(haystack, needle, n) libsimple_rawmemrelem(haystack, needle, sizeof *(haystack), n)
#ifndef rawarrayrelem
# define rawarrayrelem(...) libsimple_rawarrayrelem(__VA_ARGS__)
#endif
+/* @since 1.1 */
#define libsimple_arrayelem_inv(haystack, needle, n) libsimple_memelem_inv(haystack, needle, sizeof *(haystack), n)
#ifndef arrayelem_inv
# define arrayelem_inv(...) libsimple_arrayelem_inv(__VA_ARGS__)
#endif
+/* @since 1.1 */
#define libsimple_rawarrayelem_inv(haystack, needle, n) libsimple_rawmemelem_inv(haystack, needle, sizeof *(haystack), n)
#ifndef rawarrayelem_inv
# define rawarrayelem_inv(...) libsimple_rawarrayelem_inv(__VA_ARGS__)
#endif
+/* @since 1.1 */
#define libsimple_arrayscan_inv(haystack, needle, n) libsimple_memelemscan_inv(haystack, needle, sizeof *(haystack), n)
#ifndef arrayscan_inv
# define arrayscan_inv(...) libsimple_arrayscan_inv(__VA_ARGS__)
#endif
+/* @since 1.1 */
#define libsimple_arrayrelem_inv(haystack, needle, n) libsimple_memrelem_inv(haystack, needle, sizeof *(haystack), n)
#ifndef arrayrelem_inv
# define arrayrelem_inv(...) libsimple_arrayrelem_inv(__VA_ARGS__)
#endif
+/* @since 1.1 */
#define libsimple_rawarrayrelem_inv(haystack, needle, n) libsimple_rawmemrelem_inv(haystack, needle, sizeof *(haystack), n)
#ifndef rawarrayrelem_inv
# define rawarrayrelem_inv(...) libsimple_rawarrayrelem_inv(__VA_ARGS__)
#endif
+/* @since 1.1 */
#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, sizeof *(buf), n)
#ifndef arraypset
# define arraypset(...) libsimple_arraypset(__VA_ARGS__)
#endif
+/* @since 1.1 */
#define libsimple_arraycpy(d, s, n) memcpy(d, s, (n) * sizeof *(s))
#ifndef arraycpy
# define arraycpy(...) libsimple_arraycpy(__VA_ARGS__)
#endif
+/* @since 1.1 */
#define libsimple_arraymove(d, s, n) memmove(d, s, (n) * sizeof *(s))
#ifndef arraymove
# define arraymove(...) libsimple_arraymove(__VA_ARGS__)
#endif
+/* @since 1.1 */
#define libsimple_arrayelemcpy(d, s, elem, n) libsimple_memelemcpy(d, s, elem, sizeof *(s), n)
#ifndef arrayelemcpy
# define arrayelemcpy(...) libsimple_arrayelemcpy(__VA_ARGS__)
#endif
+/* @since 1.1 */
#define libsimple_arrayelemmove(d, s, elem, n) libsimple_memelemmove(d, s, elem, sizeof *(s), n)
#ifndef arrayelemmove
# define arrayelemmove(...) libsimple_arrayelemmove(__VA_ARGS__)
#endif
+/* @since 1.1 */
#define libsimple_rawarrayelemcpy(d, s, elem) libsimple_rawmemelemcpy(d, s, elem, sizeof *(s))
#ifndef rawarrayelemcpy
# define rawarrayelemcpy(...) libsimple_rawarrayelemcpy(__VA_ARGS__)
#endif
+/* @since 1.1 */
#define libsimple_rawarrayelemmove(d, s, elem) libsimple_rawmemelemmove(d, s, elem, sizeof *(s))
#ifndef rawarrayelemmove
# define rawarrayelemmove(...) libsimple_rawarrayelemmove(__VA_ARGS__)
#endif
+/* @since 1.1 */
#define libsimple_arrayreplace(s, old, new, n) libsimple_memreplaceelem(s, old, new, sizeof *(s), n)
#ifndef arrayreplace
# define arrayreplace(...) libsimple_arrayreplace(__VA_ARGS__)
diff --git a/libsimple/calloc.h b/libsimple/calloc.h
index 7e6500e..80a21d4 100644
--- a/libsimple/calloc.h
+++ b/libsimple/calloc.h
@@ -17,6 +17,8 @@
* `NULL` on failure
* @throws EINVAL `n` is 0
* @throws ENOMEM Could not allocated enough memory
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __warn_unused_result__)))
inline void *
@@ -45,6 +47,8 @@ libsimple_vcallocn(size_t n__, va_list ap__)
* `NULL` on failure
* @throws EINVAL `n` is 0
* @throws ENOMEM Could not allocated enough memory
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __warn_unused_result__)))
inline void *
@@ -75,6 +79,8 @@ libsimple_callocn(size_t n__, ... /*, (size_t)0 */)
* this function is unspecified for the value 0
* @return A unique pointer with at least the size `n * m`
* and with the alignment `alignof(max_align_t)`
+ *
+ * @since 1.0
*/
#ifndef LIBSIMPLE_DEFINED_LIBSIMPLE_ENCALLOC__
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __alloc_size__(2, 3), __warn_unused_result__, __returns_nonnull__)))
@@ -104,6 +110,8 @@ void *libsimple_encalloc(int, size_t, size_t);
* list must end with 0 (which is not factor)
* @return A unique pointer with at least the specified size
* and with the alignment `alignof(max_align_t)`
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __warn_unused_result__, __returns_nonnull__)))
inline void *
@@ -134,6 +142,8 @@ libsimple_envcallocn(int status__, size_t n__, va_list ap__)
* list must end with 0 (which is not factor)
* @return A unique pointer with at least the specified size
* and with the alignment `alignof(max_align_t)`
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __warn_unused_result__, __returns_nonnull__)))
inline void *
@@ -163,6 +173,8 @@ libsimple_encallocn(int status__, size_t n__, ... /*, (size_t)0 */)
* this function is unspecified for the value 0
* @return A unique pointer with at least the size `n * m`
* and with the alignment `alignof(max_align_t)`
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __alloc_size__(1, 2), __warn_unused_result__, __returns_nonnull__)))
inline void *
@@ -192,6 +204,8 @@ libsimple_ecalloc(size_t n__, size_t m__)
* list must end with 0 (which is not factor)
* @return A unique pointer with at least the specified size
* and with the alignment `alignof(max_align_t)`
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __warn_unused_result__, __returns_nonnull__)))
inline void *
@@ -221,6 +235,8 @@ libsimple_evcallocn(size_t n__, va_list ap__)
* list must end with 0 (which is not factor)
* @return A unique pointer with at least the specified size
* and with the alignment `alignof(max_align_t)`
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __warn_unused_result__, __returns_nonnull__)))
inline void *
diff --git a/libsimple/definitions.h b/libsimple/definitions.h
index 67825f5..6fbc17f 100644
--- a/libsimple/definitions.h
+++ b/libsimple/definitions.h
@@ -112,6 +112,8 @@
/**
* Defined if two's complement is used
* for signed number representation
+ *
+ * @since 1.1
*/
# ifndef TWOS_COMPLEMENT
# define TWOS_COMPLEMENT
@@ -120,6 +122,8 @@
/**
* Defined if sign–magnitude is used
* for signed number representation
+ *
+ * @since 1.1
*/
# ifndef SIGN_MAGNITUDE
# define SIGN_MAGNITUDE
@@ -128,6 +132,8 @@
/**
* Defined if ones' complement is used
* for signed number representation
+ *
+ * @since 1.1
*/
# ifndef ONES_COMPLEMENT
# define ONES_COMPLEMENT
@@ -141,6 +147,8 @@
* @param A One of the values
* @param B The other value
* @return The smallest of `A` and `B`
+ *
+ * @since 1.0
*/
#ifndef MIN
# define MIN(A, B) ((A) < (B) ? (A) : (B))
@@ -153,6 +161,8 @@
* @param A One of the values
* @param B The other value
* @return The largest of `A` and `B`
+ *
+ * @since 1.0
*/
#ifndef MAX
# define MAX(A, B) ((A) > (B) ? (A) : (B))
@@ -166,6 +176,8 @@
* @param B Another one of the values
* @param C The last value
* @return The smallest of `A`, `B`, and `C`
+ *
+ * @since 1.0
*/
#ifndef MIN3
# define MIN3(A, B, C) MIN(MIN((A), (B)), (C))
@@ -179,6 +191,8 @@
* @param B Another one of the values
* @param C The last value
* @return The largest of `A`, `B`, and `C`
+ *
+ * @since 1.0
*/
#ifndef MAX3
# define MAX3(A, B, C) MAX(MAX((A), (B)), (C))
@@ -191,6 +205,8 @@
* @param ARR The array, must not be a pointer
* @return :size_t The number of elements in `ARR` (constant
* expression, unless its size is dynamic)
+ *
+ * @since 1.0
*/
#ifndef ELEMSOF
# define ELEMSOF(ARR) (sizeof(ARR) / (sizeof(*(ARR))))
@@ -204,6 +220,8 @@
*
* @param STR:const char [] The string, must be a literal
* @return :size_t The value of `strlen(STR)` as a constant expression
+ *
+ * @since 1.0
*/
#ifndef STRLEN
# define STRLEN(STR) (sizeof(STR) - 1)
@@ -225,6 +243,8 @@
* value of the type `TYPE` can be converted to without any
* superfluous characters (such as explitict '+' or leading zeroes')
* (constant expression)
+ *
+ * @since 1.0
*/
#ifndef INTSTRLEN
# define INTSTRLEN(TYPE) ((sizeof(TYPE) == 1 ? 3 : 5 * (sizeof(TYPE) / 2)) + ((TYPE)-1 < 0))
@@ -236,6 +256,8 @@
*
* @param TYPE:integer type The type, must be an integer type, may be signed or unsigned
* @return :TYPE The largest value that can be stored in `TYPE` (constant expression)
+ *
+ * @since 1.0
*/
#ifndef TYPE_MAX
# define TYPE_MAX(TYPE) ((TYPE)(((1ULL << (8 * sizeof(TYPE) - 1)) - 1) << ((TYPE)-1 > 0) | 1))
@@ -247,13 +269,15 @@
*
* @param TYPE:integer type The type, must be an integer type, may be signed or unsigned
* @return :TYPE The smallest value that can be stored in `TYPE` (constant expression)
+ *
+ * @since 1.0
*/
#ifndef TYPE_MIN
# define TYPE_MIN(TYPE) ((TYPE)((TYPE)-1 > 0 ? 0 : (TYPE)~0 < (TYPE)-1 ? (TYPE)~0 : (TYPE)(1ULL << (8 * sizeof(TYPE) - 1))))
#endif
-/* --- Maximum values --- */
+/* --- Maximum values (since 1.0) --- */
#ifndef BLKCNT64_MAX
# define BLKCNT64_MAX TYPE_MAX(blkcnt64_t)
@@ -392,7 +416,7 @@
#endif
-/* --- Minimum values --- */
+/* --- Minimum values (since 1.0) --- */
#ifndef BLKCNT64_MIN
# define BLKCNT64_MIN TYPE_MIN(blkcnt64_t)
diff --git a/libsimple/env.h b/libsimple/env.h
index 98a3d9f..4a26b31 100644
--- a/libsimple/env.h
+++ b/libsimple/env.h
@@ -6,6 +6,8 @@
*
* @param var The environment variable's name
* @return The environment variable's value, `NULL` if empty or not defined
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__, __warn_unused_result__)))
inline char *
@@ -24,6 +26,8 @@ libsimple_getenv_ne(const char *name__)
*
* @param var The environment variable's name
* @return The environment variable's value, "" if empty or not defined
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__, __warn_unused_result__, __returns_nonnull__)))
inline const char *
@@ -49,6 +53,8 @@ libsimple_getenv_e(const char *name__)
* @param fmt Format string, see vsprintf(3)
* @param ap Format arguments, see vsprintf(3)
* @return 0 on success, -1 on failure
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__, __format__(__printf__, 1, 0))))
int libsimple_vputenvf(const char *, va_list);
@@ -69,6 +75,8 @@ int libsimple_vputenvf(const char *, va_list);
* @param fmt Format string, see vsprintf(3)
* @param ... Format arguments, see vsprintf(3)
* @return 0 on success, -1 on failure
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__, __format__(__printf__, 1, 2))))
inline int
@@ -100,6 +108,8 @@ libsimple_putenvf(const char *fmt__, ...)
* @param status The exit value for the process in case of failure
* @param fmt Format string, see vsprintf(3)
* @param ap Format arguments, see vsprintf(3)
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__, __format__(__printf__, 2, 0))))
void libsimple_envputenvf(int, const char *, va_list);
@@ -124,6 +134,8 @@ void libsimple_envputenvf(int, const char *, va_list);
* @param status The exit value for the process in case of failure
* @param fmt Format string, see vsprintf(3)
* @param ap Format arguments, see vsprintf(3)
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__, __format__(__printf__, 2, 3))))
inline void
@@ -154,6 +166,8 @@ libsimple_enputenvf(int status__, const char *fmt__, ...)
*
* @param fmt Format string, see vsprintf(3)
* @param ap Format arguments, see vsprintf(3)
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__, __format__(__printf__, 1, 0))))
inline void
@@ -181,6 +195,8 @@ libsimple_evputenvf(const char *fmt__, va_list ap__)
*
* @param fmt Format string, see vsprintf(3)
* @param ap Format arguments, see vsprintf(3)
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__, __format__(__printf__, 1, 2))))
inline void
diff --git a/libsimple/malloc.h b/libsimple/malloc.h
index df742a1..27c54ba 100644
--- a/libsimple/malloc.h
+++ b/libsimple/malloc.h
@@ -17,6 +17,8 @@
* `NULL` on failure
* @throws EINVAL `n` is 0
* @throws ENOMEM Could not allocated enough memory
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __warn_unused_result__)))
inline void *
@@ -45,6 +47,8 @@ libsimple_vmallocn(size_t n__, va_list ap__)
* `NULL` on failure
* @throws EINVAL `n` is 0
* @throws ENOMEM Could not allocated enough memory
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __warn_unused_result__)))
inline void *
@@ -73,6 +77,8 @@ libsimple_mallocn(size_t n__, ... /*, (size_t)0 */)
* this function is unspecified for the value 0
* @return A unique pointer with at least the specified size
* and with the alignment `alignof(max_align_t)`
+ *
+ * @since 1.0
*/
#ifndef LIBSIMPLE_DEFINED_LIBSIMPLE_ENMALLOC__
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __alloc_size__(2), __warn_unused_result__, __returns_nonnull__)))
@@ -102,6 +108,8 @@ void *libsimple_enmalloc(int, size_t);
* list must end with 0 (which is not factor)
* @return A unique pointer with at least the specified size
* and with the alignment `alignof(max_align_t)`
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __warn_unused_result__, __returns_nonnull__)))
inline void *
@@ -132,6 +140,8 @@ libsimple_envmallocn(int status__, size_t n__, va_list ap__)
* list must end with 0 (which is not factor)
* @return A unique pointer with at least the specified size
* and with the alignment `alignof(max_align_t)`
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __warn_unused_result__, __returns_nonnull__)))
inline void *
@@ -159,6 +169,8 @@ libsimple_enmallocn(int status__, size_t n__, ... /*, (size_t)0 */)
* this function is unspecified for the value 0
* @return A unique pointer with at least the specified size
* and with the alignment `alignof(max_align_t)`
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __alloc_size__(1), __warn_unused_result__, __returns_nonnull__)))
inline void *
@@ -188,6 +200,8 @@ libsimple_emalloc(size_t n__)
* list must end with 0 (which is not factor)
* @return A unique pointer with at least the specified size
* and with the alignment `alignof(max_align_t)`
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __warn_unused_result__, __returns_nonnull__)))
inline void *
@@ -217,6 +231,8 @@ libsimple_evmallocn(size_t n__, va_list ap__)
* list must end with 0 (which is not factor)
* @return A unique pointer with at least the specified size
* and with the alignment `alignof(max_align_t)`
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __warn_unused_result__, __returns_nonnull__)))
inline void *
diff --git a/libsimple/mallocz.h b/libsimple/mallocz.h
index 6909b1f..80cdd5f 100644
--- a/libsimple/mallocz.h
+++ b/libsimple/mallocz.h
@@ -35,6 +35,8 @@ void *libsimple_enmalloc(int, size_t);
* `NULL` on failure
* @throws EINVAL `n` is 0
* @throws ENOMEM Could not allocated enough memory
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __warn_unused_result__)))
void *libsimple_vmalloczn(int, size_t, va_list);
@@ -54,6 +56,8 @@ void *libsimple_vmalloczn(int, size_t, va_list);
* `NULL` on failure
* @throws EINVAL `n` is 0
* @throws ENOMEM Could not allocated enough memory
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __alloc_size__(2), __warn_unused_result__)))
inline void *
@@ -83,6 +87,8 @@ libsimple_mallocz(int clear__, size_t n__)
* `NULL` on failure
* @throws EINVAL `n` is 0
* @throws ENOMEM Could not allocated enough memory
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __warn_unused_result__)))
inline void *
@@ -111,6 +117,8 @@ libsimple_malloczn(int clear__, size_t n__, ... /*, (size_t)0 */)
* @param n Th number of bytes to allocate
* @return A unique pointer with at least the specified size
* and with the alignment `alignof(max_align_t)`
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __alloc_size__(3), __warn_unused_result__, __returns_nonnull__)))
inline void *
@@ -143,6 +151,8 @@ libsimple_enmallocz(int status__, int clear__, size_t n__)
* list must end with 0 (which is not factor)
* @return A unique pointer with at least the specified size
* and with the alignment `alignof(max_align_t)`
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __warn_unused_result__, __returns_nonnull__)))
void *libsimple_envmalloczn(int, int, size_t, va_list);
@@ -171,6 +181,8 @@ void *libsimple_envmalloczn(int, int, size_t, va_list);
* list must end with 0 (which is not factor)
* @return A unique pointer with at least the specified size
* and with the alignment `alignof(max_align_t)`
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __warn_unused_result__, __returns_nonnull__)))
inline void *
@@ -198,6 +210,8 @@ libsimple_enmalloczn(int status__, int clear__, size_t n__, ... /*, (size_t)0 */
* @param n Th number of bytes to allocate
* @return A unique pointer with at least the specified size
* and with the alignment `alignof(max_align_t)`
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __alloc_size__(2), __warn_unused_result__, __returns_nonnull__)))
inline void *
@@ -228,6 +242,8 @@ libsimple_emallocz(int clear__, size_t n__)
* list must end with 0 (which is not factor)
* @return A unique pointer with at least the specified size
* and with the alignment `alignof(max_align_t)`
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __warn_unused_result__, __returns_nonnull__)))
inline void *
@@ -258,6 +274,8 @@ libsimple_evmalloczn(int clear__, size_t n__, va_list ap__)
* list must end with 0 (which is not factor)
* @return A unique pointer with at least the specified size
* and with the alignment `alignof(max_align_t)`
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __warn_unused_result__, __returns_nonnull__)))
inline void *
diff --git a/libsimple/mem.h b/libsimple/mem.h
index a7cf038..2155967 100644
--- a/libsimple/mem.h
+++ b/libsimple/mem.h
@@ -11,6 +11,8 @@
* @return `s` with a minimal offset such that `*r == c`,
* where `r` is the returned pointer, `&s[n]` if
* no such offset exists within [s, &s[n])
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __returns_nonnull__, __warn_unused_result__)))
void *libsimple_memscan(const void *, int, size_t);
@@ -29,6 +31,8 @@ void *libsimple_memscan(const void *, int, size_t);
* @return `s` with a minimal offset such that `tolower(*r) == tolower(c)`,
* where `r` is the returned pointer, `NULL` if
* no such offset exists within [s, &s[n])
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __warn_unused_result__)))
void *libsimple_memcasechr(const void *, int, size_t);
@@ -47,6 +51,8 @@ void *libsimple_memcasechr(const void *, int, size_t);
* @return `s` with a minimal offset such that `tolower(*r) == tolower(c)`,
* where `r` is the returned pointer, `&s[n]` if
* no such offset exists within [s, &s[n])
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __nonnull__, __returns_nonnull__, __warn_unused_result__)))
void *libsimple_memcasescan(const void *, int, size_t);
@@ -68,6 +74,8 @@ void *libsimple_memcasescan(const void *, int, size_t);
* @param c The byte value to search for
* @return `s` with a miminal offset such that `*r == c`,
* where `r` is the returned pointer
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __nonnull__, __returns_nonnull__, __warn_unused_result__)))
void *libsimple_rawmemchr(const void *, int);
@@ -89,6 +97,8 @@ void *libsimple_rawmemchr(const void *, int);
* @param c The byte value to search for
* @return `s` with a miminal offset such that `tolower(*r) == tolower(c)`,
* where `r` is the returned pointer
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __nonnull__, __returns_nonnull__, __warn_unused_result__)))
void *libsimple_rawmemcasechr(const void *, int);
@@ -107,6 +117,8 @@ void *libsimple_rawmemcasechr(const void *, int);
* @return `s` with a maximal offset such that `*r == c`,
* where `r` is the returned pointer `NULL` if no
* such offset exists within [s, &s[n])
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __warn_unused_result__)))
void *libsimple_memrchr(const void *, int, size_t);
@@ -125,6 +137,8 @@ void *libsimple_memrchr(const void *, int, size_t);
* @return `s` with a maximal offset such that `tolower(*r) == tolower(c)`,
* where `r` is the returned pointer `NULL` if no
* such offset exists within [s, &s[n])
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __warn_unused_result__)))
void *libsimple_memrcasechr(const void *, int, size_t);
@@ -147,6 +161,8 @@ void *libsimple_memrcasechr(const void *, int, size_t);
* @param n The number of bytes in the byte array
* @return `s` with a maximal offset such that `*r == c`,
* where `r` is the returned pointer
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __nonnull__, __returns_nonnull__, __warn_unused_result__)))
void *libsimple_rawmemrchr(const void *, int, size_t);
@@ -169,6 +185,8 @@ void *libsimple_rawmemrchr(const void *, int, size_t);
* @param n The number of bytes in the byte array
* @return `s` with a maximal offset such that `tolower(*r) == tolower(c)`,
* where `r` is the returned pointer
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __nonnull__, __returns_nonnull__, __warn_unused_result__)))
void *libsimple_rawmemrcasechr(const void *, int, size_t);
@@ -187,6 +205,8 @@ void *libsimple_rawmemrcasechr(const void *, int, size_t);
* @return `s` with a minimal offset such that `*r != c`,
* where `r` is the returned pointer, `NULL` if
* no such offset exists within [s, &s[n])
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __warn_unused_result__)))
void *libsimple_memchr_inv(const void *, int, size_t);
@@ -205,6 +225,8 @@ void *libsimple_memchr_inv(const void *, int, size_t);
* @return `s` with a minimal offset such that `*r != c`,
* where `r` is the returned pointer, `&s[n]` if
* no such offset exists within [s, &s[n])
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __returns_nonnull__, __warn_unused_result__)))
void *libsimple_memscan_inv(const void *, int, size_t);
@@ -223,6 +245,8 @@ void *libsimple_memscan_inv(const void *, int, size_t);
* @return `s` with a minimal offset such that `tolower(*r) != tolower(c)`,
* where `r` is the returned pointer, `NULL` if
* no such offset exists within [s, &s[n])
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __warn_unused_result__)))
void *libsimple_memcasechr_inv(const void *, int, size_t);
@@ -241,6 +265,8 @@ void *libsimple_memcasechr_inv(const void *, int, size_t);
* @return `s` with a minimal offset such that `tolower(*r) != tolower(c)`,
* where `r` is the returned pointer, `&s[n]` if
* no such offset exists within [s, &s[n])
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __nonnull__, __returns_nonnull__, __warn_unused_result__)))
void *libsimple_memcasescan_inv(const void *, int, size_t);
@@ -262,6 +288,8 @@ void *libsimple_memcasescan_inv(const void *, int, size_t);
* @param c The byte value to search for
* @return `s` with a miminal offset such that `*r != c`,
* where `r` is the returned pointer
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __nonnull__, __returns_nonnull__, __warn_unused_result__)))
void *libsimple_rawmemchr_inv(const void *, int);
@@ -283,6 +311,8 @@ void *libsimple_rawmemchr_inv(const void *, int);
* @param c The byte value to search for
* @return `s` with a miminal offset such that `tolower(*r) != tolower(c)`,
* where `r` is the returned pointer
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __nonnull__, __returns_nonnull__, __warn_unused_result__)))
void *libsimple_rawmemcasechr_inv(const void *, int);
@@ -301,6 +331,8 @@ void *libsimple_rawmemcasechr_inv(const void *, int);
* @return `s` with a maximal offset such that `*r != c`,
* where `r` is the returned pointer `NULL` if no
* such offset exists within [s, &s[n])
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __warn_unused_result__)))
void *libsimple_memrchr_inv(const void *, int, size_t);
@@ -319,6 +351,8 @@ void *libsimple_memrchr_inv(const void *, int, size_t);
* @return `s` with a maximal offset such that `tolower(*r) != tolower(c)`,
* where `r` is the returned pointer `NULL` if no
* such offset exists within [s, &s[n])
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __warn_unused_result__)))
void *libsimple_memrcasechr_inv(const void *, int, size_t);
@@ -341,6 +375,8 @@ void *libsimple_memrcasechr_inv(const void *, int, size_t);
* @param n The number of bytes in the byte array
* @return `s` with a maximal offset such that `*r != c`,
* where `r` is the returned pointer
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __nonnull__, __returns_nonnull__, __warn_unused_result__)))
void *libsimple_rawmemrchr_inv(const void *, int, size_t);
@@ -363,6 +399,8 @@ void *libsimple_rawmemrchr_inv(const void *, int, size_t);
* @param n The number of bytes in the byte array
* @return `s` with a maximal offset such that `tolower(*r) != tolower(c)`,
* where `r` is the returned pointer
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __nonnull__, __returns_nonnull__, __warn_unused_result__)))
void *libsimple_rawmemrcasechr_inv(const void *, int, size_t);
@@ -381,6 +419,8 @@ void *libsimple_rawmemrcasechr_inv(const void *, int, size_t);
* @return `haystack` with a minimal offset such that,
* `!memcmp(r, needle, nneedle)` where `r` is the
* returned pointer, `NULL` if no such offset exists
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __warn_unused_result__)))
void *libsimple_memmem(const void *, size_t, const void *, size_t);
@@ -399,6 +439,8 @@ void *libsimple_memmem(const void *, size_t, const void *, size_t);
* @return `haystack` with a minimal offset such that,
* `!memcasecmp(r, needle, nneedle)` where `r` is the
* returned pointer, `NULL` if no such offset exists
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __warn_unused_result__)))
void *libsimple_memcasemem(const void *, size_t, const void *, size_t);
@@ -417,6 +459,8 @@ void *libsimple_memcasemem(const void *, size_t, const void *, size_t);
* @return `haystack` with a maximal offset such that,
* `!memcmp(r, needle, nneedle)` where `r` is the
* returned pointer, `NULL` if no such offset exists
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __warn_unused_result__)))
void *libsimple_memrmem(const void *, size_t, const void *, size_t);
@@ -435,6 +479,8 @@ void *libsimple_memrmem(const void *, size_t, const void *, size_t);
* @return `haystack` with a maximal offset such that,
* `!memcasecmp(r, needle, nneedle)` where `r` is the
* returned pointer, `NULL` if no such offset exists
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __warn_unused_result__)))
void *libsimple_memrcasemem(const void *, size_t, const void *, size_t);
@@ -451,6 +497,8 @@ void *libsimple_memrcasemem(const void *, size_t, const void *, size_t);
* @param t The desired beginning of `s`
* @param m The length of `t`
* @return 1 if `s` begins with `t`, 0 otherwise
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __warn_unused_result__)))
int libsimple_memstarts(const void *, size_t, const void *, size_t);
@@ -467,6 +515,8 @@ int libsimple_memstarts(const void *, size_t, const void *, size_t);
* @param t The desired beginning of `s`
* @param m The length of `t`
* @return 1 if `s` begins with `t`, 0 otherwise
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __warn_unused_result__)))
int libsimple_memcasestarts(const void *, size_t, const void *, size_t);
@@ -483,6 +533,8 @@ int libsimple_memcasestarts(const void *, size_t, const void *, size_t);
* @param t The desired ending of `s`
* @param m The length of `t`
* @return 1 if `s` ends with `t`, 0 otherwise
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __warn_unused_result__)))
int libsimple_memends(const void *, size_t, const void *, size_t);
@@ -499,6 +551,8 @@ int libsimple_memends(const void *, size_t, const void *, size_t);
* @param t The desired ending of `s`
* @param m The length of `t`
* @return 1 if `s` ends with `t`, 0 otherwise
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __warn_unused_result__)))
int libsimple_memcaseends(const void *, size_t, const void *, size_t);
@@ -514,6 +568,8 @@ int libsimple_memcaseends(const void *, size_t, const void *, size_t);
* @param b The other arrays of bytes
* @param n The lengths of the arrays
* @return 1 if the arrays are equal, 0 otherwise
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __warn_unused_result__)))
int libsimple_memcasecmp(const void *, const void *, size_t);
@@ -529,6 +585,8 @@ int libsimple_memcasecmp(const void *, const void *, size_t);
* @param b The other arrays of bytes
* @param n The lengths of the arrays
* @return 1 if the arrays are equal, 0 otherwise
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __warn_unused_result__)))
inline int
@@ -548,6 +606,8 @@ libsimple_memeq(const void *a__, const void *b__, size_t n__)
* @param b The other arrays of bytes
* @param n The lengths of the arrays
* @return 1 if the arrays are equal, 0 otherwise
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __warn_unused_result__)))
inline int
@@ -567,6 +627,8 @@ libsimple_memcaseeq(const void *a__, const void *b__, size_t n__)
* @param s The array of bytes that should be copied
* @param n The number of bytes to copy
* @return `&d[n]`
+ *
+ * @since 1.0
*/
inline void *
libsimple_mempcpy(void *restrict d__, const void *restrict s__, size_t n__)
@@ -585,6 +647,8 @@ libsimple_mempcpy(void *restrict d__, const void *restrict s__, size_t n__)
* @param s The bytes that should be moved
* @param n The number of bytes to move
* @return `&d[n]`
+ *
+ * @since 1.1
*/
inline void *
libsimple_mempmove(void *d__, const void *s__, size_t n__)
@@ -603,6 +667,8 @@ libsimple_mempmove(void *d__, const void *s__, size_t n__)
* @param c The byte to fill the array with
* @param n The number of bytes to write to `s`
* @return `&s[n]`
+ *
+ * @since 1.1
*/
inline void *
libsimple_mempset(void *s__, int c__, size_t n__)
@@ -626,6 +692,8 @@ libsimple_mempset(void *s__, int c__, size_t n__)
* @param s The byte array to copy
* @param c The byte that stops the copying
* @return `&rawmemchr(d, c)[1]` (after copying)
+ *
+ * @since 1.1
*/
inline void *
libsimple_rawmemccpy(void *restrict d___, const void *restrict s___, int c___)
@@ -650,6 +718,8 @@ libsimple_rawmemccpy(void *restrict d___, const void *restrict s___, int c___)
* @return `&rawmemchr(d, c)[1]` (after copying) if `c` can
* be found within the first `n` bytes of `s` (before
* copying), `NULL` otherwise
+ *
+ * @since 1.1
*/
void *libsimple_memcmove(void *, const void *, int, size_t);
#ifndef memcmove
@@ -669,6 +739,8 @@ void *libsimple_memcmove(void *, const void *, int, size_t);
* @param s The byte array to copy
* @param c The byte that stops the copying
* @return `&rawmemchr(d, c)[1]` (after copying)
+ *
+ * @since 1.1
*/
inline void *
libsimple_rawmemcmove(void *d___, const void *s___, int c___)
@@ -703,6 +775,8 @@ libsimple_rawmemcmove(void *d___, const void *s___, int c___)
* @param new The value to replace the bytes with
* @param n The length of `s`
* @return `(void *)&((char *)s)[n]`
+ *
+ * @since 1.1
*/
inline void *
libsimple_memreplace(void *s___, int old___, int new___, size_t n__)
@@ -731,6 +805,8 @@ libsimple_memreplace(void *s___, int old___, int new___, size_t n__)
* @param s The byte array to copy
* @param n The number of bytes to copy or covert
* @return `&d[n]`
+ *
+ * @since 1.1
*/
void *libsimple_memptolower(void *, const void *, size_t);
#ifndef memptolower
@@ -750,6 +826,8 @@ void *libsimple_memptolower(void *, const void *, size_t);
* @param s The byte array to copy
* @param n The number of bytes to copy or covert
* @return `&d[n]`
+ *
+ * @since 1.1
*/
void *libsimple_memptoupper(void *, const void *, size_t);
#ifndef memptoupper
@@ -769,6 +847,8 @@ void *libsimple_memptoupper(void *, const void *, size_t);
* @param s The byte array to copy
* @param n The number of bytes to copy or covert
* @return `d`
+ *
+ * @since 1.1
*/
inline void *
libsimple_memtolower(void *d__, const void *s__, size_t n__)
@@ -793,6 +873,8 @@ libsimple_memtolower(void *d__, const void *s__, size_t n__)
* @param s The byte array to copy
* @param n The number of bytes to copy or covert
* @return `d`
+ *
+ * @since 1.1
*/
inline void *
libsimple_memtoupper(void *d__, const void *s__, size_t n__)
@@ -814,6 +896,8 @@ libsimple_memtoupper(void *d__, const void *s__, size_t n__)
* @param m The length of `b`
* @return The number of bytes `a` and `b` have
* in common in their beginnings
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __warn_unused_result__)))
size_t libsimple_memeqlen(const void *, size_t, const void *, size_t);
@@ -831,6 +915,8 @@ size_t libsimple_memeqlen(const void *, size_t, const void *, size_t);
* @param m The length of `b`
* @return The number of bytes `a` and `b` have
* in common in their beginnings
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __warn_unused_result__)))
size_t libsimple_memcaseeqlen(const void *, size_t, const void *, size_t);
@@ -848,6 +934,8 @@ size_t libsimple_memcaseeqlen(const void *, size_t, const void *, size_t);
* @param m The length of `b`
* @return The number of bytes `a` and `b` have
* in common in their ends
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __warn_unused_result__)))
size_t libsimple_memreqlen(const void *, size_t, const void *, size_t);
@@ -865,6 +953,8 @@ size_t libsimple_memreqlen(const void *, size_t, const void *, size_t);
* @param m The length of `b`
* @return The number of bytes `a` and `b` have
* in common in their ends
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __warn_unused_result__)))
size_t libsimple_memrcaseeqlen(const void *, size_t, const void *, size_t);
@@ -881,6 +971,8 @@ size_t libsimple_memrcaseeqlen(const void *, size_t, const void *, size_t);
* @param allow_modified_nul Whether Modified UTF-8 is allowed, which
* allows a two-byte encoding for NUL
* @return 1 if good, 0 on encoding error
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __warn_unused_result__)))
int libsimple_memisutf8(const char *, size_t, int);
diff --git a/libsimple/memalign.h b/libsimple/memalign.h
index bb6551f..4936661 100644
--- a/libsimple/memalign.h
+++ b/libsimple/memalign.h
@@ -18,6 +18,8 @@
* and alignment; `NULL` on failure
* @throws EINVAL `n` is 0 or `alignment` is not a power of 2
* @throws ENOMEM Could not allocated enough memory
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __alloc_align__(1), __warn_unused_result__)))
inline void *
@@ -40,6 +42,8 @@ libsimple_vmemalignn(size_t alignment__, size_t n__, va_list ap__)
* and alignment; `NULL` on failure
* @throws EINVAL `n` is 0 or `alignment` is not a power of 2
* @throws ENOMEM Could not allocated enough memory
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __alloc_align__(1), __alloc_size__(2), __warn_unused_result__)))
inline void *
@@ -69,6 +73,8 @@ libsimple_memalign(size_t alignment__, size_t n__)
* and alignment; `NULL` on failure
* @throws EINVAL `n` is 0 or `alignment` is not a power of 2
* @throws ENOMEM Could not allocated enough memory
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __alloc_align__(1), __warn_unused_result__)))
inline void *
@@ -98,6 +104,8 @@ libsimple_memalignn(size_t alignment__, size_t n__, ... /*, (size_t)0 */)
* this function is unspecified for the value 0
* @return A unique pointer with at least the specified size
* and alignment
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __alloc_align__(2), __alloc_size__(3), __warn_unused_result__, __returns_nonnull__)))
inline void *
@@ -130,6 +138,8 @@ libsimple_enmemalign(int status__, size_t alignment__, size_t n__)
* list must end with 0 (which is not factor)
* @return A unique pointer with at least the specified size
* and alignment
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __alloc_align__(2), __warn_unused_result__, __returns_nonnull__)))
inline void *
@@ -162,6 +172,8 @@ libsimple_envmemalignn(int status__, size_t alignment__, size_t n__, va_list ap_
* list must end with 0 (which is not factor)
* @return A unique pointer with at least the specified size
* and alignment
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __alloc_align__(2), __warn_unused_result__, __returns_nonnull__)))
inline void *
@@ -190,6 +202,8 @@ libsimple_enmemalignn(int status__, size_t alignment__, size_t n__, ... /*, (siz
* this function is unspecified for the value 0
* @return A unique pointer with at least the specified size
* and alignment
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __alloc_align__(1), __alloc_size__(2), __warn_unused_result__, __returns_nonnull__)))
inline void *
@@ -222,6 +236,8 @@ libsimple_ememalign(size_t alignment__, size_t n__)
* list must end with 0 (which is not factor)
* @return A unique pointer with at least the specified size
* and alignment
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __alloc_align__(1), __warn_unused_result__, __returns_nonnull__)))
inline void *
@@ -253,6 +269,8 @@ libsimple_evmemalignn(size_t alignment__, size_t n__, va_list ap__)
* list must end with 0 (which is not factor)
* @return A unique pointer with at least the specified size
* and alignment
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __alloc_align__(1), __warn_unused_result__, __returns_nonnull__)))
inline void *
diff --git a/libsimple/memalignz.h b/libsimple/memalignz.h
index 1630783..9972124 100644
--- a/libsimple/memalignz.h
+++ b/libsimple/memalignz.h
@@ -19,6 +19,8 @@
* and alignment; `NULL` on failure
* @throws EINVAL `n` is 0 or `alignment` is not a power of 2
* @throws ENOMEM Could not allocated enough memory
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __alloc_align__(2), __warn_unused_result__)))
inline void *
@@ -49,6 +51,8 @@ libsimple_vmemalignzn(int clear__, size_t alignment__, size_t n__, va_list ap__)
* and alignment; `NULL` on failure
* @throws EINVAL `n` is 0 or `alignment` is not a power of 2
* @throws ENOMEM Could not allocated enough memory
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __alloc_align__(2), __alloc_size__(3), __warn_unused_result__)))
inline void *
@@ -86,6 +90,8 @@ libsimple_memalignz(int clear__, size_t alignment__, size_t n__)
* and alignment; `NULL` on failure
* @throws EINVAL `n` is 0 or `alignment` is not a power of 2
* @throws ENOMEM Could not allocated enough memory
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __alloc_align__(2), __warn_unused_result__)))
inline void *
@@ -116,6 +122,8 @@ libsimple_memalignzn(int clear__, size_t alignment__, size_t n__, ... /*, (size_
* this function is unspecified for the value 0
* @return A unique pointer with at least the specified size
* and alignment
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __alloc_align__(3), __alloc_size__(4), __warn_unused_result__, __returns_nonnull__)))
inline void *
@@ -156,6 +164,8 @@ libsimple_enmemalignz(int status__, int clear__, size_t alignment__, size_t n__)
* list must end with 0 (which is not factor)
* @return A unique pointer with at least the specified size
* and alignment
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __alloc_align__(3), __warn_unused_result__, __returns_nonnull__)))
inline void *
@@ -197,6 +207,8 @@ libsimple_envmemalignzn(int status__, int clear__, size_t alignment__, size_t n_
* list must end with 0 (which is not factor)
* @return A unique pointer with at least the specified size
* and alignment
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __alloc_align__(3), __warn_unused_result__, __returns_nonnull__)))
inline void *
@@ -226,6 +238,8 @@ libsimple_enmemalignzn(int status__, int clear__, size_t alignment__, size_t n__
* this function is unspecified for the value 0
* @return A unique pointer with at least the specified size
* and alignment
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __alloc_align__(2), __alloc_size__(3), __warn_unused_result__, __returns_nonnull__)))
inline void *
@@ -258,6 +272,8 @@ libsimple_ememalignz(int clear__, size_t alignment__, size_t n__)
* list must end with 0 (which is not factor)
* @return A unique pointer with at least the specified size
* and alignment
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __alloc_align__(2), __warn_unused_result__, __returns_nonnull__)))
inline void *
@@ -290,6 +306,8 @@ libsimple_evmemalignzn(int clear__, size_t alignment__, size_t n__, va_list ap__
* list must end with 0 (which is not factor)
* @return A unique pointer with at least the specified size
* and alignment
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __alloc_align__(2), __warn_unused_result__, __returns_nonnull__)))
inline void *
diff --git a/libsimple/memalloc.h b/libsimple/memalloc.h
index 9f894e8..105bb50 100644
--- a/libsimple/memalloc.h
+++ b/libsimple/memalloc.h
@@ -1,6 +1,8 @@
/* See LICENSE file for copyright and license details. */
+/* @since 1.1 */
enum libsimple_memalloc_option {
+ /* @since 1.1 { */
LIBSIMPLE_MEMALLOC_END,
LIBSIMPLE_MEMALLOC_ZERO_INIT,
LIBSIMPLE_MEMALLOC_CONDITIONAL_ZERO_INIT,
@@ -16,9 +18,12 @@ enum libsimple_memalloc_option {
LIBSIMPLE_MEMALLOC_VA_PRODUCT_SIZE,
LIBSIMPLE_MEMALLOC_1_VA_PRODUCT_SIZE,
LIBSIMPLE_MEMALLOC_VA_LIST
+ /* @since 1.1 } */
};
+ /* @since 1.1 */
#define libsimple_arrayalloc_option libsimple_memalloc_option
+/* @since 1.1 { */
#define LIBSIMPLE_MEMALLOC_END LIBSIMPLE_MEMALLOC_END
#define LIBSIMPLE_MEMALLOC_ZERO_INIT LIBSIMPLE_MEMALLOC_ZERO_INIT
#define LIBSIMPLE_MEMALLOC_CONDITIONAL_ZERO_INIT LIBSIMPLE_MEMALLOC_CONDITIONAL_ZERO_INIT
@@ -34,7 +39,9 @@ enum libsimple_memalloc_option {
#define LIBSIMPLE_MEMALLOC_VA_PRODUCT_SIZE LIBSIMPLE_MEMALLOC_VA_PRODUCT_SIZE
#define LIBSIMPLE_MEMALLOC_1_VA_PRODUCT_SIZE LIBSIMPLE_MEMALLOC_1_VA_PRODUCT_SIZE
#define LIBSIMPLE_MEMALLOC_VA_LIST LIBSIMPLE_MEMALLOC_VA_LIST
+/* @since 1.1 } */
+/* @since 1.1 { */
#define LIBSIMPLE_ARRAYALLOC_END LIBSIMPLE_MEMALLOC_END
#define LIBSIMPLE_ARRAYALLOC_ZERO_INIT LIBSIMPLE_MEMALLOC_ZERO_INIT
#define LIBSIMPLE_ARRAYALLOC_CONDITIONAL_ZERO_INIT LIBSIMPLE_MEMALLOC_CONDITIONAL_ZERO_INIT
@@ -47,43 +54,53 @@ enum libsimple_memalloc_option {
#define LIBSIMPLE_ARRAYALLOC_VA_PRODUCT_SIZE LIBSIMPLE_MEMALLOC_VA_PRODUCT_SIZE
#define LIBSIMPLE_ARRAYALLOC_1_VA_PRODUCT_SIZE LIBSIMPLE_MEMALLOC_1_VA_PRODUCT_SIZE
#define LIBSIMPLE_ARRAYALLOC_VA_LIST LIBSIMPLE_MEMALLOC_VA_LIST
+/* @since 1.1 } */
+/* @since 1.1 */
#define libsimple_varrayalloc(TYPE, N, AP)\
libsimple_memalloc(N, LIBSIMPLE_MEMALLOC_ELEMENT_SIZE, sizeof(TYPE),\
LIBSIMPLE_MEMALLOC_ALIGNMENT, _Alignof(TYPE),\
LIBSIMPLE_MEMALLOC_VA_LIST, AP, LIBSIMPLE_MEMALLOC_END)
+/* @since 1.1 */
#define libsimple_evarrayalloc(TYPE, N, AP)\
libsimple_ememalloc(N, LIBSIMPLE_MEMALLOC_ELEMENT_SIZE, sizeof(TYPE),\
LIBSIMPLE_MEMALLOC_ALIGNMENT, _Alignof(TYPE),\
LIBSIMPLE_MEMALLOC_VA_LIST, AP, LIBSIMPLE_MEMALLOC_END)
+/* @since 1.1 */
#define libsimple_envarrayalloc(STATUS, TYPE, N, AP)\
libsimple_enmemalloc(STATUS, N, LIBSIMPLE_MEMALLOC_ELEMENT_SIZE, sizeof(TYPE),\
LIBSIMPLE_MEMALLOC_ALIGNMENT, _Alignof(TYPE),\
LIBSIMPLE_MEMALLOC_VA_LIST, AP, LIBSIMPLE_MEMALLOC_END)
+/* @since 1.1 */
#define libsimple_arrayalloc(TYPE, N, ... /*, LIBSIMPLE_ARRAYALLOC_END */)\
libsimple_memalloc(N, LIBSIMPLE_MEMALLOC_ELEMENT_SIZE, sizeof(TYPE),\
LIBSIMPLE_MEMALLOC_ALIGNMENT, _Alignof(TYPE),\
__VA_ARGS__)
+/* @since 1.1 */
#define libsimple_earrayalloc(TYPE, N, ... /*, LIBSIMPLE_ARRAYALLOC_END */)\
libsimple_ememalloc(N, LIBSIMPLE_MEMALLOC_ELEMENT_SIZE, sizeof(TYPE),\
LIBSIMPLE_MEMALLOC_ALIGNMENT, _Alignof(TYPE),\
__VA_ARGS__)
+/* @since 1.1 */
#define libsimple_enarrayalloc(STATUS, TYPE, N, ... /*, LIBSIMPLE_ARRAYALLOC_END */)\
libsimple_enmemalloc(STATUS, N, LIBSIMPLE_MEMALLOC_ELEMENT_SIZE, sizeof(TYPE),\
LIBSIMPLE_MEMALLOC_ALIGNMENT, _Alignof(TYPE),\
__VA_ARGS__)
+/* @since 1.1 */
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __warn_unused_result__)))
void *libsimple_vmemalloc(size_t, va_list);
+/* @since 1.1 */
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __warn_unused_result__)))
void *libsimple_envmemalloc(int, size_t, va_list);
+/* @since 1.1 */
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __warn_unused_result__)))
inline void *
libsimple_evmemalloc(size_t n__, va_list ap__)
@@ -91,6 +108,7 @@ libsimple_evmemalloc(size_t n__, va_list ap__)
return libsimple_envmemalloc(libsimple_default_failure_exit, n__, ap__);
}
+/* @since 1.1 */
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __warn_unused_result__)))
inline void *
libsimple_memalloc(size_t n__, ... /*, LIBSIMPLE_MEMALLOC_END */)
@@ -101,6 +119,7 @@ libsimple_memalloc(size_t n__, ... /*, LIBSIMPLE_MEMALLOC_END */)
va_end(ap__);
}
+/* @since 1.1 */
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __warn_unused_result__)))
inline void *
libsimple_enmemalloc(int status__, size_t n__, ... /*, LIBSIMPLE_MEMALLOC_END */)
@@ -111,6 +130,7 @@ libsimple_enmemalloc(int status__, size_t n__, ... /*, LIBSIMPLE_MEMALLOC_END */
va_end(ap__);
}
+/* @since 1.1 */
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __warn_unused_result__)))
inline void *
libsimple_ememalloc(size_t n__, ... /*, LIBSIMPLE_MEMALLOC_END */)
diff --git a/libsimple/memdup.h b/libsimple/memdup.h
index 528782f..8ab610f 100644
--- a/libsimple/memdup.h
+++ b/libsimple/memdup.h
@@ -7,6 +7,8 @@
* @param s:const void * The bytes to copy
* @param n:size_t The number of bytes to copy
* @return :void * Duplicate of `s` with automatic storage
+ *
+ * @since 1.0
*/
#if defined(__GNUC__) || defined(__clang__)
# define libsimple_memdupa(s, n)\
@@ -29,6 +31,8 @@
* @param s The bytes to copy
* @param n The number of bytes to copy
* @return Duplicate of `s`, `NULL` on failure
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__alloc_size__(2), __nonnull__, __warn_unused_result__)))
void *libsimple_memdup(const void *, size_t);
@@ -44,6 +48,8 @@ void *libsimple_memdup(const void *, size_t);
* @param s The bytes to copy
* @param n The number of bytes to copy
* @return Duplicate of `s`
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__alloc_size__(3), __warn_unused_result__, __returns_nonnull__)))
void *libsimple_enmemdup(int, const void *, size_t);
@@ -58,6 +64,8 @@ void *libsimple_enmemdup(int, const void *, size_t);
* @param s The bytes to copy
* @param n The number of bytes to copy
* @return Duplicate of `s`
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__alloc_size__(2), __warn_unused_result__, __returns_nonnull__)))
inline void *
diff --git a/libsimple/memelem.h b/libsimple/memelem.h
index e78251a..f92ac8a 100644
--- a/libsimple/memelem.h
+++ b/libsimple/memelem.h
@@ -12,6 +12,8 @@
* `!memcmp(r, needle, width)` where `r` is the returned
* pointer and such that `(r - haystack) % width == 0`,
* `NULL` if no such offset exists
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __warn_unused_result__)))
void *libsimple_memelem(const void *, const void *, size_t, size_t);
@@ -34,6 +36,8 @@ void *libsimple_memelem(const void *, const void *, size_t, size_t);
* @return `haystack` with a minimal offset such that,
* `!memcmp(r, needle, width)` where `r` is the returned
* pointer and such that `(r - haystack) % width == 0`
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __returns_nonnull__, __warn_unused_result__)))
void *libsimple_rawmemelem(const void *, const void *, size_t);
@@ -54,6 +58,8 @@ void *libsimple_rawmemelem(const void *, const void *, size_t);
* pointer and such that `(r - haystack) % width == 0`,
* `(void *)&((char *)haystack)[n * width]` if no such
* offset exists
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __warn_unused_result__)))
void *libsimple_memelemscan(const void *, const void *, size_t, size_t);
@@ -73,6 +79,8 @@ void *libsimple_memelemscan(const void *, const void *, size_t, size_t);
* `!memcmp(r, needle, width)` where `r` is the returned
* pointer and such that `(r - haystack) % width == 0`,
* `NULL` if no such offset exists
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __warn_unused_result__)))
void *libsimple_memrelem(const void *, const void *, size_t, size_t);
@@ -96,6 +104,8 @@ void *libsimple_memrelem(const void *, const void *, size_t, size_t);
* @return `haystack` with a maximal offset such that,
* `!memcmp(r, needle, width)` where `r` is the returned
* pointer and such that `(r - haystack) % width == 0`
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __returns_nonnull__, __warn_unused_result__)))
void *libsimple_rawmemrelem(const void *, const void *, size_t, size_t);
@@ -116,6 +126,8 @@ void *libsimple_rawmemrelem(const void *, const void *, size_t, size_t);
* `memcmp(r, needle, width)` where `r` is the returned
* pointer and such that `(r - haystack) % width == 0`,
* `NULL` if no such offset exists
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __warn_unused_result__)))
void *libsimple_memelem_inv(const void *, const void *, size_t, size_t);
@@ -139,6 +151,8 @@ void *libsimple_memelem_inv(const void *, const void *, size_t, size_t);
* @return `haystack` with a minimal offset such that,
* `memcmp(r, needle, width)` where `r` is the returned
* pointer and such that `(r - haystack) % width == 0`
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __returns_nonnull__, __warn_unused_result__)))
void *libsimple_rawmemelem_inv(const void *, const void *, size_t);
@@ -160,6 +174,8 @@ void *libsimple_rawmemelem_inv(const void *, const void *, size_t);
* pointer and such that `(r - haystack) % width == 0`,
* `(void *)&((char *)haystack)[n * width]` if no such
* offset exists
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __warn_unused_result__)))
void *libsimple_memelemscan_inv(const void *, const void *, size_t, size_t);
@@ -180,6 +196,8 @@ void *libsimple_memelemscan_inv(const void *, const void *, size_t, size_t);
* `memcmp(r, needle, width)` where `r` is the returned
* pointer and such that `(r - haystack) % width == 0`,
* `NULL` if no such offset exists
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __warn_unused_result__)))
void *libsimple_memrelem_inv(const void *, const void *, size_t, size_t);
@@ -204,6 +222,8 @@ void *libsimple_memrelem_inv(const void *, const void *, size_t, size_t);
* @return `haystack` with a maximal offset such that,
* `memcmp(r, needle, width)` where `r` is the returned
* pointer and such that `(r - haystack) % width == 0`
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __returns_nonnull__, __warn_unused_result__)))
void *libsimple_rawmemrelem_inv(const void *, const void *, size_t, size_t);
@@ -220,6 +240,8 @@ void *libsimple_rawmemrelem_inv(const void *, const void *, size_t, size_t);
* @param width The size of `item`
* @param n The number of copies to fill `buf` with
* @return `&buf[n * width]`
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__warn_unused_result__)))
void *libsimple_mempsetelem(void *, const void *, size_t, size_t);
@@ -236,6 +258,8 @@ void *libsimple_mempsetelem(void *, const void *, size_t, size_t);
* @param width The size of `item`
* @param n The number of copies to fill `buf` with
* @return `buf`
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__warn_unused_result__)))
inline void *
@@ -260,6 +284,8 @@ libsimple_memsetelem(void *buf__, const void *item__, size_t width__, size_t n__
* @return `&rawmemelem(d, c, width)[width]` (after copying) if `elem`
* can be found within the first `n` elements of `s` (before
* copying), `NULL` otherwise
+ *
+ * @since 1.1
*/
void *libsimple_memelemcpy(void *restrict, const void *restrict, const void *restrict, size_t, size_t);
#ifndef memelemcpy
@@ -278,6 +304,8 @@ void *libsimple_memelemcpy(void *restrict, const void *restrict, const void *res
* @return `&rawmemelem(d, c, width)[width]` (after copying) if `elem`
* can be found within the first `n` elements of `s` (before
* copying), `NULL` otherwise
+ *
+ * @since 1.1
*/
void *libsimple_memelemmove(void *, const void *, const void *restrict, size_t, size_t);
#ifndef memelemmove
@@ -298,6 +326,8 @@ void *libsimple_memelemmove(void *, const void *, const void *restrict, size_t,
* @param elem The element that stops the copying
* @param width The size of each element
* @return `&rawmemelem(d, c, width)[width]` (after copying)
+ *
+ * @since 1.1
*/
void *libsimple_rawmemelemcpy(void *restrict, const void *restrict, const void *restrict, size_t);
#ifndef rawmemelemcpy
@@ -318,6 +348,8 @@ void *libsimple_rawmemelemcpy(void *restrict, const void *restrict, const void *
* @param elem The element that stops the copying
* @param width The size of each element
* @return `&rawmemelem(d, c, width)[width]` (after copying)
+ *
+ * @since 1.1
*/
void *libsimple_rawmemelemmove(void *, const void *, const void *restrict, size_t);
#ifndef rawmemelemmove
@@ -335,6 +367,8 @@ void *libsimple_rawmemelemmove(void *, const void *, const void *restrict, size_
* @param width The size of each element
* @param n The length of `s`, measured in elements
* @return `(void *)&((char *)s)[n * width]`
+ *
+ * @since 1.1
*/
void *libsimple_memreplaceelem(void *restrict, const void *, const void *, size_t, size_t);
#ifndef memreplaceelem
diff --git a/libsimple/overflow.h b/libsimple/overflow.h
index 66ea6fa..a4857a8 100644
--- a/libsimple/overflow.h
+++ b/libsimple/overflow.h
@@ -149,258 +149,322 @@
#endif
+/* @since 1.1 */
#ifndef UADD_WOULD_OVERFLOW
# define UADD_WOULD_OVERFLOW(A, B, MAX) LIBSIMPLE_UADD_WOULD_OVERFLOW(A, B, MAX)
#endif
+/* @since 1.1 */
#ifndef USUB_WOULD_OVERFLOW
# define USUB_WOULD_OVERFLOW(A, B) LIBSIMPLE_USUB_WOULD_OVERFLOW(A, B)
#endif
+/* @since 1.1 */
#ifndef UMUL_WOULD_OVERFLOW
# define UMUL_WOULD_OVERFLOW(A, B, MAX) LIBSIMPLE_UMUL_WOULD_OVERFLOW(A, B, MAX)
#endif
+/* @since 1.1 */
#ifndef UMUL_WOULD_OVERFLOW_NONZERO
# define UMUL_WOULD_OVERFLOW_NONZERO(A, B, MAX) LIBSIMPLE_UMUL_WOULD_OVERFLOW_NONZERO(A, B, MAX)
#endif
+/* @since 1.1 */
#ifndef UINCR_WOULD_OVERFLOW
# define UINCR_WOULD_OVERFLOW(A, MAX) LIBSIMPLE_UINCR_WOULD_OVERFLOW(A, MAX)
#endif
+/* @since 1.1 */
#ifndef UDECR_WOULD_OVERFLOW
# define UDECR_WOULD_OVERFLOW(A) LIBSIMPLE_UDECR_WOULD_OVERFLOW(A)
#endif
+/* @since 1.1 */
#ifndef UADD_OVERFLOW
# define UADD_OVERFLOW(A, B, RES, MAX) LIBSIMPLE_UADD_OVERFLOW(A, B, RES, MAX)
#endif
+/* @since 1.1 */
#ifndef USUB_OVERFLOW
# define USUB_OVERFLOW(A, B, RES) LIBSIMPLE_USUB_OVERFLOW(A, B, RES)
#endif
+/* @since 1.1 */
#ifndef UMUL_OVERFLOW
# define UMUL_OVERFLOW(A, B, RES, MAX) LIBSIMPLE_UMUL_OVERFLOW(A, B, RES, MAX)
#endif
+/* @since 1.1 */
#ifndef UMUL_OVERFLOW_NONZERO
# define UMUL_OVERFLOW_NONZERO(A, B, RES, MAX) LIBSIMPLE_UMUL_OVERFLOW_NONZERO(A, B, RES, MAX)
#endif
+/* @since 1.1 */
#ifndef UINCR_OVERFLOW
# define UINCR_OVERFLOW(AP, MAX) LIBSIMPLE_UINCR_OVERFLOW(AP, MAX)
#endif
+/* @since 1.1 */
#ifndef UDECR_OVERFLOW
# define UDECR_OVERFLOW(AP) LIBSIMPLE_UDECR_OVERFLOW(AP)
#endif
+/* @since 1.1 */
#ifndef SADD_WOULD_OVERFLOW
# define SADD_WOULD_OVERFLOW(A, B, MIN, MAX) LIBSIMPLE_SADD_WOULD_OVERFLOW(A, B, MIN, MAX)
#endif
+/* @since 1.1 */
#ifndef SADD_WOULD_OVERFLOW_A_NEG
# define SADD_WOULD_OVERFLOW_A_NEG(A, B, MIN, MAX) LIBSIMPLE_SADD_WOULD_OVERFLOW_A_NEG(A, B, MIN, MAX)
#endif
+/* @since 1.1 */
#ifndef SADD_WOULD_OVERFLOW_B_NEG
# define SADD_WOULD_OVERFLOW_B_NEG(A, B, MIN, MAX) LIBSIMPLE_SADD_WOULD_OVERFLOW_B_NEG(A, B, MIN, MAX)
#endif
+/* @since 1.1 */
#ifndef SADD_WOULD_OVERFLOW_NONNEG
# define SADD_WOULD_OVERFLOW_NONNEG(A, B, MIN, MAX) LIBSIMPLE_SADD_WOULD_OVERFLOW_NONNEG(A, B, MIN, MAX)
#endif
+/* @since 1.1 */
#ifndef SSUB_WOULD_OVERFLOW
# define SSUB_WOULD_OVERFLOW(A, B, MIN, MAX) LIBSIMPLE_SSUB_WOULD_OVERFLOW(A, B, MIN, MAX)
#endif
+/* @since 1.1 */
#ifndef SSUB_WOULD_OVERFLOW_B_NEG
# define SSUB_WOULD_OVERFLOW_B_NEG(A, B, MIN, MAX) LIBSIMPLE_SSUB_WOULD_OVERFLOW_B_NEG(A, B, MIN, MAX)
#endif
+/* @since 1.1 */
#ifndef SSUB_WOULD_OVERFLOW_B_POS
# define SSUB_WOULD_OVERFLOW_B_POS(A, B, MIN, MAX) LIBSIMPLE_SSUB_WOULD_OVERFLOW_B_POS(A, B, MIN, MAX)
#endif
+/* @since 1.1 */
#ifndef SMUL_WOULD_OVERFLOW
# define SMUL_WOULD_OVERFLOW(A, B, MIN, MAX) LIBSIMPLE_SMUL_WOULD_OVERFLOW(A, B, MIN, MAX)
#endif
+/* @since 1.1 */
#ifndef SMUL_WOULD_OVERFLOW_NONZERO
# define SMUL_WOULD_OVERFLOW_NONZERO(A, B, MIN, MAX) LIBSIMPLE_SMUL_WOULD_OVERFLOW_NONZERO(A, B, MIN, MAX)
#endif
+/* @since 1.1 */
#ifndef SMUL_WOULD_OVERFLOW_AN
# define SMUL_WOULD_OVERFLOW_AN(A, B, MIN, MAX) LIBSIMPLE_SMUL_WOULD_OVERFLOW_AN(A, B, MIN, MAX)
#endif
+/* @since 1.1 */
#ifndef SMUL_WOULD_OVERFLOW_AN_BNZ
# define SMUL_WOULD_OVERFLOW_AN_BNZ(A, B, MIN, MAX) LIBSIMPLE_SMUL_WOULD_OVERFLOW_AN_BNZ(A, B, MIN, MAX)
#endif
+/* @since 1.1 */
#ifndef SMUL_WOULD_OVERFLOW_AN_BN
# define SMUL_WOULD_OVERFLOW_AN_BN(A, B, MIN, MAX) LIBSIMPLE_SMUL_WOULD_OVERFLOW_AN_BN(A, B, MIN, MAX)
#endif
+/* @since 1.1 */
#ifndef SMUL_WOULD_OVERFLOW_AN_BP
# define SMUL_WOULD_OVERFLOW_AN_BP(A, B, MIN, MAX) LIBSIMPLE_SMUL_WOULD_OVERFLOW_AN_BP(A, B, MIN, MAX)
#endif
+/* @since 1.1 */
#ifndef SMUL_WOULD_OVERFLOW_AP
# define SMUL_WOULD_OVERFLOW_AP(A, B, MIN, MAX) LIBSIMPLE_SMUL_WOULD_OVERFLOW_AP(A, B, MIN, MAX)
#endif
+/* @since 1.1 */
#ifndef SMUL_WOULD_OVERFLOW_AP_BNZ
# define SMUL_WOULD_OVERFLOW_AP_BNZ(A, B, MIN, MAX) LIBSIMPLE_SMUL_WOULD_OVERFLOW_AP_BNZ(A, B, MIN, MAX)
#endif
+/* @since 1.1 */
#ifndef SMUL_WOULD_OVERFLOW_AP_BN
# define SMUL_WOULD_OVERFLOW_AP_BN(A, B, MIN, MAX) LIBSIMPLE_SMUL_WOULD_OVERFLOW_AP_BN(A, B, MIN, MAX)
#endif
+/* @since 1.1 */
#ifndef SMUL_WOULD_OVERFLOW_AP_BP
# define SMUL_WOULD_OVERFLOW_AP_BP(A, B, MIN, MAX) LIBSIMPLE_SMUL_WOULD_OVERFLOW_AP_BP(A, B, MIN, MAX)
#endif
+/* @since 1.1 */
#ifndef SMUL_WOULD_OVERFLOW_BN
# define SMUL_WOULD_OVERFLOW_BN(A, B, MIN, MAX) LIBSIMPLE_SMUL_WOULD_OVERFLOW_BN(A, B, MIN, MAX)
#endif
+/* @since 1.1 */
#ifndef SMUL_WOULD_OVERFLOW_ANZ_BN
# define SMUL_WOULD_OVERFLOW_ANZ_BN(A, B, MIN, MAX) LIBSIMPLE_SMUL_WOULD_OVERFLOW_ANZ_BN(A, B, MIN, MAX)
#endif
+/* @since 1.1 */
#ifndef SMUL_WOULD_OVERFLOW_BP
# define SMUL_WOULD_OVERFLOW_BP(A, B, MIN, MAX) LIBSIMPLE_SMUL_WOULD_OVERFLOW_BP(A, B, MIN, MAX)
#endif
+/* @since 1.1 */
#ifndef SMUL_WOULD_OVERFLOW_ANZ_BP
# define SMUL_WOULD_OVERFLOW_ANZ_BP(A, B, MIN, MAX) LIBSIMPLE_SMUL_WOULD_OVERFLOW_ANZ_BP(A, B, MIN, MAX)
#endif
+/* @since 1.1 */
#ifndef SDIV_WOULD_OVERFLOW
# define SDIV_WOULD_OVERFLOW(A, B, MIN, MAX) LIBSIMPLE_SDIV_WOULD_OVERFLOW(A, B, MIN, MAX)
#endif
+/* @since 1.1 */
#ifndef SINCR_WOULD_OVERFLOW
# define SINCR_WOULD_OVERFLOW(A, MAX) LIBSIMPLE_SINCR_WOULD_OVERFLOW(A, MAX)
#endif
+/* @since 1.1 */
#ifndef SDECR_WOULD_OVERFLOW
# define SDECR_WOULD_OVERFLOW(A, MIN) LIBSIMPLE_SDECR_WOULD_OVERFLOW(A, MIN)
#endif
+/* @since 1.1 */
#ifndef SADD_OVERFLOW
# define SADD_OVERFLOW(A, B, RES, MIN, MAX) LIBSIMPLE_SADD_OVERFLOW(A, B, RES, MIN, MAX)
#endif
+/* @since 1.1 */
#ifndef SADD_OVERFLOW_A_NEG
# define SADD_OVERFLOW_A_NEG(A, B, RES, MIN, MAX) LIBSIMPLE_SADD_OVERFLOW_A_NEG(A, B, RES, MIN, MAX)
#endif
+/* @since 1.1 */
#ifndef SADD_OVERFLOW_B_NEG
# define SADD_OVERFLOW_B_NEG(A, B, RES, MIN, MAX) LIBSIMPLE_SADD_OVERFLOW_B_NEG(A, B, RES, MIN, MAX)
#endif
+/* @since 1.1 */
#ifndef SADD_OVERFLOW_NONNEG
# define SADD_OVERFLOW_NONNEG(A, B, RES, MIN, MAX) LIBSIMPLE_SADD_OVERFLOW_NONNEG(A, B, RES, MIN, MAX)
#endif
+/* @since 1.1 */
#ifndef SSUB_OVERFLOW
# define SSUB_OVERFLOW(A, B, RES, MIN, MAX) LIBSIMPLE_SSUB_OVERFLOW(A, B, RES, MIN, MAX)
#endif
+/* @since 1.1 */
#ifndef SSUB_OVERFLOW_B_NEG
# define SSUB_OVERFLOW_B_NEG(A, B, RES, MIN, MAX) LIBSIMPLE_SSUB_OVERFLOW_B_NEG(A, B, RES, MIN, MAX)
#endif
+/* @since 1.1 */
#ifndef SSUB_OVERFLOW_B_POS
# define SSUB_OVERFLOW_B_POS(A, B, RES, MIN, MAX) LIBSIMPLE_SSUB_OVERFLOW_B_POS(A, B, RES, MIN, MAX)
#endif
+/* @since 1.1 */
#ifndef SMUL_OVERFLOW
# define SMUL_OVERFLOW(A, B, RES, MIN, MAX) LIBSIMPLE_SMUL_OVERFLOW(A, B, RES, MIN, MAX)
#endif
+/* @since 1.1 */
#ifndef SMUL_OVERFLOW_NONZERO
# define SMUL_OVERFLOW_NONZERO(A, B, RES, MIN, MAX) LIBSIMPLE_SMUL_OVERFLOW_NONZERO(A, B, RES, MIN, MAX)
#endif
+/* @since 1.1 */
#ifndef SMUL_OVERFLOW_AN
# define SMUL_OVERFLOW_AN(A, B, RES, MIN, MAX) LIBSIMPLE_SMUL_OVERFLOW_AN(A, B, RES, MIN, MAX)
#endif
+/* @since 1.1 */
#ifndef SMUL_OVERFLOW_AN_BNZ
# define SMUL_OVERFLOW_AN_BNZ(A, B, RES, MIN, MAX) LIBSIMPLE_SMUL_OVERFLOW_AN_BNZ(A, B, RES, MIN, MAX)
#endif
+/* @since 1.1 */
#ifndef SMUL_OVERFLOW_AN_BN
# define SMUL_OVERFLOW_AN_BN(A, B, RES, MIN, MAX) LIBSIMPLE_SMUL_OVERFLOW_AN_BN(A, B, RES, MIN, MAX)
#endif
+/* @since 1.1 */
#ifndef SMUL_OVERFLOW_AN_BP
# define SMUL_OVERFLOW_AN_BP(A, B, RES, MIN, MAX) LIBSIMPLE_SMUL_OVERFLOW_AN_BP(A, B, RES, MIN, MAX)
#endif
+/* @since 1.1 */
#ifndef SMUL_OVERFLOW_AP
# define SMUL_OVERFLOW_AP(A, B, RES, MIN, MAX) LIBSIMPLE_SMUL_OVERFLOW_AP(A, B, RES, MIN, MAX)
#endif
+/* @since 1.1 */
#ifndef SMUL_OVERFLOW_AP_BNZ
# define SMUL_OVERFLOW_AP_BNZ(A, B, RES, MIN, MAX) LIBSIMPLE_SMUL_OVERFLOW_AP_BNZ(A, B, RES, MIN, MAX)
#endif
+/* @since 1.1 */
#ifndef SMUL_OVERFLOW_AP_BN
# define SMUL_OVERFLOW_AP_BN(A, B, RES, MIN, MAX) LIBSIMPLE_SMUL_OVERFLOW_AP_BN(A, B, RES, MIN, MAX)
#endif
+/* @since 1.1 */
#ifndef SMUL_OVERFLOW_AP_BP
# define SMUL_OVERFLOW_AP_BP(A, B, RES, MIN, MAX) LIBSIMPLE_SMUL_OVERFLOW_AP_BP(A, B, RES, MIN, MAX)
#endif
+/* @since 1.1 */
#ifndef SMUL_OVERFLOW_BN
# define SMUL_OVERFLOW_BN(A, B, RES, MIN, MAX) LIBSIMPLE_SMUL_OVERFLOW_BN(A, B, RES, MIN, MAX)
#endif
+/* @since 1.1 */
#ifndef SMUL_OVERFLOW_ANZ_BN
# define SMUL_OVERFLOW_ANZ_BN(A, B, RES, MIN, MAX) LIBSIMPLE_SMUL_OVERFLOW_ANZ_BN(A, B, RES, MIN, MAX)
#endif
+/* @since 1.1 */
#ifndef SMUL_OVERFLOW_BP
# define SMUL_OVERFLOW_BP(A, B, RES, MIN, MAX) LIBSIMPLE_SMUL_OVERFLOW_BP(A, B, RES, MIN, MAX)
#endif
+/* @since 1.1 */
#ifndef SMUL_OVERFLOW_ANZ_BP
# define SMUL_OVERFLOW_ANZ_BP(A, B, RES, MIN, MAX) LIBSIMPLE_SMUL_OVERFLOW_ANZ_BP(A, B, RES, MIN, MAX)
#endif
+/* @since 1.1 */
#ifndef SDIV_OVERFLOW
# define SDIV_OVERFLOW(A, B, RES, MIN, MAX) LIBSIMPLE_SDIV_OVERFLOW(A, B, RES, MIN, MAX)
#endif
+/* @since 1.1 */
#ifndef SINCR_OVERFLOW
# define SINCR_OVERFLOW(AP, MAX) LIBSIMPLE_SINCR_OVERFLOW(AP, MAX)
#endif
+/* @since 1.1 */
#ifndef SDECR_OVERFLOW
# define SDECR_OVERFLOW(AP, MIN) LIBSIMPLE_SDECR_OVERFLOW(AP, MIN)
#endif
+/* @since 1.1 */
#ifndef INCR_WOULD_OVERFLOW
# define INCR_WOULD_OVERFLOW(A, MAX) LIBSIMPLE_INCR_WOULD_OVERFLOW(A, MAX)
#endif
+/* @since 1.1 */
#ifndef DECR_WOULD_OVERFLOW
# define DECR_WOULD_OVERFLOW(A, MIN) LIBSIMPLE_DECR_WOULD_OVERFLOW(A, MIN)
#endif
+/* @since 1.1 */
#ifndef INCR_OVERFLOW
# define INCR_OVERFLOW(AP, MAX) LIBSIMPLE_INCR_OVERFLOW(AP, MAX)
#endif
+/* @since 1.1 */
#ifndef DECR_OVERFLOW
# define DECR_OVERFLOW(AP, MIN) LIBSIMPLE_DECR_OVERFLOW(AP, MIN)
#endif
diff --git a/libsimple/posix_memalign.h b/libsimple/posix_memalign.h
index 78924de..f537d93 100644
--- a/libsimple/posix_memalign.h
+++ b/libsimple/posix_memalign.h
@@ -24,6 +24,8 @@
* @throws EINVAL `n` is 0, `alignment` is not a power of 2, or
* `alignment` is not a multiple of `sizeof(void *)`
* @throws ENOMEM Could not allocated enough memory
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__(1))))
inline int
@@ -59,6 +61,8 @@ libsimple_vposix_memalignn(void **memptr__, size_t alignment__, size_t n__, va_l
* @throws EINVAL `n` is 0, `alignment` is not a power of 2, or
* `alignment` is not a multiple of `sizeof(void *)`
* @throws ENOMEM Could not allocated enough memory
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__(1))))
inline int
@@ -90,6 +94,8 @@ libsimple_posix_memalignn(void **memptr__, size_t alignment__, size_t n__, ... /
* of `sizeof(void *)`
* @param n The number of bytes to allocate, the behaviour of
* this function is unspecified for the value 0
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__(2))))
inline void
@@ -124,6 +130,8 @@ libsimple_enposix_memalign(int status__, void **memptr__, size_t alignment__, si
* @param ap The rest of the factors for the allocation size,
* all arguments should have the type `size_t`, and
* list must end with 0 (which is not factor)
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__(2))))
inline void
@@ -158,6 +166,8 @@ libsimple_envposix_memalignn(int status__, void **memptr__, size_t alignment__,
* @param ... The rest of the factors for the allocation size,
* all arguments should have the type `size_t`, and
* list must end with 0 (which is not factor)
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__(2))))
inline void
@@ -188,6 +198,8 @@ libsimple_enposix_memalignn(int status__, void **memptr__, size_t alignment__, s
* of `sizeof(void *)`
* @param n The number of bytes to allocate, the behaviour of
* this function is unspecified for the value 0
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__(1))))
inline void
@@ -221,6 +233,8 @@ libsimple_eposix_memalign(void **memptr__, size_t alignment__, size_t n__)
* @param ap The rest of the factors for the allocation size,
* all arguments should have the type `size_t`, and
* list must end with 0 (which is not factor)
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__(1))))
inline void
@@ -254,6 +268,8 @@ libsimple_evposix_memalignn(void **memptr__, size_t alignment__, size_t n__, va_
* @param ... The rest of the factors for the allocation size,
* all arguments should have the type `size_t`, and
* list must end with 0 (which is not factor)
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__(1))))
inline void
diff --git a/libsimple/posix_memalignz.h b/libsimple/posix_memalignz.h
index eb3e138..cf23cd0 100644
--- a/libsimple/posix_memalignz.h
+++ b/libsimple/posix_memalignz.h
@@ -25,6 +25,8 @@
* @throws EINVAL `n` is 0, `alignment` is not a power of 2, or
* `alignment` is not a multiple of `sizeof(void *)`
* @throws ENOMEM Could not allocated enough memory
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__(1))))
int libsimple_vposix_memalignzn(void **, int, size_t, size_t, va_list);
@@ -51,6 +53,8 @@ int libsimple_vposix_memalignzn(void **, int, size_t, size_t, va_list);
* @throws EINVAL `n` is 0, `alignment` is not a power of 2, or
* `alignment` is not a multiple of `sizeof(void *)`
* @throws ENOMEM Could not allocated enough memory
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__(1))))
inline int
@@ -90,6 +94,8 @@ libsimple_posix_memalignz(void **memptr__, int clear__, size_t alignment__, size
* @throws EINVAL `n` is 0, `alignment` is not a power of 2, or
* `alignment` is not a multiple of `sizeof(void *)`
* @throws ENOMEM Could not allocated enough memory
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__(1))))
inline int
@@ -122,6 +128,8 @@ libsimple_posix_memalignzn(void **memptr__, int clear__, size_t alignment__, siz
* of `sizeof(void *)`
* @param n The number of bytes to allocate, the behaviour of
* this function is unspecified for the value 0
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__(2))))
void libsimple_enposix_memalignz(int, void **, int, size_t, size_t);
@@ -153,6 +161,8 @@ void libsimple_enposix_memalignz(int, void **, int, size_t, size_t);
* @param ap The rest of the factors for the allocation size,
* all arguments should have the type `size_t`, and
* list must end with 0 (which is not factor)
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__(2))))
void libsimple_envposix_memalignzn(int, void **, int, size_t, size_t, va_list);
@@ -184,6 +194,8 @@ void libsimple_envposix_memalignzn(int, void **, int, size_t, size_t, va_list);
* @param ... The rest of the factors for the allocation size,
* all arguments should have the type `size_t`, and
* list must end with 0 (which is not factor)
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__(2))))
inline void
@@ -215,6 +227,8 @@ libsimple_enposix_memalignzn(int status__, void **memptr__, int clear__, size_t
* of `sizeof(void *)`
* @param n The number of bytes to allocate, the behaviour of
* this function is unspecified for the value 0
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__(1))))
inline void
@@ -249,6 +263,8 @@ libsimple_eposix_memalignz(void **memptr__, int clear__, size_t alignment__, siz
* @param ap The rest of the factors for the allocation size,
* all arguments should have the type `size_t`, and
* list must end with 0 (which is not factor)
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__(1))))
inline void
@@ -283,6 +299,8 @@ libsimple_evposix_memalignzn(void **memptr__, int clear__, size_t alignment__, s
* @param ... The rest of the factors for the allocation size,
* all arguments should have the type `size_t`, and
* list must end with 0 (which is not factor)
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__(1))))
inline void
diff --git a/libsimple/printf.h b/libsimple/printf.h
index d27a380..dd31857 100644
--- a/libsimple/printf.h
+++ b/libsimple/printf.h
@@ -5,6 +5,8 @@
* Exit value for `libsimple_eprintf`
*
* Default value is 1
+ *
+ * @since 1.0
*/
extern int libsimple_default_failure_exit;
@@ -18,6 +20,8 @@ extern int libsimple_default_failure_exit;
* it was when `libsimple_vweprintf` was called.
*
* Default value is `NULL`
+ *
+ * @since 1.1
*/
extern void (*libsimple_eprintf_preprint)(void);
@@ -31,6 +35,8 @@ extern void (*libsimple_eprintf_preprint)(void);
* it was when `libsimple_vweprintf` was called.
*
* Default value is `NULL`
+ *
+ * @since 1.1
*/
extern void (*libsimple_eprintf_postprint)(void);
@@ -50,6 +56,8 @@ extern void (*libsimple_eprintf_postprint)(void);
* @throws EMFILE {FOPEN_MAX} streams are currently open in the calling process
* @throws ENOMEM Could not allocate enough memory
* @throws Any error specified for `fprintf`
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__(1, 2), __format__(__printf__, 2, 3))))
int libsimple_asprintf(char **, const char *, ...);
@@ -73,6 +81,8 @@ int libsimple_asprintf(char **, const char *, ...);
* @throws EMFILE {FOPEN_MAX} streams are currently open in the calling process
* @throws ENOMEM Could not allocate enough memory
* @throws Any error specified for `fprintf`
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__(1, 2), __format__(__printf__, 2, 0))))
int libsimple_vasprintf(char **, const char *, va_list);
@@ -93,6 +103,8 @@ int libsimple_vasprintf(char **, const char *, va_list);
* @param ... The format argument
* @return The formatted string, `NULL` on error
* @throws Any error specified for `snprintf`
+ *
+ * @since 1.0
*/
#if defined(__GNUC__) || defined(__clang__)
# define libsimple_asprintfa(fmt__, ...)\
@@ -125,6 +137,8 @@ int libsimple_vasprintf(char **, const char *, va_list);
* @param ap The format argument
* @return The formatted string, `NULL` on error
* @throws Any error specified for `snprintf`
+ *
+ * @since 1.0
*/
#if defined(__GNUC__) || defined(__clang__)
# define libsimple_vasprintfa(fmt__, ap__)\
@@ -168,6 +182,8 @@ int libsimple_vasprintf(char **, const char *, va_list);
*
* @param fmt The format string
* @param ap The format argument
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__(1), __format__(__printf__, 1, 0))))
void libsimple_vweprintf(const char *, va_list);
@@ -192,6 +208,8 @@ void libsimple_vweprintf(const char *, va_list);
*
* @param fmt The format string
* @param ... The format argument
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__(1), __format__(__printf__, 1, 2))))
inline void
@@ -226,6 +244,8 @@ libsimple_weprintf(const char *fmt__, ...)
* @param status Exit value for the process
* @param fmt The format string
* @param ap The format argument
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__(2), __format__(__printf__, 2, 0))))
inline LIBSIMPLE_NORETURN void
@@ -258,6 +278,8 @@ libsimple_venprintf(int status__, const char *fmt__, va_list ap__)
* @param status Exit value for the process
* @param fmt The format string
* @param ... The format argument
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__(2), __format__(__printf__, 2, 3))))
inline LIBSIMPLE_NORETURN void
@@ -292,6 +314,8 @@ libsimple_enprintf(int status__, const char *fmt__, ...)
*
* @param fmt The format string
* @param ap The format argument
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__(1), __format__(__printf__, 1, 0))))
inline LIBSIMPLE_NORETURN void
@@ -324,6 +348,8 @@ libsimple_veprintf(const char *fmt__, va_list ap__)
*
* @param fmt The format string
* @param ... The format argument
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__(1), __format__(__printf__, 1, 2))))
inline LIBSIMPLE_NORETURN void
diff --git a/libsimple/pvalloc.h b/libsimple/pvalloc.h
index bc23e85..84aadef 100644
--- a/libsimple/pvalloc.h
+++ b/libsimple/pvalloc.h
@@ -20,6 +20,8 @@
* and with page size alignment; `NULL` on failure
* @throws EINVAL `n` is 0
* @throws ENOMEM Could not allocated enough memory
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __warn_unused_result__)))
inline void *
@@ -45,6 +47,8 @@ libsimple_vpvallocn(size_t n__, va_list ap__)
* and with page size alignment; `NULL` on failure
* @throws EINVAL `n` is 0
* @throws ENOMEM Could not allocated enough memory
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __warn_unused_result__)))
inline void *
@@ -76,6 +80,8 @@ libsimple_pvalloc(size_t n__)
* and with page size alignment; `NULL` on failure
* @throws EINVAL `n` is 0
* @throws ENOMEM Could not allocated enough memory
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __warn_unused_result__)))
inline void *
@@ -108,6 +114,8 @@ libsimple_pvallocn(size_t n__, ... /*, (size_t)0 */)
* @return A unique pointer with at least the specified size,
* rounded up to the next multiple of the page size,
* and with page size alignment
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __warn_unused_result__, __returns_nonnull__)))
inline void *
@@ -142,6 +150,8 @@ libsimple_enpvalloc(int status__, size_t n__)
* @return A unique pointer with at least the specified size,
* rounded up to the next multiple of the page size,
* and with page size alignment
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __warn_unused_result__, __returns_nonnull__)))
inline void *
@@ -176,6 +186,8 @@ libsimple_envpvallocn(int status__, size_t n__, va_list ap__)
* @return A unique pointer with at least the specified size,
* rounded up to the next multiple of the page size,
* and with page size alignment
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __warn_unused_result__, __returns_nonnull__)))
inline void *
@@ -207,6 +219,8 @@ libsimple_enpvallocn(int status__, size_t n__, ... /*, (size_t)0 */)
* @return A unique pointer with at least the specified size,
* rounded up to the next multiple of the page size,
* and with page size alignment
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __warn_unused_result__, __returns_nonnull__)))
inline void *
@@ -240,6 +254,8 @@ libsimple_epvalloc(size_t n__)
* @return A unique pointer with at least the specified size,
* rounded up to the next multiple of the page size,
* and with page size alignment
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __warn_unused_result__, __returns_nonnull__)))
inline void *
@@ -273,6 +289,8 @@ libsimple_evpvallocn(size_t n__, va_list ap__)
* @return A unique pointer with at least the specified size,
* rounded up to the next multiple of the page size,
* and with page size alignment
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __warn_unused_result__, __returns_nonnull__)))
inline void *
diff --git a/libsimple/pvallocz.h b/libsimple/pvallocz.h
index 6b4eaf6..a4a6498 100644
--- a/libsimple/pvallocz.h
+++ b/libsimple/pvallocz.h
@@ -21,6 +21,8 @@
* and with page size alignment; `NULL` on failure
* @throws EINVAL `n` is 0
* @throws ENOMEM Could not allocated enough memory
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __warn_unused_result__)))
inline void *
@@ -51,6 +53,8 @@ libsimple_vpvalloczn(int clear__, size_t n__, va_list ap__)
* and with page size alignment; `NULL` on failure
* @throws EINVAL `n` is 0
* @throws ENOMEM Could not allocated enough memory
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __alloc_size__(2), __warn_unused_result__)))
inline void *
@@ -87,6 +91,8 @@ libsimple_pvallocz(int clear__, size_t n__)
* and with page size alignment; `NULL` on failure
* @throws EINVAL `n` is 0
* @throws ENOMEM Could not allocated enough memory
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __warn_unused_result__)))
inline void *
@@ -120,6 +126,8 @@ libsimple_pvalloczn(int clear__, size_t n__, ... /*, (size_t)0 */)
* @return A unique pointer with at least the specified size,
* rounded up to the next multiple of the page size,
* and with page size alignment
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __alloc_size__(3), __warn_unused_result__, __returns_nonnull__)))
inline void *
@@ -160,6 +168,8 @@ libsimple_enpvallocz(int status__, int clear__, size_t n__)
* @return A unique pointer with at least the specified size,
* rounded up to the next multiple of the page size,
* and with page size alignment
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __warn_unused_result__, __returns_nonnull__)))
inline void *
@@ -201,6 +211,8 @@ libsimple_envpvalloczn(int status__, int clear__, size_t n__, va_list ap__)
* @return A unique pointer with at least the specified size,
* rounded up to the next multiple of the page size,
* and with page size alignment
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __warn_unused_result__, __returns_nonnull__)))
inline void *
@@ -233,6 +245,8 @@ libsimple_enpvalloczn(int status__, int clear__, size_t n__, ... /*, (size_t)0 *
* @return A unique pointer with at least the specified size,
* rounded up to the next multiple of the page size,
* and with page size alignment
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __alloc_size__(2), __warn_unused_result__, __returns_nonnull__)))
inline void *
@@ -267,6 +281,8 @@ libsimple_epvallocz(int clear__, size_t n__)
* @return A unique pointer with at least the specified size,
* rounded up to the next multiple of the page size,
* and with page size alignment
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __warn_unused_result__, __returns_nonnull__)))
inline void *
@@ -301,6 +317,8 @@ libsimple_evpvalloczn(int clear__, size_t n__, va_list ap__)
* @return A unique pointer with at least the specified size,
* rounded up to the next multiple of the page size,
* and with page size alignment
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __warn_unused_result__, __returns_nonnull__)))
inline void *
diff --git a/libsimple/realloc.h b/libsimple/realloc.h
index 4f780d5..37d4031 100644
--- a/libsimple/realloc.h
+++ b/libsimple/realloc.h
@@ -25,6 +25,8 @@
* `alignof(max_align_t)`; `NULL` on failure
* @throws EINVAL `n` is 0
* @throws ENOMEM Could not allocated enough memory
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__warn_unused_result__)))
void *libsimple_vreallocn(void *, size_t, va_list);
@@ -57,6 +59,8 @@ void *libsimple_vreallocn(void *, size_t, va_list);
* `alignof(max_align_t)`; `NULL` on failure
* @throws EINVAL `n` is 0
* @throws ENOMEM Could not allocated enough memory
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__warn_unused_result__)))
inline void *
@@ -94,6 +98,8 @@ libsimple_reallocn(void *ptr__, size_t n__, ... /*, (size_t)0 */)
* @return Either `ptr` or a unique pointer with at least
* the specified size and with the alignment
* `alignof(max_align_t)`
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__alloc_size__(3), __warn_unused_result__, __returns_nonnull__)))
void *libsimple_enrealloc(int, void *, size_t);
@@ -129,6 +135,8 @@ void *libsimple_enrealloc(int, void *, size_t);
* @return Either `ptr` or a unique pointer with at least
* the specified size and with the alignment
* `alignof(max_align_t)`
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__warn_unused_result__, __returns_nonnull__)))
void *libsimple_envreallocn(int, void *, size_t, va_list);
@@ -164,6 +172,8 @@ void *libsimple_envreallocn(int, void *, size_t, va_list);
* @return Either `ptr` or a unique pointer with at least
* the specified size and with the alignment
* `alignof(max_align_t)`
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__warn_unused_result__, __returns_nonnull__)))
inline void *
@@ -200,6 +210,8 @@ libsimple_enreallocn(int status__, void *ptr__, size_t n__, ... /*, (size_t)0 */
* @return Either `ptr` or a unique pointer with at least
* the specified size and with the alignment
* `alignof(max_align_t)`
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__alloc_size__(2), __warn_unused_result__, __returns_nonnull__)))
inline void *
@@ -238,6 +250,8 @@ libsimple_erealloc(void *ptr__, size_t n__)
* @return Either `ptr` or a unique pointer with at least
* the specified size and with the alignment
* `alignof(max_align_t)`
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__warn_unused_result__, __returns_nonnull__)))
inline void *
@@ -276,6 +290,8 @@ libsimple_evreallocn(void *ptr__, size_t n__, va_list ap__)
* @return Either `ptr` or a unique pointer with at least
* the specified size and with the alignment
* `alignof(max_align_t)`
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__warn_unused_result__, __returns_nonnull__)))
inline void *
@@ -312,6 +328,8 @@ libsimple_ereallocn(void *ptr__, size_t n__, ... /*, (size_t)0 */)
* `alignof(max_align_t)`; `NULL` on failure
* @throws EINVAL `n` is 0
* @throws ENOMEM Could not allocated enough memory
+ *
+ * @since 1.2
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__alloc_size__(2), __warn_unused_result__)))
inline void *
@@ -350,6 +368,8 @@ libsimple_reallocf(void *ptr__, size_t n__)
* `alignof(max_align_t)`; `NULL` on failure
* @throws EINVAL `n` or `m` is 0
* @throws ENOMEM Could not allocated enough memory
+ *
+ * @since 1.2
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__alloc_size__(2, 3), __warn_unused_result__)))
inline void *
@@ -391,6 +411,8 @@ libsimple_reallocarray(void *ptr__, size_t n__, size_t m__)
* @return Either `ptr` or a unique pointer with at least
* the specified size and with the alignment
* `alignof(max_align_t)`
+ *
+ * @since 1.2
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__alloc_size__(3, 4), __warn_unused_result__, __returns_nonnull__)))
void *libsimple_enreallocarray(int, void *, size_t, size_t);
@@ -424,6 +446,8 @@ void *libsimple_enreallocarray(int, void *, size_t, size_t);
* @return Either `ptr` or a unique pointer with at least
* the specified size and with the alignment
* `alignof(max_align_t)`
+ *
+ * @since 1.2
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__alloc_size__(2, 3), __warn_unused_result__, __returns_nonnull__)))
inline void *
@@ -459,6 +483,8 @@ libsimple_ereallocarray(void *ptr__, size_t n__, size_t m__)
* `alignof(max_align_t)`; `NULL` on failure
* @throws EINVAL `n` or `m` is 0
* @throws ENOMEM Could not allocated enough memory
+ *
+ * @since 1.2
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__alloc_size__(2, 3), __warn_unused_result__)))
inline void *
@@ -498,6 +524,8 @@ libsimple_reallocarrayf(void *ptr__, size_t n__, size_t m__)
* `alignof(max_align_t)`; `NULL` on failure
* @throws EINVAL `n` is 0
* @throws ENOMEM Could not allocated enough memory
+ *
+ * @since 1.2
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__warn_unused_result__)))
inline void *
@@ -537,6 +565,8 @@ libsimple_vreallocfn(void *ptr__, size_t n__, va_list ap__)
* `alignof(max_align_t)`; `NULL` on failure
* @throws EINVAL `n` is 0
* @throws ENOMEM Could not allocated enough memory
+ *
+ * @since 1.2
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__warn_unused_result__)))
inline void *
diff --git a/libsimple/search.h b/libsimple/search.h
index 19c1f85..bbd4f97 100644
--- a/libsimple/search.h
+++ b/libsimple/search.h
@@ -26,6 +26,8 @@
*
* @seealso bsearch(3p)
* @seealso libsimple_bindex_r(3p)
+ *
+ * @since 1.4
*/
ssize_t libsimple_bindex(const void *key, const void *base, size_t nel, size_t width, /* TODO man */
int (*compar)(const void *, const void *));
@@ -61,6 +63,8 @@ ssize_t libsimple_bindex(const void *key, const void *base, size_t nel, size_t w
*
* @seealso bsearch(3p)
* @seealso libsimple_bindex(3p)
+ *
+ * @since 1.4
*/
ssize_t libsimple_bindex_r(const void *key, const void *base, size_t nel, size_t width, /* TODO man */
int (*compar)(const void *, const void *, void *), void *arg);
diff --git a/libsimple/str.h b/libsimple/str.h
index b0345bd..8970bf7 100644
--- a/libsimple/str.h
+++ b/libsimple/str.h
@@ -8,6 +8,8 @@
* @param c The character to scan for
* @return `s` with a minimal offset such that `*r == c || !*r`,
* where `r` is the returned pointer
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __nonnull__, __returns_nonnull__, __warn_unused_result__)))
char *libsimple_strchrnul(const char *, int);
@@ -23,6 +25,8 @@ char *libsimple_strchrnul(const char *, int);
* @param c The character to scan for
* @return `s` with a minimal offset such that `tolower(*r) == tolower(c)`,
* where `r` is the returned pointer, `NULL` if no such offset exists
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __nonnull__, __warn_unused_result__)))
char *libsimple_strcasechr(const char *, int);
@@ -38,6 +42,8 @@ char *libsimple_strcasechr(const char *, int);
* @param c The character to scan for
* @return `s` with a minimal offset such that `tolower(*r) == tolower(c) || !*r`,
* where `r` is the returned pointer
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __nonnull__, __returns_nonnull__, __warn_unused_result__)))
char *libsimple_strcasechrnul(const char *, int);
@@ -53,6 +59,8 @@ char *libsimple_strcasechrnul(const char *, int);
* @param c The character to scan for
* @return `s` with a maximal offset such that `tolower(*r) == tolower(c)`,
* where `r` is the returned pointer, `NULL` if no such offset exists
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __nonnull__, __warn_unused_result__)))
char *libsimple_strrcasechr(const char *, int);
@@ -69,6 +77,8 @@ char *libsimple_strrcasechr(const char *, int);
* @param c The character to skip over
* @return `s` with a minimal offset such that `*r != c`, where `r`
* is the returned pointer, `NULL` if no such offset exists
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __nonnull__, __warn_unused_result__)))
char *libsimple_strchr_inv(const char *, int);
@@ -85,6 +95,8 @@ char *libsimple_strchr_inv(const char *, int);
* @param c The character to skip over
* @return `s` with a minimal offset such that `*r != c || !*r`,
* where `r` is the returned pointer
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __nonnull__, __returns_nonnull__, __warn_unused_result__)))
char *libsimple_strchrnul_inv(const char *, int);
@@ -101,6 +113,8 @@ char *libsimple_strchrnul_inv(const char *, int);
* @param c The character to skip over
* @return `s` with a minimal offset such that `tolower(*r) != tolower(c)`,
* where `r` is the returned pointer, `NULL` if no such offset exists
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __nonnull__, __warn_unused_result__)))
char *libsimple_strcasechr_inv(const char *, int);
@@ -117,6 +131,8 @@ char *libsimple_strcasechr_inv(const char *, int);
* @param c The character to skip over
* @return `s` with a minimal offset such that `tolower(*r) != tolower(c) || !*r`,
* where `r` is the returned pointer
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __nonnull__, __returns_nonnull__, __warn_unused_result__)))
char *libsimple_strcasechrnul_inv(const char *, int);
@@ -133,6 +149,8 @@ char *libsimple_strcasechrnul_inv(const char *, int);
* @param c The character to skip over
* @return `s` with a maximal offset such that `*r != c`, where `r`
* is the returned pointer, `NULL` if no such offset exists
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __nonnull__, __warn_unused_result__)))
char *libsimple_strrchr_inv(const char *, int);
@@ -149,6 +167,8 @@ char *libsimple_strrchr_inv(const char *, int);
* @param c The character to skip over
* @return `s` with a maximal offset such that `tolower(*r) != tolower(c)`,
* where `r` is the returned pointer, `NULL` if no such offset exists
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __nonnull__, __warn_unused_result__)))
char *libsimple_strrcasechr_inv(const char *, int);
@@ -162,6 +182,8 @@ char *libsimple_strrcasechr_inv(const char *, int);
*
* @param s The string
* @return `s` with an offset such `!*r`, where `r` is the returned pointer
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __nonnull__, __warn_unused_result__)))
inline char *
@@ -180,6 +202,8 @@ libsimple_strend(const char *s__)
* @param s The string the check
* @param t The string `s` should begin with
* @return 1 if `s` starts with `t`, 0 otherwise
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __nonnull__, __warn_unused_result__)))
int libsimple_strstarts(const char *, const char *);
@@ -194,6 +218,8 @@ int libsimple_strstarts(const char *, const char *);
* @param s The string the check
* @param t The string `s` should begin with
* @return 1 if `s` starts with `t`, 0 otherwise
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __nonnull__, __warn_unused_result__)))
inline int
@@ -212,6 +238,8 @@ libsimple_strcasestarts(const char *s__, const char *t__)
* @param s The string the check
* @param t The string `s` should begin with
* @return 1 if `s` ends with `t`, 0 otherwise
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __nonnull__, __warn_unused_result__)))
int libsimple_strends(const char *, const char *);
@@ -226,6 +254,8 @@ int libsimple_strends(const char *, const char *);
* @param s The string the check
* @param t The string `s` should begin with
* @return 1 if `s` end with `t`, 0 otherwise
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __nonnull__, __warn_unused_result__)))
int libsimple_strcaseends(const char *, const char *);
@@ -242,6 +272,8 @@ int libsimple_strcaseends(const char *, const char *);
* @return `haystack` with a maximal offset such that the returned
* pointer begins with `needle`, `NULL` if no such offset
* exists
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __nonnull__, __warn_unused_result__)))
char *libsimple_strrstr(const char *, const char *);
@@ -258,6 +290,8 @@ char *libsimple_strrstr(const char *, const char *);
* @return `haystack` with a minimal offset such that the returned
* pointer begins with `needle`, `NULL` if no such offset
* exists
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __nonnull__, __warn_unused_result__)))
char *libsimple_strcasestr(const char *, const char *);
@@ -274,6 +308,8 @@ char *libsimple_strcasestr(const char *, const char *);
* @return `haystack` with a maximal offset such that the returned
* pointer begins with `needle`, `NULL` if no such offset
* exists
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __nonnull__, __warn_unused_result__)))
char *libsimple_strrcasestr(const char *, const char *);
@@ -291,6 +327,8 @@ char *libsimple_strrcasestr(const char *, const char *);
* @return A negative value if `a` is less than `b`,
* a positive value if `a` is greater than `b`,
* 0 otherwise
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __warn_unused_result__)))
inline int
@@ -312,6 +350,8 @@ libsimple_strcmpnul(const char *a__, const char *b__)
* @return A negative value if `a` is less than `b`,
* a positive value if `a` is greater than `b`,
* 0 otherwise
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __warn_unused_result__)))
inline int
@@ -331,6 +371,8 @@ libsimple_strcasecmpnul(const char *a__, const char *b__)
* @param a One of the strings, may not be `NULL`
* @param b The other string, may not be `NULL`
* @return 1 if the strings are equal, 0 otherwise
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __nonnull__, __warn_unused_result__)))
inline int
@@ -350,6 +392,8 @@ libsimple_streq(const char *a__, const char *b__)
* @param a One of the strings, may be `NULL`
* @param b The other string, may be `NULL`
* @return 1 if the strings are equal, 0 otherwise
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __warn_unused_result__)))
inline int
@@ -369,6 +413,8 @@ libsimple_streqnul(const char *a__, const char *b__)
* @param a One of the strings, may not be `NULL`
* @param b The other string, may not be `NULL`
* @return 1 if the strings are equal, 0 otherwise
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __nonnull__, __warn_unused_result__)))
inline int
@@ -388,6 +434,8 @@ libsimple_strcaseeq(const char *a__, const char *b__)
* @param a One of the strings, may be `NULL`
* @param b The other string, may be `NULL`
* @return 1 if the strings are equal, 0 otherwise
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __warn_unused_result__)))
inline int
@@ -407,6 +455,8 @@ libsimple_strcaseeqnul(const char *a__, const char *b__)
* @param b The other string
* @return The number of bytes `a` and `b` have
* in common in their beginnings
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __nonnull__, __warn_unused_result__)))
size_t libsimple_streqlen(const char *, const char *);
@@ -422,6 +472,8 @@ size_t libsimple_streqlen(const char *, const char *);
* @param b The other string
* @return The number of bytes `a` and `b` have
* in common in their beginnings
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __nonnull__, __warn_unused_result__)))
size_t libsimple_strcaseeqlen(const char *, const char *);
@@ -437,6 +489,8 @@ size_t libsimple_strcaseeqlen(const char *, const char *);
* @param b The other string
* @return The number of bytes `a` and `b` have
* in common in their ends
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __nonnull__, __warn_unused_result__)))
inline size_t
@@ -456,6 +510,8 @@ libsimple_strreqlen(const char *a__, const char *b__)
* @param b The other string
* @return The number of bytes `a` and `b` have
* in common in their ends
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __nonnull__, __warn_unused_result__)))
inline size_t
@@ -475,6 +531,8 @@ libsimple_strrcaseeqlen(const char *a__, const char *b__)
* @param s The string to look in
* @return 1 if the byte `c` is not the NUL byte and can be found in `s`,
* 0 otherwise
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __nonnull__, __warn_unused_result__)))
inline int
@@ -494,6 +552,8 @@ libsimple_inchrset(int c__, const char *s__)
* @param s The string to look in
* @return 1 if the byte `c` is not the NUL byte and can be found in `s`,
* 0 otherwise
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __nonnull__, __warn_unused_result__)))
inline int
@@ -513,6 +573,8 @@ libsimple_inchrcaseset(int c__, const char *s__)
* string should be moved to
* @param s The string to move
* @return `d`
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__)))
inline char *
@@ -532,6 +594,8 @@ libsimple_strmove(char *d__, const char *s__)
* string should be moved to
* @param s The string to move
* @return `&d[strlen(s)]` (this byte will be a NUL byte)
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__)))
inline char *
@@ -552,6 +616,8 @@ libsimple_stpmove(char *d__, const char *s__)
* @param s The string to fill
* @param c The byte to replace all bytes in `s` with
* @return `s`
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__)))
inline char *
@@ -572,6 +638,8 @@ libsimple_strset(char *s__, int c___)
* @param s The string to fill
* @param c The byte to replace all bytes in `s` with
* @return `&s[strlen(s)]`
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__)))
inline char *
@@ -595,6 +663,8 @@ libsimple_stpset(char *s__, int c___)
* @param c The character that stops the copying
* @return `&strchr(d, c)[1]` (after copying) if `c` can be
* found in `s`, `NULL` otherwise
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__)))
inline char *
@@ -622,6 +692,8 @@ libsimple_strccpy(char *restrict d__, const char *restrict s__, int c___)
* @param c The character that stops the copying
* @return `&strchr(d, c)[1]` (after copying) if `c` can be
* found in `s` (before copying), `NULL` otherwise
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__)))
char *libsimple_strcmove(char *, const char *, int);
@@ -638,6 +710,8 @@ char *libsimple_strcmove(char *, const char *, int);
* @param old The value of the characters to replace
* @param new The value to replace the characters with
* @return `strchr(s, '\0')`
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__, __returns_nonnull__)))
inline char *
@@ -665,6 +739,8 @@ libsimple_strreplace(char *s__, int old___, int new___)
* @param d The location the string shall be copied to
* @param s The string to copy
* @return `strchr(d, '\0')` (after copying)
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__, __returns_nonnull__)))
char *libsimple_stptolower(char *, const char *);
@@ -684,6 +760,8 @@ char *libsimple_stptolower(char *, const char *);
* @param d The location the string shall be copied to
* @param s The string to copy
* @return `strchr(d, '\0')` (after copying)
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__, __returns_nonnull__)))
char *libsimple_stptoupper(char *, const char *);
@@ -703,6 +781,8 @@ char *libsimple_stptoupper(char *, const char *);
* @param d The location the string shall be copied to
* @param s The string to copy
* @return `d`
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__, __returns_nonnull__)))
inline char *
@@ -727,6 +807,8 @@ libsimple_strtolower(char *d__, const char *s__)
* @param d The location the string shall be copied to
* @param s The string to copy
* @return `d`
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__, __returns_nonnull__)))
inline char *
@@ -747,6 +829,8 @@ libsimple_strtoupper(char *d__, const char *s__)
* @param allow_modified_nul Whether Modified UTF-8 is allowed, which
* allows a two-byte encoding for NUL
* @return 1 if good, 0 on encoding error
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __nonnull__, __warn_unused_result__)))
inline int
diff --git a/libsimple/strdup.h b/libsimple/strdup.h
index cf48119..ed1e9e4 100644
--- a/libsimple/strdup.h
+++ b/libsimple/strdup.h
@@ -6,6 +6,8 @@
*
* @param s:const char * The string to copy
* @return :char * Duplicate of `s` with automatic storage
+ *
+ * @since 1.0
*/
#if defined(__GNUC__) || defined(__clang__)
# define libsimple_strdupa(s)\
@@ -28,6 +30,8 @@
* @param status Exit value in case of failure
* @param s The string to copy
* @return Duplicate of `s`
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __assume_aligned__(1), __nonnull__, __warn_unused_result__, __returns_nonnull__)))
char *libsimple_enstrdup(int, const char *);
@@ -41,6 +45,8 @@ char *libsimple_enstrdup(int, const char *);
*
* @param s The string to copy
* @return Duplicate of `s`
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __assume_aligned__(1), __nonnull__, __warn_unused_result__, __returns_nonnull__)))
inline char *
diff --git a/libsimple/strn.h b/libsimple/strn.h
index a333ecd..91bce69 100644
--- a/libsimple/strn.h
+++ b/libsimple/strn.h
@@ -10,6 +10,8 @@
* @return `s` with a minimal offset such that `*r == c`,
* where `r` is the returned pointer, `NULL` if no such offset exists
* within the first `n` bytes
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __nonnull__, __warn_unused_result__)))
char *libsimple_strnchr(const char *, int, size_t);
@@ -27,6 +29,8 @@ char *libsimple_strnchr(const char *, int, size_t);
* @return `s` with a minimal offset such that `tolower(*r) == tolower(c)`,
* where `r` is the returned pointer, `NULL` if no such offset exists
* within the first `n` bytes
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __nonnull__, __warn_unused_result__)))
char *libsimple_strncasechr(const char *, int, size_t);
@@ -44,6 +48,8 @@ char *libsimple_strncasechr(const char *, int, size_t);
* @return `s` with a minimal offset such that `*r == c || !*r`,
* where `r` is the returned pointer, however if no such
* offset exists within the first `n` bytes, `&s[n]` is returned
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __nonnull__, __returns_nonnull__, __warn_unused_result__)))
char *libsimple_strnchrnul(const char *, int, size_t);
@@ -61,6 +67,8 @@ char *libsimple_strnchrnul(const char *, int, size_t);
* @return `s` with a minimal offset such that `tolower(*r) == tolower(c) || !*r`,
* where `r` is the returned pointer, however if no such offset
* exists within the first `n` bytes, `&s[n]` is returned
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __nonnull__, __returns_nonnull__, __warn_unused_result__)))
char *libsimple_strncasechrnul(const char *, int, size_t);
@@ -77,6 +85,8 @@ char *libsimple_strncasechrnul(const char *, int, size_t);
* @param n Truncate `s` to this length if it is longer
* @return `s` with a maximal offset such that `*r == c`,
* where `r` is the returned pointer, `NULL` if no such offset exists
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __nonnull__, __warn_unused_result__)))
char *libsimple_strrnchr(const char *, int, size_t);
@@ -94,6 +104,8 @@ char *libsimple_strrnchr(const char *, int, size_t);
* @param n Truncate `s` to this length if it is longer
* @return `s` with a maximal offset such that `tolower(*r) == tolower(c)`,
* where `r` is the returned pointer, `NULL` if no such offset exists
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __nonnull__, __warn_unused_result__)))
char *libsimple_strrncasechr(const char *, int, size_t);
@@ -112,6 +124,8 @@ char *libsimple_strrncasechr(const char *, int, size_t);
* @return `s` with a minimal offset such that `*r != c`,
* where `r` is the returned pointer, `NULL` if no such offset exists
* within the first `n` bytes
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __nonnull__, __warn_unused_result__)))
char *libsimple_strnchr_inv(const char *, int, size_t);
@@ -130,6 +144,8 @@ char *libsimple_strnchr_inv(const char *, int, size_t);
* @return `s` with a minimal offset such that `tolower(*r) != tolower(c)`,
* where `r` is the returned pointer, `NULL` if no such offset exists
* within the first `n` bytes
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __nonnull__, __warn_unused_result__)))
char *libsimple_strncasechr_inv(const char *, int, size_t);
@@ -148,6 +164,8 @@ char *libsimple_strncasechr_inv(const char *, int, size_t);
* @return `s` with a minimal offset such that `*r != c || !*r`,
* where `r` is the returned pointer, however if no such
* offset exists within the first `n` bytes, `&s[n]` is returned
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __nonnull__, __returns_nonnull__, __warn_unused_result__)))
char *libsimple_strnchrnul_inv(const char *, int, size_t);
@@ -166,6 +184,8 @@ char *libsimple_strnchrnul_inv(const char *, int, size_t);
* @return `s` with a minimal offset such that `tolower(*r) != tolower(c) || !*r`,
* where `r` is the returned pointer, however if no such offset
* exists within the first `n` bytes, `&s[n]` is returned
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __nonnull__, __returns_nonnull__, __warn_unused_result__)))
char *libsimple_strncasechrnul_inv(const char *, int, size_t);
@@ -183,6 +203,8 @@ char *libsimple_strncasechrnul_inv(const char *, int, size_t);
* @param n Truncate `s` to this length if it is longer
* @return `s` with a maximal offset such that `*r != c`,
* where `r` is the returned pointer, `NULL` if no such offset exists
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __nonnull__, __warn_unused_result__)))
char *libsimple_strrnchr_inv(const char *, int, size_t);
@@ -200,6 +222,8 @@ char *libsimple_strrnchr_inv(const char *, int, size_t);
* @param n Truncate `s` to this length if it is longer
* @return `s` with a maximal offset such that `tolower(*r) != tolower(c)`,
* where `r` is the returned pointer, `NULL` if no such offset exists
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __nonnull__, __warn_unused_result__)))
char *libsimple_strrncasechr_inv(const char *, int, size_t);
@@ -217,6 +241,8 @@ char *libsimple_strrncasechr_inv(const char *, int, size_t);
* is the returned pointer, however if there
* is not NUL byte within the first `n` bytes
* if `s`, `&s[n]` is returned
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __nonnull__, __returns_nonnull__, __warn_unused_result__)))
char *libsimple_strnend(const char *, size_t);
@@ -232,6 +258,8 @@ char *libsimple_strnend(const char *, size_t);
* @param t The string `s` should begin with
* @param n Truncate `s` to this length if it is longer
* @return 1 if `s` starts with `t`, 0 otherwise
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __nonnull__, __warn_unused_result__)))
int libsimple_strnstarts(const char *, const char *, size_t);
@@ -247,6 +275,8 @@ int libsimple_strnstarts(const char *, const char *, size_t);
* @param t The string `s` should begin with
* @param n Truncate `s` to this length if it is longer
* @return 1 if `s` starts with `t`, 0 otherwise
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __nonnull__, __warn_unused_result__)))
int libsimple_strncasestarts(const char *, const char *, size_t);
@@ -262,6 +292,8 @@ int libsimple_strncasestarts(const char *, const char *, size_t);
* @param t The string `s` should begin with
* @param n Truncate `s` to this length if it is longer
* @return 1 if `s` ends with `t`, 0 otherwise
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __nonnull__, __warn_unused_result__)))
int libsimple_strnends(const char *, const char *, size_t);
@@ -277,6 +309,8 @@ int libsimple_strnends(const char *, const char *, size_t);
* @param t The string `s` should begin with
* @param n Truncate `s` to this length if it is longer
* @return 1 if `s` end with `t`, 0 otherwise
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __nonnull__, __warn_unused_result__)))
int libsimple_strncaseends(const char *, const char *, size_t);
@@ -294,6 +328,8 @@ int libsimple_strncaseends(const char *, const char *, size_t);
* @return `haystack` with a minimal offset such that the returned
* pointer begins with `needle`, `NULL` if no such offset
* exists
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __nonnull__, __warn_unused_result__)))
char *libsimple_strnstr(const char *, const char *, size_t);
@@ -311,6 +347,8 @@ char *libsimple_strnstr(const char *, const char *, size_t);
* @return `haystack` with a minimal offset such that the returned
* pointer begins with `needle`, `NULL` if no such offset
* exists
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __nonnull__, __warn_unused_result__)))
char *libsimple_strncasestr(const char *, const char *, size_t);
@@ -328,6 +366,8 @@ char *libsimple_strncasestr(const char *, const char *, size_t);
* @return `haystack` with a maximal offset such that the returned
* pointer begins with `needle`, `NULL` if no such offset
* exists
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __nonnull__, __warn_unused_result__)))
char *libsimple_strrnstr(const char *, const char *, size_t);
@@ -345,6 +385,8 @@ char *libsimple_strrnstr(const char *, const char *, size_t);
* @return `haystack` with a maximal offset such that the returned
* pointer begins with `needle`, `NULL` if no such offset
* exists
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __nonnull__, __warn_unused_result__)))
char *libsimple_strrncasestr(const char *, const char *, size_t);
@@ -364,6 +406,8 @@ char *libsimple_strrncasestr(const char *, const char *, size_t);
* @return A negative value if `a` is less than `b`,
* a positive value if `a` is greater than `b`,
* 0 otherwise
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __warn_unused_result__)))
inline int
@@ -387,6 +431,8 @@ libsimple_strncmpnul(const char *a__, const char *b__, size_t n__)
* @return A negative value if `a` is less than `b`,
* a positive value if `a` is greater than `b`,
* 0 otherwise
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __warn_unused_result__)))
inline int
@@ -408,6 +454,8 @@ libsimple_strncasecmpnul(const char *a__, const char *b__, size_t n__)
* @param n Truncate each input string that is
* longer than this to this length
* @return 1 if the strings are equal, 0 otherwise
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __nonnull__, __warn_unused_result__)))
inline int
@@ -429,6 +477,8 @@ libsimple_strneq(const char *a__, const char *b__, size_t n__)
* @param n Truncate each input string that is
* longer than this to this length
* @return 1 if the strings are equal, 0 otherwise
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __warn_unused_result__)))
inline int
@@ -450,6 +500,8 @@ libsimple_strneqnul(const char *a__, const char *b__, size_t n__)
* @param n Truncate each input string that is
* longer than this to this length
* @return 1 if the strings are equal, 0 otherwise
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __nonnull__, __warn_unused_result__)))
inline int
@@ -471,6 +523,8 @@ libsimple_strncaseeq(const char *a__, const char *b__, size_t n__)
* @param n Truncate each input string that is
* longer than this to this length
* @return 1 if the strings are equal, 0 otherwise
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __warn_unused_result__)))
inline int
@@ -492,6 +546,8 @@ libsimple_strncaseeqnul(const char *a__, const char *b__, size_t n__)
* longer than this to this length
* @return The number of bytes `a` and `b` have
* in common in their beginnings
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __nonnull__, __warn_unused_result__)))
size_t libsimple_strneqlen(const char *, const char *, size_t);
@@ -509,6 +565,8 @@ size_t libsimple_strneqlen(const char *, const char *, size_t);
* longer than this to this length
* @return The number of bytes `a` and `b` have
* in common in their beginnings
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __nonnull__, __warn_unused_result__)))
size_t libsimple_strncaseeqlen(const char *, const char *, size_t);
@@ -526,6 +584,8 @@ size_t libsimple_strncaseeqlen(const char *, const char *, size_t);
* longer than this to this length
* @return The number of bytes `a` and `b` have
* in common in their ends
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __nonnull__, __warn_unused_result__)))
inline size_t
@@ -547,6 +607,8 @@ libsimple_strrneqlen(const char *a__, const char *b__, size_t n__)
* longer than this to this length
* @return The number of bytes `a` and `b` have
* in common in their ends
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __nonnull__, __warn_unused_result__)))
inline size_t
@@ -567,6 +629,8 @@ libsimple_strrncaseeqlen(const char *a__, const char *b__, size_t n__)
* @param s The string to move
* @param n The maximum number of bytes to move
* @return `d`
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__)))
inline char *
@@ -588,6 +652,8 @@ libsimple_strnmove(char *d__, const char *s__, size_t n__)
* @param s The string to move
* @param n The maximum number of bytes to move
* @return `&d[strnlen(s, n)]`
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__)))
inline char *
@@ -609,6 +675,8 @@ libsimple_stpnmove(char *d__, const char *s__, size_t n__)
* @param c The byte to replace all bytes in `s` with
* @param n The maximum number of bytes to write
* @return `s`
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__)))
inline char *
@@ -630,6 +698,8 @@ libsimple_strnset(char *s__, int c___, size_t n__)
* @param c The byte to replace all bytes in `s` with
* @param n The maximum number of bytes to write
* @return `&s[strnlen(s, n)]`
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__)))
inline char *
@@ -655,6 +725,8 @@ libsimple_stpnset(char *s__, int c___, size_t n__)
* @param n The maximum number of bytes to copy
* @return `&strchr(d, c)[1]` (after copying) if `c` can be
* found in `s`, `NULL` otherwise
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__)))
inline char *
@@ -688,6 +760,8 @@ libsimple_strnccpy(char *restrict d__, const char *restrict s__, int c___, size_
* @return `&strchr(d, c)[1]` (after copying) if `c` can be
* found within the first `n` bytes of `s` (before
* copying), `NULL` otherwise
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__)))
char *libsimple_strncmove(char *, const char *, int, size_t);
@@ -705,6 +779,8 @@ char *libsimple_strncmove(char *, const char *, int, size_t);
* @param new The value to replace the characters with
* @param n The maximum length of `s`
* @return `strnchr(s, '\0', n)`
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__, __returns_nonnull__)))
inline char *
@@ -733,6 +809,8 @@ libsimple_strnreplace(char *s__, int old___, int new___, size_t n__)
* @param s The string to copy
* @param n The maximum number of bytes to copy or convert
* @return `strnchrnul(d, '\0', n)` (after copying)
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__, __returns_nonnull__)))
char *libsimple_stpntolower(char *, const char *, size_t);
@@ -753,6 +831,8 @@ char *libsimple_stpntolower(char *, const char *, size_t);
* @param s The string to copy
* @param n The maximum number of bytes to copy or convert
* @return `strnchrnul(d, '\0', n)` (after copying)
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__, __returns_nonnull__)))
char *libsimple_stpntoupper(char *, const char *, size_t);
@@ -773,6 +853,8 @@ char *libsimple_stpntoupper(char *, const char *, size_t);
* @param s The string to copy
* @param n The maximum number of bytes to copy or convert
* @return `d`
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__, __returns_nonnull__)))
inline char *
@@ -798,6 +880,8 @@ libsimple_strntolower(char *d__, const char *s__, size_t n__)
* @param s The string to copy
* @param n The maximum number of bytes to copy or convert
* @return `d`
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__, __returns_nonnull__)))
inline char *
@@ -822,6 +906,8 @@ libsimple_strntoupper(char *d__, const char *s__, size_t n__)
* @param allow_modified_nul Whether Modified UTF-8 is allowed, which
* allows a two-byte encoding for NUL
* @return 1 if good, 0 on encoding error
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__pure__, __nonnull__, __warn_unused_result__)))
inline int
diff --git a/libsimple/strndup.h b/libsimple/strndup.h
index 70c3db5..3229e01 100644
--- a/libsimple/strndup.h
+++ b/libsimple/strndup.h
@@ -7,6 +7,8 @@
* @param s:const char * The string to copy
* @param n:size_t The maximum number of bytes to copy
* @return :char * Duplicate of `s` with automatic storage
+ *
+ * @since 1.0
*/
#if defined(__GNUC__) || defined(__clang__)
# define libsimple_strndupa(s, n)\
@@ -33,6 +35,8 @@
* @param s The string to copy
* @param n The maximum number of bytes to copy
* @return Duplicate of `s`
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __assume_aligned__(1), __nonnull__, __warn_unused_result__, __returns_nonnull__)))
char *libsimple_enstrndup(int, const char *, size_t);
@@ -47,6 +51,8 @@ char *libsimple_enstrndup(int, const char *, size_t);
* @param s The string to copy
* @param n The maximum number of bytes to copy
* @return Duplicate of `s`
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __assume_aligned__(1), __nonnull__, __warn_unused_result__, __returns_nonnull__)))
inline char *
diff --git a/libsimple/strtoint.h b/libsimple/strtoint.h
index d7fc292..a86a6fd 100644
--- a/libsimple/strtoint.h
+++ b/libsimple/strtoint.h
@@ -16,6 +16,8 @@
* if out of range (`errno` set to `ERANGE`), the
* closed value that can be represented; 0 on
* failure (unless `errno` not set to `ERANGE`)
+ *
+ * @since 1.4
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__(1), __warn_unused_result__)))
signed char libsimple_strtohh(const char *restrict, char **restrict, int);
@@ -39,6 +41,8 @@ signed char libsimple_strtohh(const char *restrict, char **restrict, int);
* if out of range (`errno` set to `ERANGE`), the
* closed value that can be represented; 0 on
* failure (unless `errno` not set to `ERANGE`)
+ *
+ * @since 1.4
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__(1), __warn_unused_result__)))
unsigned char libsimple_strtouhh(const char *restrict, char **restrict, int);
@@ -62,6 +66,8 @@ unsigned char libsimple_strtouhh(const char *restrict, char **restrict, int);
* if out of range (`errno` set to `ERANGE`), the
* closed value that can be represented; 0 on
* failure (unless `errno` not set to `ERANGE`)
+ *
+ * @since 1.4
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__(1), __warn_unused_result__)))
signed short int libsimple_strtoh(const char *restrict, char **restrict, int);
@@ -85,6 +91,8 @@ signed short int libsimple_strtoh(const char *restrict, char **restrict, int);
* if out of range (`errno` set to `ERANGE`), the
* closed value that can be represented; 0 on
* failure (unless `errno` not set to `ERANGE`)
+ *
+ * @since 1.4
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__(1), __warn_unused_result__)))
unsigned short int libsimple_strtouh(const char *restrict, char **restrict, int);
@@ -108,6 +116,8 @@ unsigned short int libsimple_strtouh(const char *restrict, char **restrict, int)
* if out of range (`errno` set to `ERANGE`), the
* closed value that can be represented; 0 on
* failure (unless `errno` not set to `ERANGE`)
+ *
+ * @since 1.4
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__(1), __warn_unused_result__)))
signed int libsimple_strtoi(const char *restrict, char **restrict, int);
@@ -131,6 +141,8 @@ signed int libsimple_strtoi(const char *restrict, char **restrict, int);
* if out of range (`errno` set to `ERANGE`), the
* closed value that can be represented; 0 on
* failure (unless `errno` not set to `ERANGE`)
+ *
+ * @since 1.4
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__(1), __warn_unused_result__)))
unsigned int libsimple_strtou(const char *restrict, char **restrict, int);
@@ -154,6 +166,8 @@ unsigned int libsimple_strtou(const char *restrict, char **restrict, int);
* if out of range (`errno` set to `ERANGE`), the
* closed value that can be represented; 0 on
* failure (unless `errno` not set to `ERANGE`)
+ *
+ * @since 1.4
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__(1), __warn_unused_result__)))
inline ssize_t
@@ -181,6 +195,8 @@ libsimple_strtoz(const char *restrict nptr__, char **restrict endptr__, int base
* if out of range (`errno` set to `ERANGE`), the
* closed value that can be represented; 0 on
* failure (unless `errno` not set to `ERANGE`)
+ *
+ * @since 1.4
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__(1), __warn_unused_result__)))
inline size_t
@@ -208,6 +224,8 @@ libsimple_strtouz(const char *restrict nptr__, char **restrict endptr__, int bas
* if out of range (`errno` set to `ERANGE`), the
* closed value that can be represented; 0 on
* failure (unless `errno` not set to `ERANGE`)
+ *
+ * @since 1.4
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__(1), __warn_unused_result__)))
int_least8_t libsimple_strtoi8(const char *restrict, char **restrict, int);
@@ -231,6 +249,8 @@ int_least8_t libsimple_strtoi8(const char *restrict, char **restrict, int);
* if out of range (`errno` set to `ERANGE`), the
* closed value that can be represented; 0 on
* failure (unless `errno` not set to `ERANGE`)
+ *
+ * @since 1.4
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__(1), __warn_unused_result__)))
uint_least8_t libsimple_strtou8(const char *restrict, char **restrict, int);
@@ -254,6 +274,8 @@ uint_least8_t libsimple_strtou8(const char *restrict, char **restrict, int);
* if out of range (`errno` set to `ERANGE`), the
* closed value that can be represented; 0 on
* failure (unless `errno` not set to `ERANGE`)
+ *
+ * @since 1.4
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__(1), __warn_unused_result__)))
int_least16_t libsimple_strtoi16(const char *restrict, char **restrict, int);
@@ -277,6 +299,8 @@ int_least16_t libsimple_strtoi16(const char *restrict, char **restrict, int);
* if out of range (`errno` set to `ERANGE`), the
* closed value that can be represented; 0 on
* failure (unless `errno` not set to `ERANGE`)
+ *
+ * @since 1.4
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__(1), __warn_unused_result__)))
uint_least16_t libsimple_strtou16(const char *restrict, char **restrict, int);
@@ -300,6 +324,8 @@ uint_least16_t libsimple_strtou16(const char *restrict, char **restrict, int);
* if out of range (`errno` set to `ERANGE`), the
* closed value that can be represented; 0 on
* failure (unless `errno` not set to `ERANGE`)
+ *
+ * @since 1.4
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__(1), __warn_unused_result__)))
int_least32_t libsimple_strtoi32(const char *restrict, char **restrict, int);
@@ -323,6 +349,8 @@ int_least32_t libsimple_strtoi32(const char *restrict, char **restrict, int);
* if out of range (`errno` set to `ERANGE`), the
* closed value that can be represented; 0 on
* failure (unless `errno` not set to `ERANGE`)
+ *
+ * @since 1.4
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__(1), __warn_unused_result__)))
uint_least32_t libsimple_strtou32(const char *restrict, char **restrict, int);
@@ -346,6 +374,8 @@ uint_least32_t libsimple_strtou32(const char *restrict, char **restrict, int);
* if out of range (`errno` set to `ERANGE`), the
* closed value that can be represented; 0 on
* failure (unless `errno` not set to `ERANGE`)
+ *
+ * @since 1.4
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__(1), __warn_unused_result__)))
int_least64_t libsimple_strtoi64(const char *restrict, char **restrict, int);
@@ -369,6 +399,8 @@ int_least64_t libsimple_strtoi64(const char *restrict, char **restrict, int);
* if out of range (`errno` set to `ERANGE`), the
* closed value that can be represented; 0 on
* failure (unless `errno` not set to `ERANGE`)
+ *
+ * @since 1.4
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__(1), __warn_unused_result__)))
uint_least64_t libsimple_strtou64(const char *restrict, char **restrict, int);
diff --git a/libsimple/time.h b/libsimple/time.h
index 6618d9d..b873635 100644
--- a/libsimple/time.h
+++ b/libsimple/time.h
@@ -12,6 +12,8 @@
* will be `{.tv_sec = TIME_MAX, .tv_nsec = 999999999L}` if the
* result too large and `{.tv_sec = TIME_MIN, .tv_nsec = 0L}`
* if the result too small
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__)))
int libsimple_sumtimespec(struct timespec *, const struct timespec *, const struct timespec *);
@@ -31,6 +33,8 @@ int libsimple_sumtimespec(struct timespec *, const struct timespec *, const stru
* will be `{.tv_sec = TIME_MAX, .tv_nsec = 999999999L}` if the
* result too large and `{.tv_sec = TIME_MIN, .tv_nsec = 0L}`
* if the result too small
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__)))
int libsimple_difftimespec(struct timespec *, const struct timespec *, const struct timespec *);
@@ -50,6 +54,8 @@ int libsimple_difftimespec(struct timespec *, const struct timespec *, const str
* will be `{.tv_sec = TIME_MAX, .tv_nsec = 999999999L}` if the
* result too large and `{.tv_sec = TIME_MIN, .tv_nsec = 0L}`
* if the result too small
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__)))
int libsimple_multimespec(struct timespec *, const struct timespec *, int);
@@ -64,6 +70,8 @@ int libsimple_multimespec(struct timespec *, const struct timespec *, int);
* @param a One of the `struct timespec`s
* @param b The other `struct timespec`
* @return -1 if `a` < `b`, 0 if `a` = `b`, and +1 if `a` > `b`
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__, __warn_unused_result__)))
inline int
@@ -89,6 +97,8 @@ libsimple_cmptimespec(const struct timespec *a__, const struct timespec *b__)
* will be `{.tv_sec = TIME_MAX, .tv_usec = 999999L}` if the
* result too large and `{.tv_sec = TIME_MIN, .tv_usec = 0L}`
* if the result too small
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__)))
int libsimple_sumtimeval(struct timeval *, const struct timeval *, const struct timeval *);
@@ -108,6 +118,8 @@ int libsimple_sumtimeval(struct timeval *, const struct timeval *, const struct
* will be `{.tv_sec = TIME_MAX, .tv_usec = 999999L}` if the
* result too large and `{.tv_sec = TIME_MIN, .tv_usec = 0L}`
* if the result too small
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__)))
int libsimple_difftimeval(struct timeval *, const struct timeval *, const struct timeval *);
@@ -127,6 +139,8 @@ int libsimple_difftimeval(struct timeval *, const struct timeval *, const struct
* will be `{.tv_sec = TIME_MAX, .tv_usec = 999999L}` if the
* result too large and `{.tv_sec = TIME_MIN, .tv_usec = 0L}`
* if the result too small
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__)))
int libsimple_multimeval(struct timeval *, const struct timeval *, int);
@@ -141,6 +155,8 @@ int libsimple_multimeval(struct timeval *, const struct timeval *, int);
* @param a One of the `struct timeval`s
* @param b The other `struct timeval`
* @return -1 if `a` < `b`, 0 if `a` = `b`, and +1 if `a` > `b`
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__, __warn_unused_result__)))
inline int
@@ -160,6 +176,8 @@ libsimple_cmptimeval(const struct timeval *a__, const struct timeval *b__)
*
* @param ts Output parameter for the result
* @param tv The value to convert
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__)))
inline void
@@ -182,6 +200,8 @@ libsimple_timeval2timespec(struct timespec *restrict ts__, const struct timeval
* @return 0 on success, -1 on error
* @throws EOVERFLOW The value is too large to be convert, the value will be
* truncated to `{.tv_sec = TIME_MAX, .tv_usec = 999999L}`
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__)))
int libsimple_timespec2timeval(struct timeval *restrict, const struct timespec *restrict);
@@ -207,6 +227,8 @@ int libsimple_timespec2timeval(struct timeval *restrict, const struct timespec *
* will be `{.tv_sec = TIME_MAX, .tv_nsec = 999999999L}` if the
* result too large and `{.tv_sec = TIME_MIN, .tv_nsec = 0L}`
* if the result too small (`*end` is set)
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__(1, 2))))
int libsimple_strtotimespec(struct timespec *restrict, const char *restrict, char **restrict);
@@ -232,6 +254,8 @@ int libsimple_strtotimespec(struct timespec *restrict, const char *restrict, cha
* will be `{.tv_sec = TIME_MAX, .tv_usec = 999999L}` if the
* result too large and `{.tv_sec = TIME_MIN, .tv_usec = 0L}`
* if the result too small (`*end` is set)
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__(1, 2))))
int libsimple_strtotimeval(struct timeval *restrict, const char *restrict, char **restrict);
@@ -251,6 +275,8 @@ int libsimple_strtotimeval(struct timeval *restrict, const char *restrict, char
* `NULL` on failure
* @throws ENOMEM Output buffer could not be allocated (only if `buf == NULL`)
* @throws EINVAL `ts->tv_nsec` is negative or greater than 999999999
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__(2))))
char *libsimple_timespectostr(char *restrict, const struct timespec *restrict);
@@ -270,6 +296,8 @@ char *libsimple_timespectostr(char *restrict, const struct timespec *restrict);
* `NULL` on failure
* @throws ENOMEM Output buffer could not be allocated (only if `buf == NULL`)
* @throws EINVAL `ts->tv_usec` is negative or greater than 999999
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__(2))))
char *libsimple_timevaltostr(char *restrict, const struct timeval *restrict);
@@ -283,6 +311,8 @@ char *libsimple_timevaltostr(char *restrict, const struct timeval *restrict);
*
* @param ts The value to convert
* @return The result
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__)))
inline double
@@ -303,6 +333,8 @@ libsimple_timespectodouble(const struct timespec *ts__)
*
* @param tv The value to convert
* @return The result
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__)))
inline double
@@ -325,6 +357,8 @@ libsimple_timevaltodouble(const struct timeval *tv__)
*
* @param ts Output parameter for the result
* @param d The value to convert
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__)))
void libsimple_doubletotimespec(struct timespec *, double);
@@ -340,6 +374,8 @@ void libsimple_doubletotimespec(struct timespec *, double);
*
* @param tv Output parameter for the result
* @param d The value to convert
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__)))
void libsimple_doubletotimeval(struct timeval *, double);
@@ -355,6 +391,8 @@ void libsimple_doubletotimeval(struct timeval *, double);
*
* @param s The string to minimise
* @return `s`
+ *
+ * @since 1.0
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__returns_nonnull__, __nonnull__)))
char *libsimple_minimise_number_string(char *);
diff --git a/libsimple/valloc.h b/libsimple/valloc.h
index 023425e..eb86e08 100644
--- a/libsimple/valloc.h
+++ b/libsimple/valloc.h
@@ -16,6 +16,8 @@
* and with page size alignment; `NULL` on failure
* @throws EINVAL `n` is 0
* @throws ENOMEM Could not allocated enough memory
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __warn_unused_result__)))
inline void *
@@ -37,6 +39,8 @@ libsimple_vvallocn(size_t n__, va_list ap__)
* and with page size alignment; `NULL` on failure
* @throws EINVAL `n` is 0
* @throws ENOMEM Could not allocated enough memory
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __alloc_size__(1), __warn_unused_result__)))
inline void *
@@ -64,6 +68,8 @@ libsimple_valloc(size_t n__)
* and with page size alignment; `NULL` on failure
* @throws EINVAL `n` is 0
* @throws ENOMEM Could not allocated enough memory
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __warn_unused_result__)))
inline void *
@@ -92,6 +98,8 @@ libsimple_vallocn(size_t n__, ... /*, (size_t)0 */)
* this function is unspecified for the value 0
* @return A unique pointer with at least the specified size
* and with page size alignment
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __alloc_size__(2), __warn_unused_result__, __returns_nonnull__)))
inline void *
@@ -122,6 +130,8 @@ libsimple_envalloc(int status__, size_t n__)
* list must end with 0 (which is not factor)
* @return A unique pointer with at least the specified size
* and with page size alignment
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __warn_unused_result__, __returns_nonnull__)))
inline void *
@@ -152,6 +162,8 @@ libsimple_envvallocn(int status__, size_t n__, va_list ap__)
* list must end with 0 (which is not factor)
* @return A unique pointer with at least the specified size
* and with page size alignment
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __warn_unused_result__, __returns_nonnull__)))
inline void *
@@ -179,6 +191,8 @@ libsimple_envallocn(int status__, size_t n__, ... /*, (size_t)0 */)
* this function is unspecified for the value 0
* @return A unique pointer with at least the specified size
* and with page size alignment
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __alloc_size__(1), __warn_unused_result__, __returns_nonnull__)))
inline void *
@@ -208,6 +222,8 @@ libsimple_evalloc(size_t n__)
* list must end with 0 (which is not factor)
* @return A unique pointer with at least the specified size
* and with page size alignment
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __warn_unused_result__, __returns_nonnull__)))
inline void *
@@ -237,6 +253,8 @@ libsimple_evvallocn(size_t n__, va_list ap__)
* list must end with 0 (which is not factor)
* @return A unique pointer with at least the specified size
* and with page size alignment
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __warn_unused_result__, __returns_nonnull__)))
inline void *
diff --git a/libsimple/vallocz.h b/libsimple/vallocz.h
index 5c8258e..337dc88 100644
--- a/libsimple/vallocz.h
+++ b/libsimple/vallocz.h
@@ -17,6 +17,8 @@
* and with page size alignment; `NULL` on failure
* @throws EINVAL `n` is 0
* @throws ENOMEM Could not allocated enough memory
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __warn_unused_result__)))
inline void *
@@ -42,6 +44,8 @@ libsimple_vvalloczn(int clear__, size_t n__, va_list ap__)
* and with page size alignment; `NULL` on failure
* @throws EINVAL `n` is 0
* @throws ENOMEM Could not allocated enough memory
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __alloc_size__(2), __warn_unused_result__)))
inline void *
@@ -73,6 +77,8 @@ libsimple_vallocz(int clear__, size_t n__)
* and with page size alignment; `NULL` on failure
* @throws EINVAL `n` is 0
* @throws ENOMEM Could not allocated enough memory
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __warn_unused_result__)))
inline void *
@@ -102,6 +108,8 @@ libsimple_valloczn(int clear__, size_t n__, ... /*, (size_t)0 */)
* this function is unspecified for the value 0
* @return A unique pointer with at least the specified size
* and with page size alignment
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __alloc_size__(3), __warn_unused_result__, __returns_nonnull__)))
inline void *
@@ -137,6 +145,8 @@ libsimple_envallocz(int status__, int clear__, size_t n__)
* list must end with 0 (which is not factor)
* @return A unique pointer with at least the specified size
* and with page size alignment
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __warn_unused_result__, __returns_nonnull__)))
inline void *
@@ -173,6 +183,8 @@ libsimple_envvalloczn(int status__, int clear__, size_t n__, va_list ap__)
* list must end with 0 (which is not factor)
* @return A unique pointer with at least the specified size
* and with page size alignment
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __warn_unused_result__, __returns_nonnull__)))
inline void *
@@ -201,6 +213,8 @@ libsimple_envalloczn(int status__, int clear__, size_t n__, ... /*, (size_t)0 */
* this function is unspecified for the value 0
* @return A unique pointer with at least the specified size
* and with page size alignment
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __alloc_size__(2), __warn_unused_result__, __returns_nonnull__)))
inline void *
@@ -231,6 +245,8 @@ libsimple_evallocz(int clear__, size_t n__)
* list must end with 0 (which is not factor)
* @return A unique pointer with at least the specified size
* and with page size alignment
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __warn_unused_result__, __returns_nonnull__)))
inline void *
@@ -261,6 +277,8 @@ libsimple_evvalloczn(int clear__, size_t n__, va_list ap__)
* list must end with 0 (which is not factor)
* @return A unique pointer with at least the specified size
* and with page size alignment
+ *
+ * @since 1.1
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, __warn_unused_result__, __returns_nonnull__)))
inline void *
diff --git a/libsimple/wcsdup.h b/libsimple/wcsdup.h
index 0573d64..84e7ee6 100644
--- a/libsimple/wcsdup.h
+++ b/libsimple/wcsdup.h
@@ -6,6 +6,8 @@
*
* @param s:const wchar_t * The string to copy
* @return :wchar_t * Duplicate of `s` with automatic storage
+ *
+ * @since 1.2
*/
#if defined(__GNUC__) || defined(__clang__)
# define libsimple_wcsdupa(s)\
@@ -28,6 +30,8 @@
* @param status Exit value in case of failure
* @param s The string to copy
* @return Duplicate of `s`
+ *
+ * @since 1.2
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, libsimple_assume_aligned_as__(wchar_t), __nonnull__,
__warn_unused_result__, __returns_nonnull__)))
@@ -42,6 +46,8 @@ wchar_t *libsimple_enwcsdup(int, const wchar_t *);
*
* @param s The string to copy
* @return Duplicate of `s`
+ *
+ * @since 1.2
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, libsimple_assume_aligned_as__(wchar_t),
__nonnull__, __warn_unused_result__, __returns_nonnull__)))
diff --git a/libsimple/wcsndup.h b/libsimple/wcsndup.h
index d9ffaa5..1fc37ce 100644
--- a/libsimple/wcsndup.h
+++ b/libsimple/wcsndup.h
@@ -7,6 +7,8 @@
* @param s:const wchar_t * The string to copy
* @param n:size_t The maximum number of wide characters to copy
* @return :wchar_t * Duplicate of `s` with automatic storage
+ *
+ * @since 1.2
*/
#if defined(__GNUC__) || defined(__clang__)
# define libsimple_wcsndupa(s, n)\
@@ -32,6 +34,8 @@
* @param s The string to copy
* @param n The maximum number of wide characters to copy
* @return Duplicate of `s`
+ *
+ * @since 1.2
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, libsimple_assume_aligned_as__(wchar_t), __nonnull__,
__warn_unused_result__)))
@@ -48,6 +52,8 @@ wchar_t *libsimple_wcsndup(const wchar_t *, size_t);
* @param s The string to copy
* @param n The maximum number of wide characters to copy
* @return Duplicate of `s`
+ *
+ * @since 1.2
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, libsimple_assume_aligned_as__(wchar_t), __nonnull__,
__warn_unused_result__, __returns_nonnull__)))
@@ -63,6 +69,8 @@ wchar_t *libsimple_enwcsndup(int, const wchar_t *, size_t);
* @param s The string to copy
* @param n The maximum number of wide characters to copy
* @return Duplicate of `s`
+ *
+ * @since 1.2
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, libsimple_assume_aligned_as__(wchar_t),
__nonnull__, __warn_unused_result__, __returns_nonnull__)))
diff --git a/libsimple/wmemdup.h b/libsimple/wmemdup.h
index 898acdd..22cd1cc 100644
--- a/libsimple/wmemdup.h
+++ b/libsimple/wmemdup.h
@@ -7,6 +7,8 @@
* @param s:const wchar_t * The wide characters to copy
* @param n:size_t The number of wide characters to copy
* @return :wchar_t * Duplicate of `s` with automatic storage
+ *
+ * @since 1.2
*/
#if defined(__GNUC__) || defined(__clang__)
# define libsimple_wmemdupa(s, n)\
@@ -29,6 +31,8 @@
* @param s The wide characters to copy
* @param n The number of wide characters to copy
* @return Duplicate of `s`, `NULL` on failure
+ *
+ * @since 1.2
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, libsimple_assume_aligned_as__(wchar_t), __alloc_size__(2), __warn_unused_result__)))
wchar_t *libsimple_wmemdup(const wchar_t *, size_t);
@@ -44,6 +48,8 @@ wchar_t *libsimple_wmemdup(const wchar_t *, size_t);
* @param s The wide characters to copy
* @param n The number of wide characters to copy
* @return Duplicate of `s`
+ *
+ * @since 1.2
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, libsimple_assume_aligned_as__(wchar_t), __alloc_size__(3),
__warn_unused_result__, __returns_nonnull__)))
@@ -59,6 +65,8 @@ wchar_t *libsimple_enwmemdup(int, const wchar_t *, size_t);
* @param s The wide characters to copy
* @param n The number of wide characters to copy
* @return Duplicate of `s`
+ *
+ * @since 1.2
*/
LIBSIMPLE_GCC_ONLY__(__attribute__((__malloc__, libsimple_assume_aligned_as__(wchar_t), __alloc_size__(2),
__warn_unused_result__, __returns_nonnull__)))