Get rid of lvalue casts etc.

Andreas Schwab schwab@suse.de
Thu Jan 22 13:24:00 GMT 2004


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."



More information about the Libc-hacker mailing list