summaryrefslogtreecommitdiff
path: root/dist
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2021-05-25 11:48:58 -0600
committerNicholas Clark <nick@ccl4.org>2021-06-30 08:32:26 +0000
commit11eb60b7e13a0e889bff409fd9bd08afdb4e85e9 (patch)
treec5863f4f3fedc237f2f5bd0eabe09be1e68517f4 /dist
parent993d875ed9fa768b16cc370dd5550b05a81b71f0 (diff)
downloadperl-11eb60b7e13a0e889bff409fd9bd08afdb4e85e9.tar.gz
Dumper.xs: isDIGIT() is now in ppport.h
So use it. This makes the code cleaner, and removes a conditional (unless the compiler optimizer figures out to do so anyway).
Diffstat (limited to 'dist')
-rw-r--r--dist/Data-Dumper/Dumper.xs8
1 files changed, 2 insertions, 6 deletions
diff --git a/dist/Data-Dumper/Dumper.xs b/dist/Data-Dumper/Dumper.xs
index 59458b948e..7c49c9e9cb 100644
--- a/dist/Data-Dumper/Dumper.xs
+++ b/dist/Data-Dumper/Dumper.xs
@@ -301,9 +301,7 @@ esc_q_utf8(pTHX_ SV* sv, const char *src, STRLEN slen, I32 do_utf8, I32 useqq)
}
else /* The other low ordinals are output as an octal escape
* sequence */
- if (s + 1 >= send || ( *(U8*)(s+1) >= '0'
- && *(U8*)(s+1) <= '9'))
- {
+ if (s + 1 >= send || isDIGIT(*(s+1))) {
/* When the following character is a digit, use 3 octal digits
* plus backslash, as using fewer digits would concatenate the
* following char into this one */
@@ -393,9 +391,7 @@ esc_q_utf8(pTHX_ SV* sv, const char *src, STRLEN slen, I32 do_utf8, I32 useqq)
* since we only encode characters \377 and under, or
* \x177 and under for a unicode string
*/
- next_is_digit = (s + 1 >= send )
- ? FALSE
- : (*(U8*)(s+1) >= '0' && *(U8*)(s+1) <= '9');
+ next_is_digit = (s + 1 < send && isDIGIT(*(s+1)));
/* faster than
* r = r + my_sprintf(r, "%o", k);