compat-locales-sap/saplocales-2.2.5-rhel8.patch
2023-04-03 20:59:46 +00:00

672 lines
25 KiB
Diff

diff -rNu compat-locales-sap-1.0.10.orig/saplocales-2.2.5/iconv/libc-diag.h compat-locales-sap-1.0.10/saplocales-2.2.5/iconv/libc-diag.h
--- compat-locales-sap-1.0.10.orig/saplocales-2.2.5/iconv/libc-diag.h 1970-01-01 01:00:00.000000000 +0100
+++ compat-locales-sap-1.0.10/saplocales-2.2.5/iconv/libc-diag.h 2018-01-10 07:36:33.762358809 +0100
@@ -0,0 +1,74 @@
+/* Macros for controlling diagnostic output from the compiler.
+ Copyright (C) 2014-2018 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef _LIBC_DIAG_H
+#define _LIBC_DIAG_H 1
+
+/* Ignore the value of an expression when a cast to void does not
+ suffice (in particular, for a call to a function declared with
+ attribute warn_unused_result). */
+#define ignore_value(x) \
+ ({ __typeof__ (x) __ignored_value = (x); (void) __ignored_value; })
+
+/* The macros to control diagnostics are structured like this, rather
+ than a single macro that both pushes and pops diagnostic state and
+ takes the affected code as an argument, because the GCC pragmas
+ work by disabling the diagnostic for a range of source locations
+ and do not work when all the pragmas and the affected code are in a
+ single macro expansion. */
+
+/* Push diagnostic state. */
+#define DIAG_PUSH_NEEDS_COMMENT _Pragma ("GCC diagnostic push")
+
+/* Pop diagnostic state. */
+#define DIAG_POP_NEEDS_COMMENT _Pragma ("GCC diagnostic pop")
+
+#define _DIAG_STR1(s) #s
+#define _DIAG_STR(s) _DIAG_STR1(s)
+
+/* Ignore the diagnostic OPTION. VERSION is the most recent GCC
+ version for which the diagnostic has been confirmed to appear in
+ the absence of the pragma (in the form MAJOR.MINOR for GCC 4.x,
+ just MAJOR for GCC 5 and later). Uses of this pragma should be
+ reviewed when the GCC version given is no longer supported for
+ building glibc; the version number should always be on the same
+ source line as the macro name, so such uses can be found with grep.
+ Uses should come with a comment giving more details of the
+ diagnostic, and an architecture on which it is seen if possibly
+ optimization-related and not in architecture-specific code. This
+ macro should only be used if the diagnostic seems hard to fix (for
+ example, optimization-related false positives). */
+#define DIAG_IGNORE_NEEDS_COMMENT(version, option) \
+ _Pragma (_DIAG_STR (GCC diagnostic ignored option))
+
+/* Similar to DIAG_IGNORE_NEEDS_COMMENT the following macro ignores the
+ diagnostic OPTION but only if optimizations for size are enabled.
+ This is required because different warnings may be generated for
+ different optimization levels. For example a key piece of code may
+ only generate a warning when compiled at -Os, but at -O2 you could
+ still want the warning to be enabled to catch errors. In this case
+ you would use DIAG_IGNORE_Os_NEEDS_COMMENT to disable the warning
+ only for -Os. */
+#ifdef __OPTIMIZE_SIZE__
+# define DIAG_IGNORE_Os_NEEDS_COMMENT(version, option) \
+ _Pragma (_DIAG_STR (GCC diagnostic ignored option))
+#else
+# define DIAG_IGNORE_Os_NEEDS_COMMENT(version, option)
+#endif
+
+#endif /* libc-diag.h */
diff -rNu compat-locales-sap-1.0.10.orig/saplocales-2.2.5/iconv/loop.c compat-locales-sap-1.0.10/saplocales-2.2.5/iconv/loop.c
--- compat-locales-sap-1.0.10.orig/saplocales-2.2.5/iconv/loop.c 2018-01-09 12:42:01.393580878 +0100
+++ compat-locales-sap-1.0.10/saplocales-2.2.5/iconv/loop.c 2018-01-09 12:42:28.069281608 +0100
@@ -1,5 +1,5 @@
/* Conversion loop frame work.
- Copyright (C) 1998-2002, 2003, 2005, 2008 Free Software Foundation, Inc.
+ Copyright (C) 1998-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
@@ -14,9 +14,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
/* This file provides a frame for the reader loop in all conversion modules.
The actual code must (of course) be provided in the actual module source
@@ -39,7 +38,7 @@
BODY this is supposed to expand to the body of the loop.
The user must provide this.
- EXTRA_LOOP_DECLS extra arguments passed from converion loop call.
+ EXTRA_LOOP_DECLS extra arguments passed from conversion loop call.
INIT_PARAMS code to define and initialize variables from params.
UPDATE_PARAMS code to store result in params.
@@ -57,17 +56,17 @@
#include <sys/param.h> /* For MIN. */
#define __need_size_t
#include <stddef.h>
-
+#include <libc-diag.h>
/* We have to provide support for machines which are not able to handled
unaligned memory accesses. Some of the character encodings have
representations with a fixed width of 2 or 4 bytes. But if we cannot
access unaligned memory we still have to read byte-wise. */
#undef FCTNAME2
-#if defined _STRING_ARCH_unaligned || !defined DEFINE_UNALIGNED
+#if _STRING_ARCH_unaligned || !defined DEFINE_UNALIGNED
/* We can handle unaligned memory access. */
-# define get16(addr) *((__const uint16_t *) (addr))
-# define get32(addr) *((__const uint32_t *) (addr))
+# define get16(addr) *((const uint16_t *) (addr))
+# define get32(addr) *((const uint32_t *) (addr))
/* We need no special support for writing values either. */
# define put16(addr, val) *((uint16_t *) (addr)) = (val)
@@ -78,13 +77,13 @@
/* Distinguish between big endian and little endian. */
# if __BYTE_ORDER == __LITTLE_ENDIAN
# define get16(addr) \
- (((__const unsigned char *) (addr))[1] << 8 \
- | ((__const unsigned char *) (addr))[0])
+ (((const unsigned char *) (addr))[1] << 8 \
+ | ((const unsigned char *) (addr))[0])
# define get32(addr) \
- (((((__const unsigned char *) (addr))[3] << 8 \
- | ((__const unsigned char *) (addr))[2]) << 8 \
- | ((__const unsigned char *) (addr))[1]) << 8 \
- | ((__const unsigned char *) (addr))[0])
+ (((((const unsigned char *) (addr))[3] << 8 \
+ | ((const unsigned char *) (addr))[2]) << 8 \
+ | ((const unsigned char *) (addr))[1]) << 8 \
+ | ((const unsigned char *) (addr))[0])
# define put16(addr, val) \
({ uint16_t __val = (val); \
@@ -103,13 +102,13 @@
(void) 0; })
# else
# define get16(addr) \
- (((__const unsigned char *) (addr))[0] << 8 \
- | ((__const unsigned char *) (addr))[1])
+ (((const unsigned char *) (addr))[0] << 8 \
+ | ((const unsigned char *) (addr))[1])
# define get32(addr) \
- (((((__const unsigned char *) (addr))[0] << 8 \
- | ((__const unsigned char *) (addr))[1]) << 8 \
- | ((__const unsigned char *) (addr))[2]) << 8 \
- | ((__const unsigned char *) (addr))[3])
+ (((((const unsigned char *) (addr))[0] << 8 \
+ | ((const unsigned char *) (addr))[1]) << 8 \
+ | ((const unsigned char *) (addr))[2]) << 8 \
+ | ((const unsigned char *) (addr))[3])
# define put16(addr, val) \
({ uint16_t __val = (val); \
@@ -214,8 +213,6 @@
points. */
#define STANDARD_TO_LOOP_ERR_HANDLER(Incr) \
{ \
- struct __gconv_trans_data *trans; \
- \
result = __GCONV_ILLEGAL_INPUT; \
\
if (irreversible == NULL) \
@@ -228,21 +225,17 @@
UPDATE_PARAMS; \
\
/* First try the transliteration methods. */ \
- for (trans = step_data->__trans; trans != NULL; trans = trans->__next) \
- { \
- result = DL_CALL_FCT (trans->__trans_fct, \
- (step, step_data, trans->__data, *inptrp, \
- &inptr, inend, &outptr, irreversible)); \
- if (result != __GCONV_ILLEGAL_INPUT) \
- break; \
- } \
+ 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 (__builtin_expect (result == __GCONV_FULL_OUTPUT, 0)) \
+ if (__glibc_unlikely (result == __GCONV_FULL_OUTPUT)) \
break; \
\
continue; \
@@ -343,7 +336,7 @@
/* Include the file a second time to define the function to handle
unaligned access. */
-#if !defined DEFINE_UNALIGNED && !defined _STRING_ARCH_unaligned \
+#if !defined DEFINE_UNALIGNED && !_STRING_ARCH_unaligned \
&& MIN_NEEDED_INPUT != 1 && MAX_NEEDED_INPUT % MIN_NEEDED_INPUT == 0 \
&& MIN_NEEDED_OUTPUT != 1 && MAX_NEEDED_OUTPUT % MIN_NEEDED_OUTPUT == 0
# undef get16
@@ -355,12 +348,10 @@
# define DEFINE_UNALIGNED
# include "loop.c"
# undef DEFINE_UNALIGNED
-#endif
-
-
-#if MAX_NEEDED_INPUT > 1
-# define SINGLE(fct) SINGLE2 (fct)
-# define SINGLE2(fct) fct##_single
+#else
+# if MAX_NEEDED_INPUT > 1
+# define SINGLE(fct) SINGLE2 (fct)
+# define SINGLE2(fct) fct##_single
static inline int
__attribute ((always_inline))
SINGLE(LOOPFCT) (struct __gconv_step *step,
@@ -370,46 +361,57 @@
size_t *irreversible EXTRA_LOOP_DECLS)
{
mbstate_t *state = step_data->__statep;
-#ifdef LOOP_NEED_FLAGS
+# ifdef LOOP_NEED_FLAGS
int flags = step_data->__flags;
-#endif
-#ifdef LOOP_NEED_DATA
+# endif
+# ifdef LOOP_NEED_DATA
void *data = step->__data;
-#endif
+# endif
int result = __GCONV_OK;
unsigned char bytebuf[MAX_NEEDED_INPUT];
const unsigned char *inptr = *inptrp;
unsigned char *outptr = *outptrp;
size_t inlen;
-#ifdef INIT_PARAMS
+# ifdef INIT_PARAMS
INIT_PARAMS;
-#endif
+# endif
-#ifdef UNPACK_BYTES
+# ifdef UNPACK_BYTES
UNPACK_BYTES
-#else
+# else
/* Add the bytes from the state to the input buffer. */
+ assert ((state->__count & 7) <= sizeof (state->__value));
for (inlen = 0; inlen < (size_t) (state->__count & 7); ++inlen)
bytebuf[inlen] = state->__value.__wchb[inlen];
-#endif
+# endif
/* Are there enough bytes in the input buffer? */
- if (__builtin_expect (inptr + (MIN_NEEDED_INPUT - inlen) > inend, 0))
+ if (MIN_NEEDED_INPUT > 1
+ && __builtin_expect (inptr + (MIN_NEEDED_INPUT - inlen) > inend, 0))
{
*inptrp = inend;
-#ifdef STORE_REST
+# ifdef STORE_REST
+
+ /* Building with -O3 GCC emits a `array subscript is above array
+ bounds' warning. GCC BZ #64739 has been opened for this. */
+ DIAG_PUSH_NEEDS_COMMENT;
+ DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Warray-bounds");
+ while (inptr < inend)
+ bytebuf[inlen++] = *inptr++;
+ DIAG_POP_NEEDS_COMMENT;
+
inptr = bytebuf;
inptrp = &inptr;
inend = &bytebuf[inlen];
STORE_REST
-#else
+# else
/* We don't have enough input for another complete input
character. */
while (inptr < inend)
state->__value.__wchb[inlen++] = *inptr++;
-#endif
+# endif
return __GCONV_INCOMPLETE_INPUT;
}
@@ -438,7 +440,7 @@
bytes from the state and at least one more, or the character is still
incomplete, or we have some other error (like illegal input character,
no space in output buffer). */
- if (__builtin_expect (inptr != bytebuf, 1))
+ if (__glibc_likely (inptr != bytebuf))
{
/* We found a new character. */
assert (inptr - bytebuf > (state->__count & 7));
@@ -449,11 +451,11 @@
result = __GCONV_OK;
/* Clear the state buffer. */
-#ifdef CLEAR_STATE
+# ifdef CLEAR_STATE
CLEAR_STATE;
-#else
+# else
state->__count &= ~7;
-#endif
+# endif
}
else if (result == __GCONV_INCOMPLETE_INPUT)
{
@@ -462,37 +464,38 @@
assert (inend != &bytebuf[MAX_NEEDED_INPUT]);
*inptrp += inend - bytebuf - (state->__count & 7);
-#ifdef STORE_REST
+# ifdef STORE_REST
inptrp = &inptr;
STORE_REST
-#else
+# else
/* We don't have enough input for another complete input
character. */
assert (inend - inptr > (state->__count & ~7));
- assert (inend - inptr <= 7);
+ assert (inend - inptr <= sizeof (state->__value));
state->__count = (state->__count & ~7) | (inend - inptr);
inlen = 0;
while (inptr < inend)
state->__value.__wchb[inlen++] = *inptr++;
-#endif
+# endif
}
return result;
}
-# undef SINGLE
-# undef SINGLE2
-#endif
+# undef SINGLE
+# undef SINGLE2
+# endif
-#ifdef ONEBYTE_BODY
+# ifdef ONEBYTE_BODY
/* Define the shortcut function for btowc. */
static wint_t
gconv_btowc (struct __gconv_step *step, unsigned char c)
ONEBYTE_BODY
-# define FROM_ONEBYTE gconv_btowc
-#endif
+# define FROM_ONEBYTE gconv_btowc
+# endif
+#endif
/* We remove the macro definitions so that we can include this file again
for the definition of another function. */
diff -rNu compat-locales-sap-1.0.10.orig/saplocales-2.2.5/iconv/skeleton.c compat-locales-sap-1.0.10/saplocales-2.2.5/iconv/skeleton.c
--- compat-locales-sap-1.0.10.orig/saplocales-2.2.5/iconv/skeleton.c 2018-01-09 12:42:01.394580867 +0100
+++ compat-locales-sap-1.0.10/saplocales-2.2.5/iconv/skeleton.c 2018-01-10 07:58:37.922439161 +0100
@@ -1,5 +1,5 @@
/* Skeleton for a conversion module.
- Copyright (C) 1998-2002, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1998-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
@@ -14,9 +14,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
/* This file can be included to provide definitions of several things
many modules have in common. It can be customized using the following
@@ -39,24 +38,24 @@
FROM_LOOP_MIN_NEEDED_FROM
FROM_LOOP_MAX_NEEDED_FROM
- minimal/maximal number of bytes needed on input
- of one round through the FROM_LOOP. Defaults
- to MIN_NEEDED_FROM and MAX_NEEDED_FROM, respectively.
+ minimal/maximal number of bytes needed on input
+ of one round through the FROM_LOOP. Defaults
+ to MIN_NEEDED_FROM and MAX_NEEDED_FROM, respectively.
FROM_LOOP_MIN_NEEDED_TO
FROM_LOOP_MAX_NEEDED_TO
- minimal/maximal number of bytes needed on output
- of one round through the FROM_LOOP. Defaults
- to MIN_NEEDED_TO and MAX_NEEDED_TO, respectively.
+ minimal/maximal number of bytes needed on output
+ of one round through the FROM_LOOP. Defaults
+ to MIN_NEEDED_TO and MAX_NEEDED_TO, respectively.
TO_LOOP_MIN_NEEDED_FROM
TO_LOOP_MAX_NEEDED_FROM
- minimal/maximal number of bytes needed on input
- of one round through the TO_LOOP. Defaults
- to MIN_NEEDED_TO and MAX_NEEDED_TO, respectively.
+ minimal/maximal number of bytes needed on input
+ of one round through the TO_LOOP. Defaults
+ to MIN_NEEDED_TO and MAX_NEEDED_TO, respectively.
TO_LOOP_MIN_NEEDED_TO
TO_LOOP_MAX_NEEDED_TO
- minimal/maximal number of bytes needed on output
- of one round through the TO_LOOP. Defaults
- to MIN_NEEDED_FROM and MAX_NEEDED_FROM, respectively.
+ minimal/maximal number of bytes needed on output
+ of one round through the TO_LOOP. Defaults
+ to MIN_NEEDED_FROM and MAX_NEEDED_FROM, respectively.
FROM_DIRECTION this macro is supposed to return a value != 0
if we convert from the current character set,
@@ -145,6 +144,7 @@
#endif
#include <sysdep.h>
+#include <stdint.h>
#ifndef DL_CALL_FCT
# define DL_CALL_FCT(fct, args) fct args
@@ -163,7 +163,6 @@
# endif
#endif
-
/* How many bytes are needed at most for the from-charset. */
#ifndef MAX_NEEDED_FROM
# define MAX_NEEDED_FROM MIN_NEEDED_FROM
@@ -204,10 +203,10 @@
/* Define macros which can access unaligned buffers. These macros are
supposed to be used only in code outside the inner loops. For the inner
loops we have other definitions which allow optimized access. */
-#ifdef _STRING_ARCH_unaligned
+#if _STRING_ARCH_unaligned
/* We can handle unaligned memory access. */
-# define get16u(addr) *((__const uint16_t *) (addr))
-# define get32u(addr) *((__const uint32_t *) (addr))
+# define get16u(addr) *((const uint16_t *) (addr))
+# define get32u(addr) *((const uint32_t *) (addr))
/* We need no special support for writing values either. */
# define put16u(addr, val) *((uint16_t *) (addr)) = (val)
@@ -216,13 +215,13 @@
/* Distinguish between big endian and little endian. */
# if __BYTE_ORDER == __LITTLE_ENDIAN
# define get16u(addr) \
- (((__const unsigned char *) (addr))[1] << 8 \
- | ((__const unsigned char *) (addr))[0])
+ (((const unsigned char *) (addr))[1] << 8 \
+ | ((const unsigned char *) (addr))[0])
# define get32u(addr) \
- (((((__const unsigned char *) (addr))[3] << 8 \
- | ((__const unsigned char *) (addr))[2]) << 8 \
- | ((__const unsigned char *) (addr))[1]) << 8 \
- | ((__const unsigned char *) (addr))[0])
+ (((((const unsigned char *) (addr))[3] << 8 \
+ | ((const unsigned char *) (addr))[2]) << 8 \
+ | ((const unsigned char *) (addr))[1]) << 8 \
+ | ((const unsigned char *) (addr))[0])
# define put16u(addr, val) \
({ uint16_t __val = (val); \
@@ -241,13 +240,13 @@
(void) 0; })
# else
# define get16u(addr) \
- (((__const unsigned char *) (addr))[0] << 8 \
- | ((__const unsigned char *) (addr))[1])
+ (((const unsigned char *) (addr))[0] << 8 \
+ | ((const unsigned char *) (addr))[1])
# define get32u(addr) \
- (((((__const unsigned char *) (addr))[0] << 8 \
- | ((__const unsigned char *) (addr))[1]) << 8 \
- | ((__const unsigned char *) (addr))[2]) << 8 \
- | ((__const unsigned char *) (addr))[3])
+ (((((const unsigned char *) (addr))[0] << 8 \
+ | ((const unsigned char *) (addr))[1]) << 8 \
+ | ((const unsigned char *) (addr))[2]) << 8 \
+ | ((const unsigned char *) (addr))[3])
# define put16u(addr, val) \
({ uint16_t __val = (val); \
@@ -410,7 +409,7 @@
/* If the function is called with no input this means we have to reset
to the initial state. The possibly partly converted input is
dropped. */
- if (__builtin_expect (do_flush, 0))
+ if (__glibc_unlikely (do_flush))
{
/* This should never happen during error handling. */
assert (outbufstart == NULL);
@@ -461,7 +460,7 @@
if (result != __GCONV_EMPTY_INPUT)
{
- if (__builtin_expect (outerr != outbuf, 0))
+ if (__glibc_unlikely (outerr != outbuf))
{
/* We have a problem. Undo the conversion. */
outbuf = outstart;
@@ -502,8 +501,9 @@
}
else
{
- /* We preserve the initial values of the pointer variables. */
- const unsigned char *inptr = *inptrp;
+ /* We preserve the initial values of the pointer variables,
+ but only some conversion modules need it. */
+ const unsigned char *inptr __attribute__ ((__unused__)) = *inptrp;
unsigned char *outbuf = (__builtin_expect (outbufstart == NULL, 1)
? data->__outbuf : *outbufstart);
unsigned char *outend = data->__outbufend;
@@ -514,7 +514,7 @@
size_t *lirreversiblep = irreversible ? &lirreversible : NULL;
/* The following assumes that encodings, which have a variable length
- what might unalign a buffer even though it is a aligned in the
+ what might unalign a buffer even though it is an aligned in the
beginning, either don't have the minimal number of bytes as a divisor
of the maximum length or have a minimum length of 1. This is true
for all known and supported encodings.
@@ -523,7 +523,7 @@
INTERNAL, for which the subexpression evaluates to 1, but INTERNAL
buffers are always aligned correctly. */
#define POSSIBLY_UNALIGNED \
- (!defined _STRING_ARCH_unaligned \
+ (!_STRING_ARCH_unaligned \
&& (((FROM_LOOP_MIN_NEEDED_FROM != 1 \
&& FROM_LOOP_MAX_NEEDED_FROM % FROM_LOOP_MIN_NEEDED_FROM == 0) \
&& (FROM_LOOP_MIN_NEEDED_TO != 1 \
@@ -554,8 +554,8 @@
&& consume_incomplete && (data->__statep->__count & 7) != 0)
{
/* Yep, we have some bytes left over. Process them now.
- But this must not happen while we are called from an
- error handler. */
+ But this must not happen while we are called from an
+ error handler. */
assert (outbufstart == NULL);
# if FROM_LOOP_MAX_NEEDED_FROM > 1
@@ -593,8 +593,6 @@
while (1)
{
- struct __gconv_trans_data *trans;
-
/* Remember the start value for this round. */
inptr = *inptrp;
/* The outbuf buffer is empty. */
@@ -604,7 +602,7 @@
SAVE_RESET_STATE (1);
#endif
- if (__builtin_expect (!unaligned, 1))
+ if (__glibc_likely (!unaligned))
{
if (FROM_DIRECTION)
/* Run the conversion loop. */
@@ -635,38 +633,31 @@
/* If we were called as part of an error handling module we
don't do anything else here. */
- if (__builtin_expect (outbufstart != NULL, 0))
+ if (__glibc_unlikely (outbufstart != NULL))
{
*outbufstart = outbuf;
return status;
}
- /* 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)
- if (trans->__trans_context_fct != NULL)
- DL_CALL_FCT (trans->__trans_context_fct,
- (trans->__data, inptr, *inptrp, outstart, outbuf));
-
/* We finished one use of the loops. */
++data->__invocation_counter;
/* If this is the last step leave the loop, there is nothing
- we can do. */
- if (__builtin_expect (data->__flags & __GCONV_IS_LAST, 0))
+ we can do. */
+ if (__glibc_unlikely (data->__flags & __GCONV_IS_LAST))
{
/* Store information about how many bytes are available. */
data->__outbuf = outbuf;
/* Remember how many non-identical characters we
- converted in a irreversible way. */
+ converted in an irreversible way. */
*irreversible += lirreversible;
break;
}
/* Write out all output which was produced. */
- if (__builtin_expect (outbuf > outstart, 1))
+ if (__glibc_likely (outbuf > outstart))
{
const unsigned char *outerr = data->__outbuf;
int result;
@@ -677,14 +668,14 @@
if (result != __GCONV_EMPTY_INPUT)
{
- if (__builtin_expect (outerr != outbuf, 0))
+ if (__glibc_unlikely (outerr != outbuf))
{
#ifdef RESET_INPUT_BUFFER
RESET_INPUT_BUFFER;
#else
/* We have a problem in one of the functions below.
Undo the conversion upto the error point. */
- size_t nstatus;
+ size_t nstatus __attribute__ ((unused));
/* Reload the pointers. */
*inptrp = inptr;
@@ -695,7 +686,7 @@
SAVE_RESET_STATE (0);
# endif
- if (__builtin_expect (!unaligned, 1))
+ if (__glibc_likely (!unaligned))
{
if (FROM_DIRECTION)
/* Run the conversion loop. */
@@ -738,7 +729,7 @@
/* If we haven't consumed a single byte decrement
the invocation counter. */
- if (__builtin_expect (outbuf == outstart, 0))
+ if (__glibc_unlikely (outbuf == outstart))
--data->__invocation_counter;
#endif /* reset input buffer */
}
@@ -782,7 +773,7 @@
STORE_REST
# else
/* Make sure the remaining bytes fit into the state objects
- buffer. */
+ buffer. */
assert (inend - *inptrp < 4);
size_t cnt;