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
|
|
@ -1521,7 +1521,7 @@ breakloop:
|
|||
lp->lex.reservok = 0;
|
||||
else if(c==TIMESYM)
|
||||
{
|
||||
/* yech - POSIX requires time -p */
|
||||
/* POSIX requires time -p */
|
||||
while(fcgetc(n)==' ' || n=='\t');
|
||||
if(n>0)
|
||||
fcseek(-LEN);
|
||||
|
|
@ -2187,7 +2187,6 @@ struct argnod *sh_endword(Shell_t *shp,int mode)
|
|||
Stk_t *stkp=shp->stk;
|
||||
sfputc(stkp,0);
|
||||
sp = stkptr(stkp,ARGVAL);
|
||||
#if SHOPT_MULTIBYTE
|
||||
if(mbwide())
|
||||
{
|
||||
do
|
||||
|
|
@ -2216,8 +2215,8 @@ struct argnod *sh_endword(Shell_t *shp,int mode)
|
|||
while(n == 0);
|
||||
}
|
||||
else
|
||||
#endif /* SHOPT_MULTIBYTE */
|
||||
while((n=state[*sp++])==0);
|
||||
while((n = state[*sp++]) == 0)
|
||||
;
|
||||
dp = sp;
|
||||
if(mode<0)
|
||||
inquote = 1;
|
||||
|
|
@ -2396,7 +2395,6 @@ struct argnod *sh_endword(Shell_t *shp,int mode)
|
|||
}
|
||||
break;
|
||||
}
|
||||
#if SHOPT_MULTIBYTE
|
||||
if(mbwide())
|
||||
{
|
||||
do
|
||||
|
|
@ -2426,8 +2424,8 @@ struct argnod *sh_endword(Shell_t *shp,int mode)
|
|||
while(n == 0);
|
||||
}
|
||||
else
|
||||
#endif /* SHOPT_MULTIBYTE */
|
||||
while((n=state[*dp++ = *sp++])==0);
|
||||
while((n=state[*dp++ = *sp++])==0)
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue