From: Bruno Haible <bruno@clisp.org> Date: Sun, 6 Dec 2020 11:31:06 +0000 (+0100) Subject: c-stack: Use idx_t for nonnegative ptrdiff_t variables. X-Git-Tag: v1.0~3417 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=757d2d3184c5600c1c8f2ff48b140541c5932b5b;p=gnulib.git c-stack: Use idx_t for nonnegative ptrdiff_t variables. * lib/c-stack.c: Include idx.h. (die): Mark buflen as nonnegative. * modules/c-stack (Depends-on): Add idx. --- diff --git a/ChangeLog b/ChangeLog index e0495a0c47..41bb0ca2a7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2020-12-06 Bruno Haible <bruno@clisp.org> + + c-stack: Use idx_t for nonnegative ptrdiff_t variables. + * lib/c-stack.c: Include idx.h. + (die): Mark buflen as nonnegative. + * modules/c-stack (Depends-on): Add idx. + 2020-12-06 Bruno Haible <bruno@clisp.org> backupfile: Use idx_t for nonnegative ptrdiff_t variables. diff --git a/lib/c-stack.c b/lib/c-stack.c index 3aea16acd7..c5bb74a7df 100644 --- a/lib/c-stack.c +++ b/lib/c-stack.c @@ -37,9 +37,6 @@ #include "c-stack.h" -#include "gettext.h" -#define _(msgid) gettext (msgid) - #include <errno.h> #include <inttypes.h> @@ -64,6 +61,11 @@ typedef struct sigaltstack stack_t; # include <stdio.h> #endif +#include "idx.h" + +#include "gettext.h" +#define _(msgid) gettext (msgid) + /* Use libsigsegv only if needed; kernels like Solaris can detect stack overflow without the overhead of an external library. */ #define USE_LIBSIGSEGV (!HAVE_XSI_STACK_OVERFLOW_HEURISTIC && HAVE_LIBSIGSEGV) @@ -134,7 +136,7 @@ die (int signo) size_t messagelen = strlen (message); static char const separator[] = {':', ' '}; char buf[sizeof alternate_signal_stack / 16 + sizeof separator]; - ptrdiff_t buflen; + idx_t buflen; if (prognamelen + messagelen < sizeof buf - sizeof separator) { char *p = mempcpy (buf, progname, prognamelen); diff --git a/modules/c-stack b/modules/c-stack index 77cf6aab84..4c80f31772 100644 --- a/modules/c-stack +++ b/modules/c-stack @@ -14,6 +14,7 @@ exitfail getprogname gettext-h havelib +idx ignore-value intprops inttypes