This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Get rid of lvalue casts etc.


Andreas Jaeger <aj@suse.de> writes:

> @@ -195,7 +197,8 @@ internal_ucs4_loop_single (struct __gcon
>    *outptrp += 4;
>  #elif __BYTE_ORDER == __BIG_ENDIAN
>    /* XXX unaligned */
> -  *(*((uint32_t **) outptrp)++) = state->__value.__wch;
> +  *(*((uint32_t **) outptrp)) = state->__value.__wch;
> +  *outptrp += sizeof (uint32_t *);

The big endian version was actually wrong, and sizeof(uint32_t*) makes it
even worse.  IMHO this should just be written like this:

  (*outptrp)[0] = state->__value.__wchb[0];
  (*outptrp)[1] = state->__value.__wchb[1];
  (*outptrp)[2] = state->__value.__wchb[2];
  (*outptrp)[3] = state->__value.__wchb[3];

> @@ -558,7 +562,9 @@ internal_ucs4le_loop_single (struct __gc
>    *outptrp += 4;
>  #else
>    /* XXX unaligned */
> -  *(*((uint32_t **) outptrp)++) = state->__value.__wch;
> +  
> +  *(*((uint32_t **) outptrp)) = state->__value.__wch;
> +  *outptrp += sizeof (uint32_t);

Same here.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]