From: Bruno Haible Date: Fri, 21 Mar 2025 21:37:12 +0000 (+0100) Subject: Simplify strtoul() invocation. X-Git-Tag: v0.25~80 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c3ccc6d5e6f11c3f85117d91470f87ac429075b3;p=thirdparty%2Fgettext.git Simplify strtoul() invocation. * gnulib-local/lib/markup.c: Don't include . (unescape_string_inplace): Don't reset or test errno. --- diff --git a/gnulib-local/lib/markup.c b/gnulib-local/lib/markup.c index a3a961461..7c17d41fa 100644 --- a/gnulib-local/lib/markup.c +++ b/gnulib-local/lib/markup.c @@ -35,7 +35,6 @@ #include #include #include -#include /* Specification */ #include "markup.h" @@ -513,8 +512,10 @@ unescape_string_inplace (markup_parse_context_ty *context, } if (!(base == 16 ? c_isxdigit (*from) : c_isdigit (*from)) - || (errno = 0, - l = strtoul (from, &end, base), + || /* No need to reset and test errno here, because in case + of overflow, l will be == ULONG_MAX, which is + > 0x10FFFF. */ + (l = strtoul (from, &end, base), end == from)) { char *error_text = @@ -533,10 +534,9 @@ unescape_string_inplace (markup_parse_context_ty *context, free (error_text); return false; } - else if (errno == 0 - /* characters XML 1.1 permits */ - && ((0 < l && l <= 0xD7FF) - || (0xE000 <= l && l <= 0xFFFD) || (0x10000 <= l && l <= 0x10FFFF))) + else if (/* characters XML 1.1 permits */ + (0 < l && l <= 0xD7FF) + || (0xE000 <= l && l <= 0xFFFD) || (0x10000 <= l && l <= 0x10FFFF)) { char buf[8]; int length;