From cedb4109571cff4416235df260848de77f09f556 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sat, 28 Jul 2007 20:45:36 +0000 Subject: * locale/programs/ld-monetary.c (monetary_finish): Avoid range check for int_frac_digits and frac_digits. * login/logout.c (logout): Avoid aliasing violation. * login/logwtmp.c (logwtmp): Likewise. * libio/genops.c (_IO_un_link): Avoid aliasing violation. --- libio/genops.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'libio/genops.c') diff --git a/libio/genops.c b/libio/genops.c index 3f8d71a50f..7005fdbd96 100644 --- a/libio/genops.c +++ b/libio/genops.c @@ -64,23 +64,29 @@ _IO_un_link (fp) { if (fp->file._flags & _IO_LINKED) { - struct _IO_FILE_plus **f; + struct _IO_FILE **f; #ifdef _IO_MTSAFE_IO _IO_cleanup_region_start_noarg (flush_cleanup); _IO_lock_lock (list_all_lock); run_fp = (_IO_FILE *) fp; _IO_flockfile ((_IO_FILE *) fp); #endif - for (f = &INTUSE(_IO_list_all); *f; - f = (struct _IO_FILE_plus **) &(*f)->file._chain) + if (INTUSE(_IO_list_all) == NULL) + ; + else if (fp == INTUSE(_IO_list_all)) { - if (*f == fp) + INTUSE(_IO_list_all) + = (struct _IO_FILE_plus *) INTUSE(_IO_list_all)->file._chain; + ++_IO_list_all_stamp; + } + else + for (f = &INTUSE(_IO_list_all)->file._chain; *f; f = &(*f)->_chain) + if (*f == (_IO_FILE *) fp) { - *f = (struct _IO_FILE_plus *) fp->file._chain; + *f = fp->file._chain; ++_IO_list_all_stamp; break; } - } fp->file._flags &= ~_IO_LINKED; #ifdef _IO_MTSAFE_IO _IO_funlockfile ((_IO_FILE *) fp); -- cgit v1.2.3-65-gdbad