learning-switch: Avoid violating C aliasing rules initializing actions.
authorBen Pfaff <blp@nicira.com>
Fri, 30 Jul 2010 21:51:35 +0000 (14:51 -0700)
committerBen Pfaff <blp@nicira.com>
Fri, 30 Jul 2010 23:04:29 +0000 (16:04 -0700)
commit3a929702ae4153c97ea1b0bbb6af96b5a59573d0
tree833bfb2953090a4fe82a63880a96738eba65611f
parent52af5b998fbb1b0914e995fe6f21378e394914eb
learning-switch: Avoid violating C aliasing rules initializing actions.

The C standard says that an object that is declared of one particular type
must not be accessed through a pointer to another type, with a few notable
exceptions.  This code was violating those rules, and GCC 4.4 complains
about it.  This commit fixes the problem by using one of the exceptions:
it's always OK to access an object as an array of character type (which is
what memcpy() does implicitly).

Reported-by: Justin Pettit <jpettit@nicira.com>
lib/learning-switch.c