aboutsummaryrefslogtreecommitdiffstats
path: root/lib/timespec-sub.c
diff options
context:
space:
mode:
authorPaul Eggert2023-05-17 15:07:38 -0700
committerPaul Eggert2023-05-17 15:41:00 -0700
commitafbdae00ab59bbda971780fa04dd75dc7d1e7df7 (patch)
treea847a84dd9fe028c83db27eda0901cd45ed683ad /lib/timespec-sub.c
parent0bba1b8c3df8b7b53e08fd69dcc832d253e7a2d1 (diff)
downloademacs-afbdae00ab59bbda971780fa04dd75dc7d1e7df7.tar.gz
emacs-afbdae00ab59bbda971780fa04dd75dc7d1e7df7.zip
Update from Gnulib by running admin/merge-gnulib
Diffstat (limited to 'lib/timespec-sub.c')
-rw-r--r--lib/timespec-sub.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/timespec-sub.c b/lib/timespec-sub.c
index 822c2831089..f8052400410 100644
--- a/lib/timespec-sub.c
+++ b/lib/timespec-sub.c
@@ -24,6 +24,7 @@
24#include <config.h> 24#include <config.h>
25#include "timespec.h" 25#include "timespec.h"
26 26
27#include <stdckdint.h>
27#include "intprops.h" 28#include "intprops.h"
28 29
29struct timespec 30struct timespec
@@ -38,7 +39,7 @@ timespec_sub (struct timespec a, struct timespec b)
38 { 39 {
39 rns = ns + TIMESPEC_HZ; 40 rns = ns + TIMESPEC_HZ;
40 time_t bs1; 41 time_t bs1;
41 if (!INT_ADD_WRAPV (bs, 1, &bs1)) 42 if (!ckd_add (&bs1, bs, 1))
42 bs = bs1; 43 bs = bs1;
43 else if (- TYPE_SIGNED (time_t) < rs) 44 else if (- TYPE_SIGNED (time_t) < rs)
44 rs--; 45 rs--;
@@ -46,7 +47,7 @@ timespec_sub (struct timespec a, struct timespec b)
46 goto low_overflow; 47 goto low_overflow;
47 } 48 }
48 49
49 if (INT_SUBTRACT_WRAPV (rs, bs, &rs)) 50 if (ckd_sub (&rs, rs, bs))
50 { 51 {
51 if (0 < bs) 52 if (0 < bs)
52 { 53 {