--- a/argz.h +++ b/argz.h @@ -38,8 +38,6 @@ #ifndef _ARGZ_H #define _ARGZ_H 1 -#include - #define __need_error_t #include #include /* Need size_t, and strchr is called below. */ @@ -52,16 +50,17 @@ typedef int error_t; #endif - -__BEGIN_DECLS +#ifdef __cplusplus +extern "C" { +#endif /* Make a '\0' separated arg vector from a unix argv vector, returning it in ARGZ, and the total length in LEN. If a memory allocation error occurs, ENOMEM is returned, otherwise 0. The result can be destroyed using free. */ extern error_t __argz_create (char *__const __argv[], char **__restrict __argz, - size_t *__restrict __len) __THROW; + size_t *__restrict __len) __attribute__ ((__nothrow__)); extern error_t argz_create (char *__const __argv[], char **__restrict __argz, - size_t *__restrict __len) __THROW; + size_t *__restrict __len) __attribute__ ((__nothrow__)); /* Make a '\0' separated arg vector from a SEP separated list in STRING, returning it in ARGZ, and the total length in LEN. If a @@ -69,65 +68,65 @@ extern error_t argz_create (char *__const __argv[], char **__restrict __argz, The result can be destroyed using free. */ extern error_t __argz_create_sep (__const char *__restrict __string, int __sep, char **__restrict __argz, - size_t *__restrict __len) __THROW; + size_t *__restrict __len) __attribute__ ((__nothrow__)); extern error_t argz_create_sep (__const char *__restrict __string, int __sep, char **__restrict __argz, - size_t *__restrict __len) __THROW; + size_t *__restrict __len) __attribute__ ((__nothrow__)); /* Returns the number of strings in ARGZ. */ extern size_t __argz_count (__const char *__argz, size_t __len) - __THROW __attribute_pure__; + __attribute__ ((__nothrow__)); extern size_t argz_count (__const char *__argz, size_t __len) - __THROW __attribute_pure__; + __attribute__ ((__nothrow__)); /* Puts pointers to each string in ARGZ into ARGV, which must be large enough to hold them all. */ extern void __argz_extract (__const char *__restrict __argz, size_t __len, - char **__restrict __argv) __THROW; + char **__restrict __argv) __attribute__ ((__nothrow__)); extern void argz_extract (__const char *__restrict __argz, size_t __len, - char **__restrict __argv) __THROW; + char **__restrict __argv) __attribute__ ((__nothrow__)); /* Make '\0' separated arg vector ARGZ printable by converting all the '\0's except the last into the character SEP. */ -extern void __argz_stringify (char *__argz, size_t __len, int __sep) __THROW; -extern void argz_stringify (char *__argz, size_t __len, int __sep) __THROW; +extern void __argz_stringify (char *__argz, size_t __len, int __sep) __attribute__ ((__nothrow__)); +extern void argz_stringify (char *__argz, size_t __len, int __sep) __attribute__ ((__nothrow__)); /* Append BUF, of length BUF_LEN to the argz vector in ARGZ & ARGZ_LEN. */ extern error_t __argz_append (char **__restrict __argz, size_t *__restrict __argz_len, __const char *__restrict __buf, size_t _buf_len) - __THROW; + __attribute__ ((__nothrow__)); extern error_t argz_append (char **__restrict __argz, size_t *__restrict __argz_len, __const char *__restrict __buf, size_t __buf_len) - __THROW; + __attribute__ ((__nothrow__)); /* Append STR to the argz vector in ARGZ & ARGZ_LEN. */ extern error_t __argz_add (char **__restrict __argz, size_t *__restrict __argz_len, - __const char *__restrict __str) __THROW; + __const char *__restrict __str) __attribute__ ((__nothrow__)); extern error_t argz_add (char **__restrict __argz, size_t *__restrict __argz_len, - __const char *__restrict __str) __THROW; + __const char *__restrict __str) __attribute__ ((__nothrow__)); /* Append SEP separated list in STRING to the argz vector in ARGZ & ARGZ_LEN. */ extern error_t __argz_add_sep (char **__restrict __argz, size_t *__restrict __argz_len, __const char *__restrict __string, int __delim) - __THROW; + __attribute__ ((__nothrow__)); extern error_t argz_add_sep (char **__restrict __argz, size_t *__restrict __argz_len, __const char *__restrict __string, int __delim) - __THROW; + __attribute__ ((__nothrow__)); /* Delete ENTRY from ARGZ & ARGZ_LEN, if it appears there. */ extern void __argz_delete (char **__restrict __argz, size_t *__restrict __argz_len, - char *__restrict __entry) __THROW; + char *__restrict __entry) __attribute__ ((__nothrow__)); extern void argz_delete (char **__restrict __argz, size_t *__restrict __argz_len, - char *__restrict __entry) __THROW; + char *__restrict __entry) __attribute__ ((__nothrow__)); /* Insert ENTRY into ARGZ & ARGZ_LEN before BEFORE, which should be an existing entry in ARGZ; if BEFORE is NULL, ENTRY is appended to the end. @@ -138,11 +137,11 @@ extern void argz_delete (char **__restrict __argz, extern error_t __argz_insert (char **__restrict __argz, size_t *__restrict __argz_len, char *__restrict __before, - __const char *__restrict __entry) __THROW; + __const char *__restrict __entry) __attribute__ ((__nothrow__)); extern error_t argz_insert (char **__restrict __argz, size_t *__restrict __argz_len, char *__restrict __before, - __const char *__restrict __entry) __THROW; + __const char *__restrict __entry) __attribute__ ((__nothrow__)); /* Replace any occurrences of the string STR in ARGZ with WITH, reallocating ARGZ as necessary. If REPLACE_COUNT is non-zero, *REPLACE_COUNT will be @@ -173,9 +172,9 @@ extern error_t argz_replace (char **__restrict __argz, ...; */ extern char *__argz_next (__const char *__restrict __argz, size_t __argz_len, - __const char *__restrict __entry) __THROW; + __const char *__restrict __entry) __attribute__ ((__nothrow__)); extern char *argz_next (__const char *__restrict __argz, size_t __argz_len, - __const char *__restrict __entry) __THROW; + __const char *__restrict __entry) __attribute__ ((__nothrow__)); #ifdef __USE_EXTERN_INLINES extern inline char * @@ -200,6 +199,8 @@ argz_next (__const char *__argz, size_t __argz_len, } #endif /* Use extern inlines. */ -__END_DECLS +#ifdef __cplusplus +} +#endif #endif /* argz.h */