1
0
mirror of https://git.openwrt.org/feed/packages.git synced 2024-06-27 19:35:18 +02:00
openwrt-packages/net/atftp/patches/04-cdefs.patch
Rosen Penev 9ac737ac80
atftp: fix compilation with glibc
It's defining two functions twice for some reason.

Refreshed patches.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-12-30 16:37:57 -08:00

155 lines
6.3 KiB
Diff

--- a/argz.h
+++ b/argz.h
@@ -38,8 +38,6 @@
#ifndef _ARGZ_H
#define _ARGZ_H 1
-#include <features.h>
-
#define __need_error_t
#include <errno.h>
#include <string.h> /* 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 *__cons
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 **__restri
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,11 +172,11 @@ extern error_t argz_replace (char **__re
...;
*/
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
+#if 0
extern inline char *
__argz_next (__const char *__argz, size_t __argz_len,
__const char *__entry)
@@ -200,6 +199,8 @@ argz_next (__const char *__argz, size_t
}
#endif /* Use extern inlines. */
-__END_DECLS
+#ifdef __cplusplus
+}
+#endif
#endif /* argz.h */