From cac07387238cbefdc3ccda768a2d2c2da4a9868c Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Thu, 2 Feb 2017 12:34:30 +0100 Subject: [PATCH] device: change hw_addr_type field to bitfield type We don't want to waste a full "int" size to store the @hw_addr_type in NMDevicePrivate. Previously, that was hacked around by using guint8. Now, instead use a bitfield which has the right type. --- src/devices/nm-device.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 4006e2c5d..887d9c55a 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -222,7 +222,8 @@ typedef struct _NMDevicePrivate { const guint8 hw_addr_len; /* read-only */ guint8 hw_addr_len_; }; - guint8 /*HwAddrType*/ hw_addr_type; + + HwAddrType hw_addr_type:5; bool real:1; @@ -12575,7 +12576,9 @@ nm_device_hw_addr_is_explict (NMDevice *self) g_return_val_if_fail (NM_IS_DEVICE (self), FALSE); priv = NM_DEVICE_GET_PRIVATE (self); - return !NM_IN_SET (priv->hw_addr_type, HW_ADDR_TYPE_PERMANENT, HW_ADDR_TYPE_UNSET); + return !NM_IN_SET ((HwAddrType) priv->hw_addr_type, + HW_ADDR_TYPE_PERMANENT, + HW_ADDR_TYPE_UNSET); } static gboolean