]> Savannah Git Hosting - gnulib.git/commitdiff
c-stack: Use idx_t for nonnegative ptrdiff_t variables.
authorBruno Haible <bruno@clisp.org>
Sun, 6 Dec 2020 11:31:06 +0000 (12:31 +0100)
committerBruno Haible <bruno@clisp.org>
Sun, 6 Dec 2020 11:31:06 +0000 (12:31 +0100)
* lib/c-stack.c: Include idx.h.
(die): Mark buflen as nonnegative.
* modules/c-stack (Depends-on): Add idx.

ChangeLog
lib/c-stack.c
modules/c-stack

index e0495a0c47b04ae5444c2649d322b49ef0b41fcd..41bb0ca2a72ef1386a7d91e909749675c8f35350 100644 (file)
--- 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.
index 3aea16acd7e94d1976e27bf32418abeff1c4416b..c5bb74a7dfc7b81c82a5ff36fb087c9c5f051dff 100644 (file)
@@ -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);
index 77cf6aab84a9441db056d280e2f6dbf47dd067a8..4c80f317724cd952b12f0d8c02af12d2dc4040ef 100644 (file)
@@ -14,6 +14,7 @@ exitfail
 getprogname
 gettext-h
 havelib
+idx
 ignore-value
 intprops
 inttypes