* lib/fnmatch.c: Include idx.h. In glibc, define idx_t directly.
* lib/fnmatch_loop.c (EXT): Mark slen, new_used, plensize as
nonnegative.
* modules/fnmatch (Depends-on): Add idx.
+2020-12-06 Bruno Haible <bruno@clisp.org>
+
+ fnmatch: Use idx_t for nonnegative ptrdiff_t variables.
+ * lib/fnmatch.c: Include idx.h. In glibc, define idx_t directly.
+ * lib/fnmatch_loop.c (EXT): Mark slen, new_used, plensize as
+ nonnegative.
+ * modules/fnmatch (Depends-on): Add idx.
+
2020-12-06 Bruno Haible <bruno@clisp.org>
c-stack: Use idx_t for nonnegative ptrdiff_t variables.
#include <intprops.h>
#include <flexmember.h>
+#ifdef _LIBC
+typedef ptrdiff_t idx_t;
+#else
+# include "idx.h"
+#endif
+
/* We often have to test for FNM_FILE_NAME and FNM_PERIOD being both set. */
#define NO_LEADING_PERIOD(flags) \
((flags & (FNM_FILE_NAME | FNM_PERIOD)) == (FNM_FILE_NAME | FNM_PERIOD))
struct patternlist *newp; \
size_t plen = (opt == L_('?') || opt == L_('@') \
? pattern_len : (p - startp + 1UL)); \
- ptrdiff_t slen = FLEXSIZEOF (struct patternlist, str, 0); \
- ptrdiff_t new_used = alloca_used + slen; \
- ptrdiff_t plensize; \
+ idx_t slen = FLEXSIZEOF (struct patternlist, str, 0); \
+ idx_t new_used = alloca_used + slen; \
+ idx_t plensize; \
if (INT_MULTIPLY_WRAPV (plen, sizeof (CHAR), &plensize) \
|| INT_ADD_WRAPV (new_used, plensize, &new_used)) \
{ \
btowc [test $HAVE_FNMATCH = 0 || test $REPLACE_FNMATCH = 1]
builtin-expect [test $HAVE_FNMATCH = 0 || test $REPLACE_FNMATCH = 1]
flexmember [test $HAVE_FNMATCH = 0 || test $REPLACE_FNMATCH = 1]
+idx [test $HAVE_FNMATCH = 0 || test $REPLACE_FNMATCH = 1]
intprops [test $HAVE_FNMATCH = 0 || test $REPLACE_FNMATCH = 1]
isblank [test $HAVE_FNMATCH = 0 || test $REPLACE_FNMATCH = 1]
iswctype [test $HAVE_FNMATCH = 0 || test $REPLACE_FNMATCH = 1]