diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2010-01-04 22:49:58 +0300 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2010-01-04 22:49:58 +0300 |
commit | 28055028a709020ba7eb44f9e5037d0a952b51d6 (patch) | |
tree | bb5dc7052f04e66ad74bbbcc9917d638cd603b24 /include | |
parent | d2b1ba6fdee59645763e915ade3ec55e67d5839a (diff) |
fold: unicode support. Based on a patch by Tomas Heinrich <heinrich.tomas@gmail.com>
General Unicode support is tweaked to expose unicode_status.
function old new delta
init_unicode - 77 +77
write2stdout - 19 +19
adjust_column 68 71 +3
unicode_status - 1 +1
unicode_is_enabled 1 - -1
grep_main 780 773 -7
fold_main 619 552 -67
check_unicode_in_env 77 - -77
------------------------------------------------------------------------------
(add/remove: 3/2 grow/shrink: 1/2 up/down: 100/-152) Total: -52 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/unicode.h | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/include/unicode.h b/include/unicode.h index e0061478d..9f27657df 100644 --- a/include/unicode.h +++ b/include/unicode.h @@ -5,10 +5,17 @@ #ifndef UNICODE_H #define UNICODE_H 1 +enum { + UNICODE_UNKNOWN = 0, + UNICODE_OFF = 1, + UNICODE_ON = 2, +}; + #if !ENABLE_FEATURE_ASSUME_UNICODE # define bb_mbstrlen(string) strlen(string) -# define check_unicode_in_env() ((void)0) +# define unicode_status UNICODE_OFF +# define init_unicode() ((void)0) #else @@ -18,16 +25,19 @@ size_t bb_mbstrlen(const char *string) FAST_FUNC; # include <wchar.h> # include <wctype.h> -# define check_unicode_in_env() ((void)0) +extern uint8_t unicode_status; +void init_unicode(void) FAST_FUNC; # else /* Crude "locale support" which knows only C and Unicode locales */ # if !ENABLE_FEATURE_CHECK_UNICODE_IN_ENV -# define check_unicode_in_env() ((void)0) +# define unicode_status UNICODE_ON +# define init_unicode() ((void)0) # else -void check_unicode_in_env(void) FAST_FUNC; +extern uint8_t unicode_status; +void init_unicode(void) FAST_FUNC; # endif # undef MB_CUR_MAX |