osmocom: Address warning about aliasing
commita73c98a3abd2dc20145325436cefa2705c0db8f1
authorHolger Hans Peter Freyther <zecke@selfish.org>
Sun, 6 Nov 2011 21:05:03 +0000 (6 22:05 +0100)
committerHolger Hans Peter Freyther <zecke@selfish.org>
Sun, 6 Nov 2011 21:10:42 +0000 (6 22:10 +0100)
tree5d266a9bfd35eda78b6b6dfe0c8e34a2169e87e2
parent6d1f1163381707a7f4172e2a19e5646b38fb12c9
osmocom: Address warning about aliasing

We alias the uint8_t buf[..] to a uint16_t* which is violating
the aliases rule of C. Use an explicit memcpy to copy the first
two byte of the buffer. GCC 4.6.2 (debian) is clever enough to
use a normal load does not generate a memcpy call.

osmocon.c: In function ‘un_tool_read’:
osmocon.c:1239:2: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
src/host/osmocon/osmocon.c