mirror of
https://github.com/openwrt/openwrt.git
synced 2026-10-14 21:47:41 +04:00
Move to the July 2026 update of the last 2025 stable branch. This branch includes many new modules and changes to modules that were previously patched, so many patches are dropped. Newer gnulib now also has a proper fts header in the form of a template file for variable definitions that are set during configuration, however, it still ends up named with an underscore, so the patch 120-unmangle-darwin-fts-h.patch in order to resolve differences between macOS and standard fts headers is rewritten to patch the new header include guard and the fts module file in order to name it without an underscore. Manually Adjusted Patch: - 120-unmangle-darwin-fts-h.patch All other patches are automatically refreshed. Signed-off-by: Michael Pratt <mcpratt@pm.me> Link: https://github.com/openwrt/openwrt/pull/24247 Signed-off-by: Robert Marko <robimarko@gmail.com>
195 lines
5.1 KiB
Diff
195 lines
5.1 KiB
Diff
--- a/lib/ialloc.h
|
|
+++ b/lib/ialloc.h
|
|
@@ -91,6 +91,8 @@ icalloc (idx_t n, idx_t s)
|
|
return calloc (n, s);
|
|
}
|
|
|
|
+#if GNULIB_REALLOCARRAY
|
|
+
|
|
/* ireallocarray (ptr, num, size) is like reallocarray (ptr, num, size).
|
|
It returns a non-NULL pointer to num * size bytes of memory.
|
|
Upon failure, it returns NULL with errno set. */
|
|
@@ -102,6 +104,8 @@ ireallocarray (void *p, idx_t n, idx_t s
|
|
: _gl_alloc_nomem ());
|
|
}
|
|
|
|
+#endif /* GNULIB_REALLOCARRAY */
|
|
+
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
--- a/lib/xmalloc.c
|
|
+++ b/lib/xmalloc.c
|
|
@@ -57,12 +57,16 @@ ximalloc (idx_t s)
|
|
return check_nonnull (imalloc (s));
|
|
}
|
|
|
|
+#if GNULIB_REALLOCARRAY
|
|
+
|
|
char *
|
|
xcharalloc (size_t n)
|
|
{
|
|
return XNMALLOC (n, char);
|
|
}
|
|
|
|
+#endif /* GNULIB_REALLOCARRAY */
|
|
+
|
|
/* Change the size of an allocated block of memory P to S bytes,
|
|
with error checking. */
|
|
|
|
@@ -81,6 +85,8 @@ xirealloc (void *p, idx_t s)
|
|
return check_nonnull (irealloc (p, s));
|
|
}
|
|
|
|
+#if GNULIB_REALLOCARRAY
|
|
+
|
|
/* Change the size of an allocated block of memory P to an array of N
|
|
objects each of S bytes, with error checking. */
|
|
|
|
@@ -211,6 +217,8 @@ x2nrealloc (void *p, size_t *pn, size_t
|
|
return p;
|
|
}
|
|
|
|
+#endif /* GNULIB_REALLOCARRAY */
|
|
+
|
|
/* Grow PA, which points to an array of *PN items, and return the
|
|
location of the reallocated array, updating *PN to reflect its
|
|
new size. The new array will contain at least N_INCR_MIN more
|
|
--- a/lib/xalloc.h
|
|
+++ b/lib/xalloc.h
|
|
@@ -81,10 +81,16 @@ void *xrealloc (void *p, size_t s)
|
|
_GL_ATTRIBUTE_ALLOC_SIZE ((2));
|
|
void *xirealloc (void *p, idx_t s)
|
|
_GL_ATTRIBUTE_ALLOC_SIZE ((2)) _GL_ATTRIBUTE_RETURNS_NONNULL;
|
|
+
|
|
+# if GNULIB_REALLOCARRAY
|
|
+
|
|
void *xreallocarray (void *p, size_t n, size_t s)
|
|
_GL_ATTRIBUTE_ALLOC_SIZE ((2, 3));
|
|
void *xireallocarray (void *p, idx_t n, idx_t s)
|
|
_GL_ATTRIBUTE_ALLOC_SIZE ((2, 3)) _GL_ATTRIBUTE_RETURNS_NONNULL;
|
|
+
|
|
+# endif /* GNULIB_REALLOCARRAY */
|
|
+
|
|
void *x2realloc (void *p, size_t *ps) /* superseded by xpalloc */
|
|
_GL_ATTRIBUTE_RETURNS_NONNULL;
|
|
void *x2nrealloc (void *p, size_t *pn, size_t s) /* superseded by xpalloc */
|
|
@@ -129,6 +135,7 @@ char *xstrdup (char const *str)
|
|
# define XCALLOC(n, t) \
|
|
((t *) (sizeof (t) == 1 ? xzalloc (n) : xcalloc (n, sizeof (t))))
|
|
|
|
+# if GNULIB_REALLOCARRAY
|
|
|
|
/* Allocate an array of N objects, each with S bytes of memory,
|
|
dynamically, with error checking. S must be nonzero. */
|
|
@@ -156,6 +163,8 @@ char *xcharalloc (size_t n)
|
|
_GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
|
|
_GL_ATTRIBUTE_ALLOC_SIZE ((1)) _GL_ATTRIBUTE_RETURNS_NONNULL;
|
|
|
|
+# endif /* GNULIB_REALLOCARRAY */
|
|
+
|
|
#endif /* GNULIB_XALLOC */
|
|
|
|
|
|
--- a/lib/safe-alloc.h
|
|
+++ b/lib/safe-alloc.h
|
|
@@ -37,7 +37,6 @@ _GL_INLINE_HEADER_BEGIN
|
|
extern "C" {
|
|
#endif
|
|
|
|
-
|
|
/* Don't call this directly - use the macros below. */
|
|
_GL_ATTRIBUTE_NODISCARD SAFE_ALLOC_INLINE int
|
|
safe_alloc_check (void *ptr)
|
|
@@ -72,6 +71,8 @@ safe_alloc_check (void *ptr)
|
|
#define ALLOC_N(ptr, count) \
|
|
safe_alloc_check ((ptr) = calloc (count, sizeof *(ptr)))
|
|
|
|
+#if GNULIB_REALLOCARRAY
|
|
+
|
|
/**
|
|
* ALLOC_N_UNINITIALIZED:
|
|
* @ptr: pointer to allocated memory
|
|
@@ -100,6 +101,8 @@ safe_alloc_check (void *ptr)
|
|
#define REALLOC_N(ptr, count) \
|
|
safe_alloc_check ((ptr) = reallocarray (ptr, count, sizeof *(ptr)))
|
|
|
|
+#endif /* GNULIB_REALLOCARRAY */
|
|
+
|
|
/**
|
|
* FREE:
|
|
* @ptr: pointer holding address to be freed
|
|
--- a/lib/dfa.c
|
|
+++ b/lib/dfa.c
|
|
@@ -1620,6 +1620,8 @@ lex (struct dfa *dfa)
|
|
}
|
|
}
|
|
|
|
+#if GNULIB_REALLOCARRAY
|
|
+
|
|
static void
|
|
addtok_mb (struct dfa *dfa, token t, char mbprop)
|
|
{
|
|
@@ -1674,6 +1676,8 @@ addtok_mb (struct dfa *dfa, token t, cha
|
|
}
|
|
}
|
|
|
|
+#endif /* GNULIB_REALLOCARRAY */
|
|
+
|
|
static void addtok_wc (struct dfa *dfa, wint_t wc);
|
|
|
|
/* Add the given token to the parse tree, maintaining the depth count and
|
|
@@ -2935,6 +2939,8 @@ dfaanalyze (struct dfa *d, bool searchfl
|
|
free (tmp.elems);
|
|
}
|
|
|
|
+#if GNULIB_REALLOCARRAY
|
|
+
|
|
/* Make sure D's state arrays are large enough to hold NEW_STATE. */
|
|
static void
|
|
realloc_trans_if_necessary (struct dfa *d)
|
|
@@ -2970,6 +2976,8 @@ realloc_trans_if_necessary (struct dfa *
|
|
}
|
|
}
|
|
|
|
+#endif /* GNULIB_REALLOCARRAY */
|
|
+
|
|
/*
|
|
Calculate the transition table for a new state derived from state s
|
|
for a compiled dfa d after input character uc, and return the new
|
|
@@ -4011,6 +4019,8 @@ freelist (char **cpp)
|
|
free (*cpp++);
|
|
}
|
|
|
|
+#if GNULIB_REALLOCARRAY
|
|
+
|
|
static char **
|
|
enlistnew (char **cpp, char *new)
|
|
{
|
|
@@ -4047,6 +4057,8 @@ enlist (char **cpp, char const *str, idx
|
|
return enlistnew (cpp, ximemdup0 (str, len));
|
|
}
|
|
|
|
+#endif /* GNULIB_REALLOCARRAY */
|
|
+
|
|
/* Given pointers to two strings, return a pointer to an allocated
|
|
list of their distinct common substrings. */
|
|
static char **
|
|
--- a/lib/readtokens.c
|
|
+++ b/lib/readtokens.c
|
|
@@ -128,6 +128,8 @@ readtoken (FILE *stream,
|
|
return i;
|
|
}
|
|
|
|
+#if GNULIB_REALLOCARRAY
|
|
+
|
|
/* Build a NULL-terminated array of pointers to tokens
|
|
read from STREAM. Return the number of tokens read.
|
|
All storage is obtained through calls to xmalloc-like functions.
|
|
@@ -190,3 +192,5 @@ readtokens (FILE *stream,
|
|
free (lengths);
|
|
return n_tokens;
|
|
}
|
|
+
|
|
+#endif /* GNULIB_REALLOCARRAY */
|