aboutsummaryrefslogtreecommitdiffstats
path: root/strtotimespec.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2018-11-19 21:39:11 +0100
committerMattias Andrée <maandree@kth.se>2018-11-19 21:39:11 +0100
commite8a7e1c358caec60751460d337f634ff6957ff9d (patch)
treeb0fe92173edbf210d2890ecd35141cc39decf8dc /strtotimespec.c
parentAdd memelemscan (diff)
downloadlibsimple-e8a7e1c358caec60751460d337f634ff6957ff9d.tar.gz
libsimple-e8a7e1c358caec60751460d337f634ff6957ff9d.tar.bz2
libsimple-e8a7e1c358caec60751460d337f634ff6957ff9d.tar.xz
Add a bunch of function and macros
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'strtotimespec.c')
-rw-r--r--strtotimespec.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/strtotimespec.c b/strtotimespec.c
index 9c6a6e0..d6bd64c 100644
--- a/strtotimespec.c
+++ b/strtotimespec.c
@@ -43,12 +43,10 @@ libsimple_strtotimespec(struct timespec *restrict ts, const char *restrict s, ch
}
for (; isdigit(*s); s++) {
- if (sec < TIME_MIN / 10)
+ if (LIBSIMPLE_SMUL_OVERFLOW_AN_BP(sec, 10, &sec, TIME_MIN, TIME_MAX))
goto overflow_integer;
- sec *= 10;
- if (sec < TIME_MIN + (*s & 15))
+ if (LIBSIMPLE_SSUB_OVERFLOW_B_POS(sec, (time_t)(*s & 15), &sec, TIME_MIN, TIME_MAX))
goto overflow_integer;
- sec -= *s & 15;
}
if (!neg) {