diff options
| author | Dennis Camera <skonfig@dtnr.ch> | 2022-08-25 22:15:36 +0200 |
|---|---|---|
| committer | Dennis Camera <skonfig@dtnr.ch> | 2022-08-25 22:15:36 +0200 |
| commit | a62828595b9865a13cdc9b4adba3e3aaa9bc8e73 (patch) | |
| tree | 837e8fd58dea93d0a84414e9807ecd5b4b33ac91 /src/util/envp.h | |
| parent | d73af9d8e436f36b612869422291caeb3239c758 (diff) | |
| download | skonfig-c-a62828595b9865a13cdc9b4adba3e3aaa9bc8e73.tar.gz skonfig-c-a62828595b9865a13cdc9b4adba3e3aaa9bc8e73.zip | |
Enable more __attribute__s
Diffstat (limited to 'src/util/envp.h')
| -rw-r--r-- | src/util/envp.h | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/src/util/envp.h b/src/util/envp.h index 37871f9..a696330 100644 --- a/src/util/envp.h +++ b/src/util/envp.h @@ -9,6 +9,11 @@ typedef char ** envp_t; +#if HAVE_FUNC_ATTRIBUTE_MALLOC +/* pre-declare free function for SK_MALLOC_FREE(envp_free) */ +extern void envp_free(envp_t *); +#endif + /** * envp_alloc: * allocates a new, empty envp_t. @@ -17,7 +22,7 @@ typedef char ** envp_t; * * @return new, empty envp_t. */ -envp_t *envp_alloc(void); +envp_t *envp_alloc(void) SK_MALLOC_FREE(envp_free, 1) SK_WARN_UNUSED_RESULT; /** * envp_dup: @@ -27,7 +32,7 @@ envp_t *envp_alloc(void); * * @return new envp_t. */ -envp_t *envp_dup(void); +envp_t *envp_dup(void) SK_MALLOC_FREE(envp_free, 1) SK_WARN_UNUSED_RESULT; /** * envp_get: @@ -37,7 +42,7 @@ envp_t *envp_dup(void); * @param name: the name of the environment variable to return. * @return the value of the environment variable if found, NULL otherwise. */ -char *envp_get(envp_t *envp, const char *name); +char *envp_get(envp_t *envp, const char *name) SK_NONNULL(1, 2); /** * envp_put: @@ -54,7 +59,7 @@ char *envp_get(envp_t *envp, const char *name); * @param string: a string of the form "name=value". * @return 0 on success, -1 otherwise and sets errno. */ -int envp_put(envp_t *envp, char *string); +int envp_put(envp_t *envp, char *string) SK_NONNULL(1, 2); /** * envp_set: @@ -70,7 +75,7 @@ int envp_put(envp_t *envp, char *string); */ int envp_set( envp_t *envp, const char *restrict envname, const char *restrict envval, - bool overwrite); + bool overwrite) SK_NONNULL(1, 2, 3); /** * envp_unset: @@ -80,7 +85,7 @@ int envp_set( * @param name: the name of the environment variable to remove. * @return 0 */ -int envp_unset(envp_t *envp, const char *restrict name); +int envp_unset(envp_t *envp, const char *restrict name) SK_NONNULL(1, 2); /** * envp_merge: @@ -89,7 +94,7 @@ int envp_unset(envp_t *envp, const char *restrict name); * @param dest: the envp to modify. * @param src: the source envp. */ -void envp_merge(envp_t *dest, envp_t *const src); +void envp_merge(envp_t *dest, envp_t *const src) SK_NONNULL(1, 2); /** * envp_print: @@ -98,7 +103,7 @@ void envp_merge(envp_t *dest, envp_t *const src); * @param envp: the envp to print. * @param stream: the stream to output to. */ -void envp_print(envp_t *envp, FILE *restrict stream); +void envp_print(envp_t *envp, FILE *restrict stream) SK_NONNULL(1, 2); /** * envp_free: @@ -106,6 +111,6 @@ void envp_print(envp_t *envp, FILE *restrict stream); * * @param envp: the structure to free. */ -void envp_free(envp_t *envp); +void envp_free(envp_t *envp) SK_NONNULL(1); #endif |
