[PATCH v18 2/3] locale: charmap: fix off-by-one with ranges

Bruno Haible bruno@clisp.org
Sun Jul 23 19:38:40 GMT 2023


наб wrote:
> Instead, bump the current character at the start of the loop
> (but not the first time, of course),
> precisely as many times as there are characters in the range.

Looks good to me. Alternatively, one could leave that piece of code
at the end of the loop and add before it these two lines:

       if (cnt == to_nr)
         break;

I hope no opinion regarding which of the two is "better" code style.

Bruno





More information about the Libc-alpha mailing list