You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

151 lines
6.3 KiB

  1. --- a/argz.h
  2. +++ b/argz.h
  3. @@ -38,8 +38,6 @@
  4. #ifndef _ARGZ_H
  5. #define _ARGZ_H 1
  6. -#include <features.h>
  7. -
  8. #define __need_error_t
  9. #include <errno.h>
  10. #include <string.h> /* Need size_t, and strchr is called below. */
  11. @@ -52,16 +50,17 @@
  12. typedef int error_t;
  13. #endif
  14. -
  15. -__BEGIN_DECLS
  16. +#ifdef __cplusplus
  17. +extern "C" {
  18. +#endif
  19. /* Make a '\0' separated arg vector from a unix argv vector, returning it in
  20. ARGZ, and the total length in LEN. If a memory allocation error occurs,
  21. ENOMEM is returned, otherwise 0. The result can be destroyed using free. */
  22. extern error_t __argz_create (char *__const __argv[], char **__restrict __argz,
  23. - size_t *__restrict __len) __THROW;
  24. + size_t *__restrict __len) __attribute__ ((__nothrow__));
  25. extern error_t argz_create (char *__const __argv[], char **__restrict __argz,
  26. - size_t *__restrict __len) __THROW;
  27. + size_t *__restrict __len) __attribute__ ((__nothrow__));
  28. /* Make a '\0' separated arg vector from a SEP separated list in
  29. STRING, returning it in ARGZ, and the total length in LEN. If a
  30. @@ -69,65 +68,65 @@ extern error_t argz_create (char *__const __argv[], char **__restrict __argz,
  31. The result can be destroyed using free. */
  32. extern error_t __argz_create_sep (__const char *__restrict __string,
  33. int __sep, char **__restrict __argz,
  34. - size_t *__restrict __len) __THROW;
  35. + size_t *__restrict __len) __attribute__ ((__nothrow__));
  36. extern error_t argz_create_sep (__const char *__restrict __string,
  37. int __sep, char **__restrict __argz,
  38. - size_t *__restrict __len) __THROW;
  39. + size_t *__restrict __len) __attribute__ ((__nothrow__));
  40. /* Returns the number of strings in ARGZ. */
  41. extern size_t __argz_count (__const char *__argz, size_t __len)
  42. - __THROW __attribute_pure__;
  43. + __attribute__ ((__nothrow__));
  44. extern size_t argz_count (__const char *__argz, size_t __len)
  45. - __THROW __attribute_pure__;
  46. + __attribute__ ((__nothrow__));
  47. /* Puts pointers to each string in ARGZ into ARGV, which must be large enough
  48. to hold them all. */
  49. extern void __argz_extract (__const char *__restrict __argz, size_t __len,
  50. - char **__restrict __argv) __THROW;
  51. + char **__restrict __argv) __attribute__ ((__nothrow__));
  52. extern void argz_extract (__const char *__restrict __argz, size_t __len,
  53. - char **__restrict __argv) __THROW;
  54. + char **__restrict __argv) __attribute__ ((__nothrow__));
  55. /* Make '\0' separated arg vector ARGZ printable by converting all the '\0's
  56. except the last into the character SEP. */
  57. -extern void __argz_stringify (char *__argz, size_t __len, int __sep) __THROW;
  58. -extern void argz_stringify (char *__argz, size_t __len, int __sep) __THROW;
  59. +extern void __argz_stringify (char *__argz, size_t __len, int __sep) __attribute__ ((__nothrow__));
  60. +extern void argz_stringify (char *__argz, size_t __len, int __sep) __attribute__ ((__nothrow__));
  61. /* Append BUF, of length BUF_LEN to the argz vector in ARGZ & ARGZ_LEN. */
  62. extern error_t __argz_append (char **__restrict __argz,
  63. size_t *__restrict __argz_len,
  64. __const char *__restrict __buf, size_t _buf_len)
  65. - __THROW;
  66. + __attribute__ ((__nothrow__));
  67. extern error_t argz_append (char **__restrict __argz,
  68. size_t *__restrict __argz_len,
  69. __const char *__restrict __buf, size_t __buf_len)
  70. - __THROW;
  71. + __attribute__ ((__nothrow__));
  72. /* Append STR to the argz vector in ARGZ & ARGZ_LEN. */
  73. extern error_t __argz_add (char **__restrict __argz,
  74. size_t *__restrict __argz_len,
  75. - __const char *__restrict __str) __THROW;
  76. + __const char *__restrict __str) __attribute__ ((__nothrow__));
  77. extern error_t argz_add (char **__restrict __argz,
  78. size_t *__restrict __argz_len,
  79. - __const char *__restrict __str) __THROW;
  80. + __const char *__restrict __str) __attribute__ ((__nothrow__));
  81. /* Append SEP separated list in STRING to the argz vector in ARGZ &
  82. ARGZ_LEN. */
  83. extern error_t __argz_add_sep (char **__restrict __argz,
  84. size_t *__restrict __argz_len,
  85. __const char *__restrict __string, int __delim)
  86. - __THROW;
  87. + __attribute__ ((__nothrow__));
  88. extern error_t argz_add_sep (char **__restrict __argz,
  89. size_t *__restrict __argz_len,
  90. __const char *__restrict __string, int __delim)
  91. - __THROW;
  92. + __attribute__ ((__nothrow__));
  93. /* Delete ENTRY from ARGZ & ARGZ_LEN, if it appears there. */
  94. extern void __argz_delete (char **__restrict __argz,
  95. size_t *__restrict __argz_len,
  96. - char *__restrict __entry) __THROW;
  97. + char *__restrict __entry) __attribute__ ((__nothrow__));
  98. extern void argz_delete (char **__restrict __argz,
  99. size_t *__restrict __argz_len,
  100. - char *__restrict __entry) __THROW;
  101. + char *__restrict __entry) __attribute__ ((__nothrow__));
  102. /* Insert ENTRY into ARGZ & ARGZ_LEN before BEFORE, which should be an
  103. existing entry in ARGZ; if BEFORE is NULL, ENTRY is appended to the end.
  104. @@ -138,11 +137,11 @@ extern void argz_delete (char **__restrict __argz,
  105. extern error_t __argz_insert (char **__restrict __argz,
  106. size_t *__restrict __argz_len,
  107. char *__restrict __before,
  108. - __const char *__restrict __entry) __THROW;
  109. + __const char *__restrict __entry) __attribute__ ((__nothrow__));
  110. extern error_t argz_insert (char **__restrict __argz,
  111. size_t *__restrict __argz_len,
  112. char *__restrict __before,
  113. - __const char *__restrict __entry) __THROW;
  114. + __const char *__restrict __entry) __attribute__ ((__nothrow__));
  115. /* Replace any occurrences of the string STR in ARGZ with WITH, reallocating
  116. ARGZ as necessary. If REPLACE_COUNT is non-zero, *REPLACE_COUNT will be
  117. @@ -173,9 +172,9 @@ extern error_t argz_replace (char **__restrict __argz,
  118. ...;
  119. */
  120. extern char *__argz_next (__const char *__restrict __argz, size_t __argz_len,
  121. - __const char *__restrict __entry) __THROW;
  122. + __const char *__restrict __entry) __attribute__ ((__nothrow__));
  123. extern char *argz_next (__const char *__restrict __argz, size_t __argz_len,
  124. - __const char *__restrict __entry) __THROW;
  125. + __const char *__restrict __entry) __attribute__ ((__nothrow__));
  126. #ifdef __USE_EXTERN_INLINES
  127. extern inline char *
  128. @@ -200,6 +199,8 @@ argz_next (__const char *__argz, size_t __argz_len,
  129. }
  130. #endif /* Use extern inlines. */
  131. -__END_DECLS
  132. +#ifdef __cplusplus
  133. +}
  134. +#endif
  135. #endif /* argz.h */