mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-24 21:50:17 +01:00
ip[46]-config: reorder fields in private struct and use bool bitfield
bool:1 bitfields allow for tighter packing and are guaranteed to be strictly 0 or 1 (contrary to gboolean's typedef for int). Not that it matters too much, but it's favorable. Especially, because each device has several of these ip-config instances, we might save a few bytes for no(?) downsides.
This commit is contained in:
parent
0bb1e9a116
commit
2802e823fc
2 changed files with 18 additions and 18 deletions
|
|
@ -59,25 +59,25 @@ NM_GOBJECT_PROPERTIES_DEFINE (NMIP4Config,
|
|||
);
|
||||
|
||||
typedef struct {
|
||||
gboolean never_default;
|
||||
bool never_default:1;
|
||||
bool metered:1;
|
||||
bool has_gateway:1;
|
||||
guint32 gateway;
|
||||
gboolean has_gateway;
|
||||
guint32 mss;
|
||||
guint32 mtu;
|
||||
int ifindex;
|
||||
NMIPConfigSource mtu_source;
|
||||
gint dns_priority;
|
||||
gint64 route_metric;
|
||||
GArray *addresses;
|
||||
GArray *routes;
|
||||
GArray *nameservers;
|
||||
GPtrArray *domains;
|
||||
GPtrArray *searches;
|
||||
GPtrArray *dns_options;
|
||||
guint32 mss;
|
||||
GArray *nis;
|
||||
char *nis_domain;
|
||||
GArray *wins;
|
||||
guint32 mtu;
|
||||
NMIPConfigSource mtu_source;
|
||||
int ifindex;
|
||||
gint64 route_metric;
|
||||
gboolean metered;
|
||||
gint dns_priority;
|
||||
GVariant *address_data_variant;
|
||||
GVariant *addresses_variant;
|
||||
} NMIP4ConfigPrivate;
|
||||
|
|
@ -1382,7 +1382,7 @@ nm_ip4_config_set_never_default (NMIP4Config *config, gboolean never_default)
|
|||
{
|
||||
NMIP4ConfigPrivate *priv = NM_IP4_CONFIG_GET_PRIVATE (config);
|
||||
|
||||
priv->never_default = !!never_default;
|
||||
priv->never_default = never_default;
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
|
@ -2110,7 +2110,7 @@ nm_ip4_config_set_metered (NMIP4Config *config, gboolean metered)
|
|||
{
|
||||
NMIP4ConfigPrivate *priv = NM_IP4_CONFIG_GET_PRIVATE (config);
|
||||
|
||||
priv->metered = !!metered;
|
||||
priv->metered = metered;
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
|
|
|||
|
|
@ -38,7 +38,12 @@
|
|||
/*****************************************************************************/
|
||||
|
||||
typedef struct {
|
||||
gboolean never_default;
|
||||
bool never_default:1;
|
||||
guint32 mss;
|
||||
int ifindex;
|
||||
int dns_priority;
|
||||
NMSettingIP6ConfigPrivacy privacy;
|
||||
gint64 route_metric;
|
||||
struct in6_addr gateway;
|
||||
GArray *addresses;
|
||||
GArray *routes;
|
||||
|
|
@ -46,13 +51,8 @@ typedef struct {
|
|||
GPtrArray *domains;
|
||||
GPtrArray *searches;
|
||||
GPtrArray *dns_options;
|
||||
guint32 mss;
|
||||
int ifindex;
|
||||
gint64 route_metric;
|
||||
gint dns_priority;
|
||||
GVariant *address_data_variant;
|
||||
GVariant *addresses_variant;
|
||||
NMSettingIP6ConfigPrivacy privacy;
|
||||
} NMIP6ConfigPrivate;
|
||||
|
||||
struct _NMIP6Config {
|
||||
|
|
@ -1239,7 +1239,7 @@ nm_ip6_config_set_never_default (NMIP6Config *config, gboolean never_default)
|
|||
{
|
||||
NMIP6ConfigPrivate *priv = NM_IP6_CONFIG_GET_PRIVATE (config);
|
||||
|
||||
priv->never_default = !!never_default;
|
||||
priv->never_default = never_default;
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue