]> git.ipfire.org Git - thirdparty/iw.git/commitdiff
scan: don't define only an unnamed union in a struct
authorJohannes Berg <johannes@sipsolutions.net>
Wed, 22 Sep 2010 09:32:54 +0000 (11:32 +0200)
committerJohannes Berg <johannes@sipsolutions.net>
Wed, 22 Sep 2010 09:32:54 +0000 (11:32 +0200)
scan.c

diff --git a/scan.c b/scan.c
index 77cf678440b697aef4234e45a1a93317788af770..1a8c3b3facc740133b71b4cd7627bb30cec0ccbc 100644 (file)
--- a/scan.c
+++ b/scan.c
@@ -38,19 +38,17 @@ struct scan_params {
 
 #define IEEE80211_COUNTRY_EXTENSION_ID 201
 
-struct ieee80211_country_ie_triplet {
-       union {
-               struct {
-                       __u8 first_channel;
-                       __u8 num_channels;
-                       __s8 max_power;
-               } __attribute__ ((packed)) chans;
-               struct {
-                       __u8 reg_extension_id;
-                       __u8 reg_class;
-                       __u8 coverage_class;
-               } __attribute__ ((packed)) ext;
-       };
+union ieee80211_country_ie_triplet {
+       struct {
+               __u8 first_channel;
+               __u8 num_channels;
+               __s8 max_power;
+       } __attribute__ ((packed)) chans;
+       struct {
+               __u8 reg_extension_id;
+               __u8 reg_class;
+               __u8 coverage_class;
+       } __attribute__ ((packed)) ext;
 } __attribute__ ((packed));
 
 static int handle_scan(struct nl80211_state *state,
@@ -204,8 +202,7 @@ static void print_country(const uint8_t type, uint8_t len, const uint8_t *data)
 
        while (len >= 3) {
                int end_channel;
-               struct ieee80211_country_ie_triplet *triplet =
-                       (struct ieee80211_country_ie_triplet *) data;
+               union ieee80211_country_ie_triplet *triplet = (void *) data;
 
                if (triplet->ext.reg_extension_id >= IEEE80211_COUNTRY_EXTENSION_ID) {
                        printf("\t\tExtension ID: %d Regulatory Class: %d Coverage class: %d (up to %dm)\n",