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:
parent
7c5d39fa04
commit
f8feed1bd2
9 changed files with 28 additions and 76 deletions
|
|
@ -117,10 +117,6 @@ static void(*nullscan)(Namval_t*,void*);
|
|||
# define _data data
|
||||
#endif
|
||||
|
||||
#if !SHOPT_MULTIBYTE
|
||||
# define mbchar(p) (*(unsigned char*)p++)
|
||||
#endif /* SHOPT_MULTIBYTE */
|
||||
|
||||
/* ======== name value pair routines ======== */
|
||||
|
||||
#include "shnodes.h"
|
||||
|
|
@ -1881,9 +1877,11 @@ void nv_putval(register Namval_t *np, const char *string, int flags)
|
|||
}
|
||||
else if((nv_isattr(np, NV_RJUST|NV_ZFILL|NV_LJUST)) && sp)
|
||||
{
|
||||
for(;*sp == ' '|| *sp=='\t';sp++);
|
||||
for( ; *sp == ' ' || *sp == '\t'; sp++)
|
||||
;
|
||||
if((nv_isattr(np,NV_ZFILL)) && (nv_isattr(np,NV_LJUST)))
|
||||
for(;*sp=='0';sp++);
|
||||
for( ; *sp == '0'; sp++)
|
||||
;
|
||||
size = nv_size(np);
|
||||
#if SHOPT_MULTIBYTE
|
||||
if(size)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue