summaryrefslogtreecommitdiff
path: root/src/multibyte/internal.h
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2011-02-27 00:28:59 -0500
committerRich Felker <dalias@aerifal.cx>2011-02-27 00:28:59 -0500
commit015d33c5075b9c0a4df8f28e844e4f7ace91c647 (patch)
tree6afdfbd8af5c6c7a550f8cf4a070e965b6806897 /src/multibyte/internal.h
parent2a195dd31ceb2a483ea547444aac080bee132ad2 (diff)
downloadmusl-015d33c5075b9c0a4df8f28e844e4f7ace91c647.tar.gz
cleanup utf-8 multibyte code, use visibility if possible
this code was written independently of musl, with support for a the backwards, nonstandard "31-bit unicode" some libraries/apps might want. unfortunately the extra code (inside #ifdef) makes the source harder to read and makes code that should be simple look complex, so i'm removing it. anyone who wants to use the old code can find it in the history or from elsewhere. also, change the visibility of the __fsmu8 state machine table to hidden, if supported. this should improve performance slightly in shared-library builds.
Diffstat (limited to 'src/multibyte/internal.h')
-rw-r--r--src/multibyte/internal.h45
1 files changed, 4 insertions, 41 deletions
diff --git a/src/multibyte/internal.h b/src/multibyte/internal.h
index ec52bdfa..df47331e 100644
--- a/src/multibyte/internal.h
+++ b/src/multibyte/internal.h
@@ -4,45 +4,13 @@
* unnecessary.
*/
-#define LIBC
-#ifndef LIBC
-/* rename functions not to conflict with libc */
-#ifndef myprefix
-#define myprefix fsmu8_
-#endif
-#define concat2(a,b) a ## b
-#define concat(a,b) concat2(a,b)
-#define prefix(b) concat(myprefix,b)
-
-#undef mblen
-#undef mbrlen
-#undef mbrtowc
-#undef mbsinit
-#undef mbsnrtowcs
-#undef mbsrtowcs
-#undef wcrtomb
-#undef wcsrtombs
-#undef wcstombs
-#undef wctomb
-#define mblen prefix(mblen)
-#define mbrlen prefix(mbrlen)
-#define mbrtowc prefix(mbrtowc)
-#define mbsinit prefix(mbsinit)
-#define mbsnrtowcs prefix(mbsnrtowcs)
-#define mbsrtowcs prefix(mbsrtowcs)
-#define mbstowcs prefix(mbstowcs)
-#define wcrtomb prefix(wcrtomb)
-#define wcsnrtombs prefix(wcsnrtombs)
-#define wcsrtombs prefix(wcsrtombs)
-#define wcstombs prefix(wcstombs)
-#define wctomb prefix(wctomb)
-
-#define bittab prefix(bittab)
-#else
#define bittab __fsmu8
-#endif
+#if 100*__GNUC__+__GNUC_MINOR__ >= 303 || defined(__PCC__) || defined(__TINYC__)
+extern const uint32_t bittab[] __attribute__((visibility("hidden")));
+#else
extern const uint32_t bittab[];
+#endif
/* Upper 6 state bits are a negative integer offset to bound-check next byte */
/* equivalent to: ( (b-0x80) | (b+offset) ) & ~0x3f */
@@ -52,10 +20,5 @@ extern const uint32_t bittab[];
#define R(a,b) ((uint32_t)((a==0x80 ? 0x40-b : -a) << 23))
#define FAILSTATE R(0x80,0x80)
-#ifdef I_FAILED_TO_RTFM_RFC3629
-#define SA 0xc2u
-#define SB 0xfeu
-#else
#define SA 0xc2u
#define SB 0xf5u
-#endif