cleanup utf-8 multibyte code, use visibility if possible
[musl] / src / multibyte / internal.h
index ec52bdf..df47331 100644 (file)
@@ -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