diff --git a/bench/main.c b/bench/main.c index ae84614..cf8de59 100644 --- a/bench/main.c +++ b/bench/main.c @@ -99,7 +99,7 @@ iterations(char *s) goto Bad; errno = 0; n = strtoumax(s, &end, 10); - if(errno != 0 || *end != '\0' || n == 0 || n > UINT64_MAX) + if(errno != 0 || *end != '\0' || n == 0) goto Bad; return n; Bad: @@ -157,7 +157,7 @@ main(int argc, char **argv) loadkeys(argv[1]); niter = argc == 3 ? iterations(argv[2]) : 1000; - if(nkeys > UINT64_MAX || niter > UINT64_MAX / nkeys){ + if(niter > UINT64_MAX / nkeys){ fprintf(stderr, "iteration count overflows key total\n"); exit(1); } diff --git a/str.c b/str.c index 0e0f024..667012a 100644 --- a/str.c +++ b/str.c @@ -1,7 +1,8 @@ #include "dat.h" #include "fn.h" -/* Fills s from n bytes of UTF-8; whole, valid, and at most Maxrunes. */ +/* Fills s from n bytes of UTF-8; whole, valid, and at most Maxrunes. + * Anything else leaves s empty. */ int sinit(Str *s, char *src, int n) { @@ -35,8 +36,7 @@ stail(Str *s, char *src, int n) nr = utfnlen(src, n); for(p = src; nr > Maxrunes; nr--) p += chartorune(&r, p); - if(!sinit(s, p, n - (p - src))) - sclear(s); + sinit(s, p, n - (p - src)); } void