1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

SHOPT_MULTIBYTE-related cleanup (re: 8477d2ce)

As of 8477d2ce, the mbwide() macro (which tests if we're in a
multibyte locale, i.e. UTF-8) is redefined as a constant 0 if we're
compiling without SHOPT_MULTIBYTE. See src/cmd/ksh93/include/defs.h

The other multibyte macros use mbwide() as well, so they all revert
to the single-byte fallbacks in that case, and the multibyte code
in them is never compiled. See src/lib/libast/include/ast.h

Consequently we can now do a bit of cleanup and get rid of many of
the '#if SHOPT_MULTIBYTE' directives, as the compiler optimiser
will happily remove the multibyte-specific code. This increases the
legibility of the ksh code.

I'm taking the opportunity to fix a few typos and whitespace
formatting glitches as well.
This commit is contained in:
Martijn Dekker 2020-08-29 22:45:04 +01:00
parent 7c5d39fa04
commit f8feed1bd2
9 changed files with 28 additions and 76 deletions

View file

@ -30,8 +30,9 @@
#include <ast.h>
#if !SHOPT_MULTIBYTE
/* disable multibyte without need for further '#if SHOPT_MULTIBYTE' */
# undef mbwide
# define mbwide() (0) /* disable multibyte without need for further '#if SHOPT_MULTIBTYE' */
# define mbwide() 0
#endif
#include <sfio.h>