summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2019-10-01 22:34:25 -0600
committerKarl Williamson <khw@cpan.org>2019-12-26 14:02:25 -0700
commit5574513f9f50a19865b379d731a4ec7ae10fefa6 (patch)
tree1fc247edcee88a54bba7ea80110fdc02e3f97939 /util.c
parent0860e09008fc680efc179c7667586a9f5b634077 (diff)
downloadperl-5574513f9f50a19865b379d731a4ec7ae10fefa6.tar.gz
util.c: Use inRANGE macro
Diffstat (limited to 'util.c')
-rw-r--r--util.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/util.c b/util.c
index 0321a6ae92..a88cc1155d 100644
--- a/util.c
+++ b/util.c
@@ -3874,7 +3874,7 @@ Perl_my_strftime(pTHX_ const char *fmt, int sec, int min, int hour, int mday, in
** If there is a better way to make it portable, go ahead by
** all means.
*/
- if ((len > 0 && len < buflen) || (len == 0 && *fmt == '\0'))
+ if (inRANGE(len, 1, buflen - 1) || (len == 0 && *fmt == '\0'))
return buf;
else {
/* Possibly buf overflowed - try again with a bigger buf */
@@ -3888,7 +3888,7 @@ Perl_my_strftime(pTHX_ const char *fmt, int sec, int min, int hour, int mday, in
buflen = strftime(buf, bufsize, fmt, &mytm);
GCC_DIAG_RESTORE_STMT;
- if (buflen > 0 && buflen < bufsize)
+ if (inRANGE(buflen, 1, bufsize - 1))
break;
/* heuristic to prevent out-of-memory errors */
if (bufsize > 100*fmtlen) {