From a334319f6530564d22e775935d9c91663623a1b4 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Wed, 22 Dec 2004 20:10:10 +0000 Subject: (CFLAGS-tst-align.c): Add -mpreferred-stack-boundary=4. --- libio/iofwide.c | 75 ++++++++++++++++++--------------------------------------- 1 file changed, 24 insertions(+), 51 deletions(-) (limited to 'libio/iofwide.c') diff --git a/libio/iofwide.c b/libio/iofwide.c index a9936687dd..03124219ad 100644 --- a/libio/iofwide.c +++ b/libio/iofwide.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1999-2003, 2005 Free Software Foundation, Inc. +/* Copyright (C) 1999, 2000, 2001, 2002, 2003 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 @@ -40,7 +40,6 @@ # include # include # include -# include #endif @@ -69,7 +68,7 @@ static int do_always_noconv (struct _IO_codecvt *codecvt); /* The functions used in `codecvt' for libio are always the same. */ -const struct _IO_codecvt __libio_codecvt = +struct _IO_codecvt __libio_codecvt = { .__codecvt_destr = NULL, /* Destructor, never used. */ .__codecvt_do_out = do_out, @@ -83,7 +82,7 @@ const struct _IO_codecvt __libio_codecvt = #ifdef _LIBC -const struct __gconv_trans_data __libio_translit attribute_hidden = +struct __gconv_trans_data __libio_translit attribute_hidden = { .__trans_fct = __gconv_transliterate }; @@ -127,11 +126,12 @@ _IO_fwide (fp, mode) selected locale for LC_CTYPE. */ #ifdef _LIBC { + struct gconv_fcts fcts; + /* Clear the state. We start all over again. */ memset (&fp->_wide_data->_IO_state, '\0', sizeof (__mbstate_t)); memset (&fp->_wide_data->_IO_last_state, '\0', sizeof (__mbstate_t)); - struct gconv_fcts fcts; __wcsmbs_clone_conv (&fcts); assert (fcts.towc_nsteps == 1); assert (fcts.tomb_nsteps == 1); @@ -159,8 +159,7 @@ _IO_fwide (fp, mode) cc->__cd_out.__cd.__data[0].__statep = &fp->_wide_data->_IO_state; /* And now the transliteration. */ - cc->__cd_out.__cd.__data[0].__trans - = (struct __gconv_trans_data *) &__libio_translit; + cc->__cd_out.__cd.__data[0].__trans = &__libio_translit; } #else # ifdef _GLIBCPP_USE_WCHAR_T @@ -229,23 +228,17 @@ do_out (struct _IO_codecvt *codecvt, __mbstate_t *statep, size_t dummy; const unsigned char *from_start_copy = (unsigned char *) from_start; - codecvt->__cd_out.__cd.__data[0].__outbuf = (unsigned char *) to_start; - codecvt->__cd_out.__cd.__data[0].__outbufend = (unsigned char *) to_end; + codecvt->__cd_out.__cd.__data[0].__outbuf = to_start; + codecvt->__cd_out.__cd.__data[0].__outbufend = to_end; codecvt->__cd_out.__cd.__data[0].__statep = statep; - __gconv_fct fct = gs->__fct; -#ifdef PTR_DEMANGLE - if (gs->__shlib_handle != NULL) - PTR_DEMANGLE (fct); -#endif - - status = DL_CALL_FCT (fct, + status = DL_CALL_FCT (gs->__fct, (gs, codecvt->__cd_out.__cd.__data, &from_start_copy, (const unsigned char *) from_end, NULL, &dummy, 0, 0)); *from_stop = (wchar_t *) from_start_copy; - *to_stop = (char *) codecvt->__cd_out.__cd.__data[0].__outbuf; + *to_stop = codecvt->__cd_out.__cd.__data[0].__outbuf; switch (status) { @@ -301,21 +294,15 @@ do_unshift (struct _IO_codecvt *codecvt, __mbstate_t *statep, int status; size_t dummy; - codecvt->__cd_out.__cd.__data[0].__outbuf = (unsigned char *) to_start; - codecvt->__cd_out.__cd.__data[0].__outbufend = (unsigned char *) to_end; + codecvt->__cd_out.__cd.__data[0].__outbuf = to_start; + codecvt->__cd_out.__cd.__data[0].__outbufend = to_end; codecvt->__cd_out.__cd.__data[0].__statep = statep; - __gconv_fct fct = gs->__fct; -#ifdef PTR_DEMANGLE - if (gs->__shlib_handle != NULL) - PTR_DEMANGLE (fct); -#endif - - status = DL_CALL_FCT (fct, + status = DL_CALL_FCT (gs->__fct, (gs, codecvt->__cd_out.__cd.__data, NULL, NULL, NULL, &dummy, 1, 0)); - *to_stop = (char *) codecvt->__cd_out.__cd.__data[0].__outbuf; + *to_stop = codecvt->__cd_out.__cd.__data[0].__outbuf; switch (status) { @@ -370,22 +357,15 @@ do_in (struct _IO_codecvt *codecvt, __mbstate_t *statep, size_t dummy; const unsigned char *from_start_copy = (unsigned char *) from_start; - codecvt->__cd_in.__cd.__data[0].__outbuf = (unsigned char *) to_start; - codecvt->__cd_in.__cd.__data[0].__outbufend = (unsigned char *) to_end; + codecvt->__cd_in.__cd.__data[0].__outbuf = (char *) to_start; + codecvt->__cd_in.__cd.__data[0].__outbufend = (char *) to_end; codecvt->__cd_in.__cd.__data[0].__statep = statep; - __gconv_fct fct = gs->__fct; -#ifdef PTR_DEMANGLE - if (gs->__shlib_handle != NULL) - PTR_DEMANGLE (fct); -#endif - - status = DL_CALL_FCT (fct, + status = DL_CALL_FCT (gs->__fct, (gs, codecvt->__cd_in.__cd.__data, &from_start_copy, - (const unsigned char *) from_end, NULL, - &dummy, 0, 0)); + from_end, NULL, &dummy, 0, 0)); - *from_stop = (const char *) from_start_copy; + *from_stop = from_start_copy; *to_stop = (wchar_t *) codecvt->__cd_in.__cd.__data[0].__outbuf; switch (status) @@ -474,20 +454,13 @@ do_length (struct _IO_codecvt *codecvt, __mbstate_t *statep, int status; size_t dummy; - codecvt->__cd_in.__cd.__data[0].__outbuf = (unsigned char *) to_buf; - codecvt->__cd_in.__cd.__data[0].__outbufend = (unsigned char *) &to_buf[max]; + codecvt->__cd_in.__cd.__data[0].__outbuf = (char *) to_buf; + codecvt->__cd_in.__cd.__data[0].__outbufend = (char *) &to_buf[max]; codecvt->__cd_in.__cd.__data[0].__statep = statep; - __gconv_fct fct = gs->__fct; -#ifdef PTR_DEMANGLE - if (gs->__shlib_handle != NULL) - PTR_DEMANGLE (fct); -#endif - - status = DL_CALL_FCT (fct, - (gs, codecvt->__cd_in.__cd.__data, &cp, - (const unsigned char *) from_end, NULL, - &dummy, 0, 0)); + status = DL_CALL_FCT (gs->__fct, + (gs, codecvt->__cd_in.__cd.__data, &cp, from_end, + NULL, &dummy, 0, 0)); result = cp - (const unsigned char *) from_start; #else -- cgit v1.2.3