Remove left-overs of preloadable library (removed in 1.16). * include/iconv.h.in: Remove LIBICONV_PLUG conditionals. * lib/iconv.c: Likewise. * lib/converters.h: Likewise. * lib/loop_unicode.h: Likewise. * lib/loop_wchar.h: Likewise. * lib/iconv_open2.h: Likewise.
diff --git a/ChangeLog b/ChangeLog index 67ae48c..7d677e3 100644 --- a/ChangeLog +++ b/ChangeLog
@@ -1,5 +1,15 @@ 2024-12-14 Bruno Haible <bruno@clisp.org> + Remove left-overs of preloadable library (removed in 1.16). + * include/iconv.h.in: Remove LIBICONV_PLUG conditionals. + * lib/iconv.c: Likewise. + * lib/converters.h: Likewise. + * lib/loop_unicode.h: Likewise. + * lib/loop_wchar.h: Likewise. + * lib/iconv_open2.h: Likewise. + +2024-12-14 Bruno Haible <bruno@clisp.org> + Add transliteration of Emojis. Suggested by Colin Leroy-Mira <colin@colino.net> in <https://savannah.gnu.org/bugs/index.php?64046>.
diff --git a/include/iconv.h.in b/include/iconv.h.in index 839f73a..2cac3f6 100644 --- a/include/iconv.h.in +++ b/include/iconv.h.in
@@ -32,21 +32,16 @@ #endif /* We would like to #include any system header file which could define - iconv_t, 1. in order to eliminate the risk that the user gets compilation + iconv_t, in order to eliminate the risk that the user gets compilation errors because some other system header file includes /usr/include/iconv.h - which defines iconv_t or declares iconv after this file, 2. when compiling - for LIBICONV_PLUG, we need the proper iconv_t type in order to produce - binary compatible code. + which defines iconv_t or declares iconv after this file. But gcc's #include_next is not portable. Thus, once libiconv's iconv.h has been installed in /usr/local/include, there is no way any more to include the original /usr/include/iconv.h. We simply have to get away without it. - Ad 1. The risk that a system header file does + The risk that a system header file does #include "iconv.h" or #include_next "iconv.h" - is small. They all do #include <iconv.h>. - Ad 2. The iconv_t type is a pointer type in all cases I have seen. (It - has to be a scalar type because (iconv_t)(-1) is a possible return value - from iconv_open().) */ + is small. They all do #include <iconv.h>. */ /* Define iconv_t ourselves. */ #undef iconv_t @@ -74,9 +69,7 @@ /* Allocates descriptor for code conversion from encoding ‘fromcode’ to encoding ‘tocode’. */ -#ifndef LIBICONV_PLUG #define iconv_open libiconv_open -#endif extern iconv_t iconv_open (const char* tocode, const char* fromcode); /* Converts, using conversion descriptor ‘cd’, at most ‘*inbytesleft’ bytes @@ -84,15 +77,11 @@ ‘*outbuf’. Decrements ‘*inbytesleft’ and increments ‘*inbuf’ by the same amount. Decrements ‘*outbytesleft’ and increments ‘*outbuf’ by the same amount. */ -#ifndef LIBICONV_PLUG #define iconv libiconv -#endif extern size_t iconv (iconv_t cd, @ICONV_CONST@ char* * inbuf, size_t *inbytesleft, char* * outbuf, size_t *outbytesleft); /* Frees resources allocated for conversion descriptor ‘cd’. */ -#ifndef LIBICONV_PLUG #define iconv_close libiconv_close -#endif extern int iconv_close (iconv_t cd); @@ -101,8 +90,6 @@ #endif -#ifndef LIBICONV_PLUG - /* Nonstandard extensions. */ #if @USE_MBSTATE_T@ @@ -248,7 +235,5 @@ } #endif -#endif - #endif /* _LIBICONV_H */
diff --git a/lib/converters.h b/lib/converters.h index d3685c2..4bb0b7c 100644 --- a/lib/converters.h +++ b/lib/converters.h
@@ -110,10 +110,8 @@ /* Operation flags */ int transliterate; int discard_ilseq; - #ifndef LIBICONV_PLUG struct iconv_fallbacks fallbacks; struct iconv_hooks hooks; - #endif }; /*
diff --git a/lib/iconv.c b/lib/iconv.c index 178193e..62bf6a5 100644 --- a/lib/iconv.c +++ b/lib/iconv.c
@@ -1,5 +1,5 @@ /* - * Copyright (C) 1999-2008, 2011, 2016, 2018, 2020, 2022-2023 Free Software Foundation, Inc. + * Copyright (C) 1999-2024 Free Software Foundation, Inc. * This file is part of the GNU LIBICONV Library. * * The GNU LIBICONV Library is free software; you can redistribute it @@ -281,8 +281,6 @@ return 0; } -#ifndef LIBICONV_PLUG - /* * Verify that a 'struct conv_struct' and a 'struct wchar_conv_struct' each * fit in an iconv_allocation_t. @@ -655,5 +653,3 @@ strong_alias (libiconv, iconv) strong_alias (libiconv_close, iconv_close) #endif - -#endif
diff --git a/lib/iconv_open2.h b/lib/iconv_open2.h index 90ba8ea..e8818e7 100644 --- a/lib/iconv_open2.h +++ b/lib/iconv_open2.h
@@ -74,7 +74,6 @@ /* Initialize the operation flags. */ cd->transliterate = transliterate; cd->discard_ilseq = discard_ilseq; - #ifndef LIBICONV_PLUG cd->fallbacks.mb_to_uc_fallback = NULL; cd->fallbacks.uc_to_mb_fallback = NULL; cd->fallbacks.mb_to_wc_fallback = NULL; @@ -83,7 +82,6 @@ cd->hooks.uc_hook = NULL; cd->hooks.wc_hook = NULL; cd->hooks.data = NULL; - #endif /* Initialize additional fields. */ if (from_wchar != to_wchar) { struct wchar_conv_struct * wcd = (struct wchar_conv_struct *) cd;
diff --git a/lib/loop_unicode.h b/lib/loop_unicode.h index 973e8b7..fc17851 100644 --- a/lib/loop_unicode.h +++ b/lib/loop_unicode.h
@@ -1,5 +1,5 @@ /* - * Copyright (C) 1999-2003, 2005-2006, 2008 Free Software Foundation, Inc. + * Copyright (C) 1999-2024 Free Software Foundation, Inc. * This file is part of the GNU LIBICONV Library. * * The GNU LIBICONV Library is free software; you can redistribute it @@ -153,8 +153,6 @@ return RET_ILUNI; } -#ifndef LIBICONV_PLUG - struct uc_to_mb_fallback_locals { unsigned char* l_outbuf; size_t l_outbytesleft; @@ -219,9 +217,7 @@ if (cd->discard_ilseq) { outcount = 0; goto outcount_ok; - } - #ifndef LIBICONV_PLUG - else if (cd->fallbacks.uc_to_mb_fallback != NULL) { + } else if (cd->fallbacks.uc_to_mb_fallback != NULL) { struct uc_to_mb_fallback_locals locals; locals.l_outbuf = outptr; locals.l_outbytesleft = outleft; @@ -239,7 +235,6 @@ outcount = 0; goto outcount_ok; } - #endif outcount = cd->ofuncs.xxx_wctomb(cd,outptr,0xFFFD,outleft); if (outcount != RET_ILUNI) goto outcount_ok; @@ -250,10 +245,8 @@ plocals->l_errno = E2BIG; break; } - #ifndef LIBICONV_PLUG if (cd->hooks.uc_hook) (*cd->hooks.uc_hook)(wc, cd->hooks.data); - #endif if (!(outcount <= outleft)) abort(); outptr += outcount; outleft -= outcount; outcount_zero: ; @@ -263,8 +256,6 @@ } } -#endif /* !LIBICONV_PLUG */ - static size_t unicode_loop_convert (iconv_t icd, const char* * inbuf, size_t *inbytesleft, char* * outbuf, size_t *outbytesleft) @@ -299,9 +290,7 @@ incount += 1; break; } goto outcount_zero; - } - #ifndef LIBICONV_PLUG - else if (cd->fallbacks.mb_to_uc_fallback != NULL) { + } else if (cd->fallbacks.mb_to_uc_fallback != NULL) { unsigned int incount2; struct mb_to_uc_fallback_locals locals; switch (cd->iindex) { @@ -336,7 +325,6 @@ result += 1; goto outcount_zero; } - #endif inptr += incount; inleft -= incount; errno = EILSEQ; result = -1; @@ -374,9 +362,7 @@ if (cd->discard_ilseq) { outcount = 0; goto outcount_ok; - } - #ifndef LIBICONV_PLUG - else if (cd->fallbacks.uc_to_mb_fallback != NULL) { + } else if (cd->fallbacks.uc_to_mb_fallback != NULL) { struct uc_to_mb_fallback_locals locals; locals.l_outbuf = outptr; locals.l_outbytesleft = outleft; @@ -395,7 +381,6 @@ outcount = 0; goto outcount_ok; } - #endif outcount = cd->ofuncs.xxx_wctomb(cd,outptr,0xFFFD,outleft); if (outcount != RET_ILUNI) goto outcount_ok; @@ -410,10 +395,8 @@ result = -1; break; } - #ifndef LIBICONV_PLUG if (cd->hooks.uc_hook) (*cd->hooks.uc_hook)(wc, cd->hooks.data); - #endif if (!(outcount <= outleft)) abort(); outptr += outcount; outleft -= outcount; } @@ -461,9 +444,7 @@ if (cd->discard_ilseq) { outcount = 0; goto outcount_ok; - } - #ifndef LIBICONV_PLUG - else if (cd->fallbacks.uc_to_mb_fallback != NULL) { + } else if (cd->fallbacks.uc_to_mb_fallback != NULL) { struct uc_to_mb_fallback_locals locals; locals.l_outbuf = outptr; locals.l_outbytesleft = outleft; @@ -482,7 +463,6 @@ outcount = 0; goto outcount_ok; } - #endif outcount = cd->ofuncs.xxx_wctomb(cd,outptr,0xFFFD,outleft); if (outcount != RET_ILUNI) goto outcount_ok; @@ -495,10 +475,8 @@ errno = E2BIG; return -1; } - #ifndef LIBICONV_PLUG if (cd->hooks.uc_hook) (*cd->hooks.uc_hook)(wc, cd->hooks.data); - #endif if (!(outcount <= outleft)) abort(); outptr += outcount; outleft -= outcount;
diff --git a/lib/loop_wchar.h b/lib/loop_wchar.h index 9eb508e..e70084e 100644 --- a/lib/loop_wchar.h +++ b/lib/loop_wchar.h
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2000-2002, 2005-2006, 2008-2009, 2011, 2023 Free Software Foundation, Inc. + * Copyright (C) 2000-2024 Free Software Foundation, Inc. * This file is part of the GNU LIBICONV Library. * * The GNU LIBICONV Library is free software; you can redistribute it @@ -62,8 +62,6 @@ /* From wchar_t to anything else. */ -#ifndef LIBICONV_PLUG - #if 0 struct wc_to_mb_fallback_locals { @@ -134,8 +132,6 @@ #endif -#endif /* !LIBICONV_PLUG */ - static size_t wchar_from_loop_convert (iconv_t icd, const char* * inbuf, size_t *inbytesleft, char* * outbuf, size_t *outbytesleft) @@ -155,9 +151,7 @@ /* Invalid input. */ if (wcd->parent.discard_ilseq) { count = 0; - } - #ifndef LIBICONV_PLUG - else if (wcd->parent.fallbacks.wc_to_mb_fallback != NULL) { + } else if (wcd->parent.fallbacks.wc_to_mb_fallback != NULL) { /* Drop the contents of buf[] accumulated so far, and instead pass all queued wide characters to the fallback handler. */ struct wc_to_mb_fallback_locals locals; @@ -186,9 +180,7 @@ *outbytesleft = locals.l_outbytesleft; result += 1; break; - } - #endif - else { + } else { errno = EILSEQ; return -1; } @@ -290,8 +282,6 @@ /* From anything else to wchar_t. */ -#ifndef LIBICONV_PLUG - struct mb_to_wc_fallback_locals { char* l_outbuf; size_t l_outbytesleft; @@ -318,8 +308,6 @@ } } -#endif /* !LIBICONV_PLUG */ - static size_t wchar_to_loop_convert (iconv_t icd, const char* * inbuf, size_t *inbytesleft, char* * outbuf, size_t *outbytesleft) @@ -359,9 +347,7 @@ if (res == (size_t)(-1)) { /* Invalid input. */ if (wcd->parent.discard_ilseq) { - } - #ifndef LIBICONV_PLUG - else if (wcd->parent.fallbacks.mb_to_wc_fallback != NULL) { + } else if (wcd->parent.fallbacks.mb_to_wc_fallback != NULL) { /* Drop the contents of buf[] accumulated so far, and instead pass all queued chars to the fallback handler. */ struct mb_to_wc_fallback_locals locals; @@ -387,9 +373,7 @@ *outbytesleft = locals.l_outbytesleft; result += 1; break; - } - #endif - else + } else return -1; } else { if (*outbytesleft < sizeof(wchar_t)) { @@ -454,10 +438,8 @@ do { wchar_t wc = *inptr++; *outptr++ = wc; - #ifndef LIBICONV_PLUG if (cd->hooks.wc_hook) (*cd->hooks.wc_hook)(wc, cd->hooks.data); - #endif } while (--count > 0); *inbuf = (const char*) inptr; *outbuf = (char*) outptr;