@@ -211,6 +211,7 @@
transcription functions and ignoring of errors. Note that we cannot use
the do while (0) trick since `break' and `continue' must reach certain
points. */
+#if ! __GLIBC_PREREQ(2,21)
#define STANDARD_TO_LOOP_ERR_HANDLER(Incr) \
{ \
struct __gconv_trans_data *trans; \
@@ -258,6 +259,49 @@
that "iconv -c" must give the same exitcode as "iconv". */ \
continue; \
}
+#else
+#define STANDARD_TO_LOOP_ERR_HANDLER(Incr) \
+ { \
+ result = __GCONV_ILLEGAL_INPUT; \
+ \
+ if (irreversible == NULL) \
+ /* This means we are in call from __gconv_transliterate. In this \
+ case we are not doing any error recovery outself. */ \
+ break; \
+ \
+ /* If needed, flush any conversion state, so that __gconv_transliterate \
+ starts with current shift state. */ \
+ UPDATE_PARAMS; \
+ \
+ /* First try the transliteration methods. */ \
+ if ((step_data->__flags & __GCONV_TRANSLIT) != 0) \
+ result = __gconv_transliterate \
+ (step, step_data, *inptrp, \
+ &inptr, inend, &outptr, irreversible); \
+ \
+ REINIT_PARAMS; \
+ \
+ /* If any of them recognized the input continue with the loop. */ \
+ if (result != __GCONV_ILLEGAL_INPUT) \
+ { \
+ if (__glibc_unlikely (result == __GCONV_FULL_OUTPUT)) \
+ break; \
+ \
+ continue; \
+ } \
+ \
+ /* Next see whether we have to ignore the error. If not, stop. */ \
+ if (! ignore_errors_p ()) \
+ break; \
+ \
+ /* When we come here it means we ignore the character. */ \
+ ++*irreversible; \
+ inptr += Incr; \
+ /* But we keep result == __GCONV_ILLEGAL_INPUT, because of the constraint \
+ that "iconv -c" must give the same exitcode as "iconv". */ \
+ continue; \
+ }
+#endif \
/* Handling of Unicode 3.1 TAG characters. Unicode recommends
@@ -501,8 +501,14 @@ FUNCTION_NAME (struct __gconv_step *step, struct __gconv_step_data *data,
}
else
{
+#if ! __GLIBC_PREREQ(2,21)
/* We preserve the initial values of the pointer variables. */
const unsigned char *inptr = *inptrp;
+#else
+ /* We preserve the initial values of the pointer variables,
+ but only some conversion modules need it. */
+ const unsigned char *inptr __attribute__ ((__unused__)) = *inptrp;
+#endif
unsigned char *outbuf = (__builtin_expect (outbufstart == NULL, 1)
? data->__outbuf : *outbufstart);
unsigned char *outend = data->__outbufend;
@@ -592,8 +598,10 @@ FUNCTION_NAME (struct __gconv_step *step, struct __gconv_step_data *data,
while (1)
{
+#if ! __GLIBC_PREREQ(2,21)
struct __gconv_trans_data *trans;
+#endif
/* Remember the start value for this round. */
inptr = *inptrp;
/* The outbuf buffer is empty. */
@@ -640,6 +648,7 @@ FUNCTION_NAME (struct __gconv_step *step, struct __gconv_step_data *data,
return status;
}
+#if ! __GLIBC_PREREQ(2,21)
/* Give the transliteration module the chance to store the
original text and the result in case it needs a context. */
for (trans = data->__trans; trans != NULL; trans = trans->__next)
@@ -647,6 +656,7 @@ FUNCTION_NAME (struct __gconv_step *step, struct __gconv_step_data *data,
DL_CALL_FCT (trans->__trans_context_fct,
(trans->__data, inptr, *inptrp, outstart, outbuf));
+#endif
/* We finished one use of the loops. */
++data->__invocation_counter;