platform: don't zero terminate the result GArray of get_all() functions

Signed-off-by: Thomas Haller <thaller@redhat.com>
This commit is contained in:
Thomas Haller 2014-03-12 10:30:03 +01:00
parent 53b6a99798
commit 857e5e0b21
2 changed files with 7 additions and 7 deletions

View file

@ -1735,7 +1735,7 @@ static GArray *
link_get_all (NMPlatform *platform)
{
NMLinuxPlatformPrivate *priv = NM_LINUX_PLATFORM_GET_PRIVATE (platform);
GArray *links = g_array_sized_new (TRUE, TRUE, sizeof (NMPlatformLink), nl_cache_nitems (priv->link_cache));
GArray *links = g_array_sized_new (FALSE, FALSE, sizeof (NMPlatformLink), nl_cache_nitems (priv->link_cache));
NMPlatformLink device;
struct nl_object *object;
@ -2917,7 +2917,7 @@ ip4_address_get_all (NMPlatform *platform, int ifindex)
NMPlatformIP4Address address;
struct nl_object *object;
addresses = g_array_new (TRUE, FALSE, sizeof (NMPlatformIP4Address));
addresses = g_array_new (FALSE, FALSE, sizeof (NMPlatformIP4Address));
for (object = nl_cache_get_first (priv->address_cache); object; object = nl_cache_get_next (object)) {
if (_address_match ((struct rtnl_addr *) object, AF_INET, ifindex)) {
@ -2939,7 +2939,7 @@ ip6_address_get_all (NMPlatform *platform, int ifindex)
NMPlatformIP6Address address;
struct nl_object *object;
addresses = g_array_new (TRUE, FALSE, sizeof (NMPlatformIP6Address));
addresses = g_array_new (FALSE, FALSE, sizeof (NMPlatformIP6Address));
for (object = nl_cache_get_first (priv->address_cache); object; object = nl_cache_get_next (object)) {
if (_address_match ((struct rtnl_addr *) object, AF_INET6, ifindex)) {
@ -3145,7 +3145,7 @@ ip4_route_get_all (NMPlatform *platform, int ifindex, gboolean include_default)
NMPlatformIP4Route route;
struct nl_object *object;
routes = g_array_new (TRUE, FALSE, sizeof (NMPlatformIP4Route));
routes = g_array_new (FALSE, FALSE, sizeof (NMPlatformIP4Route));
for (object = nl_cache_get_first (priv->route_cache); object; object = nl_cache_get_next (object)) {
if (_route_match ((struct rtnl_route *) object, AF_INET, ifindex)) {
@ -3168,7 +3168,7 @@ ip6_route_get_all (NMPlatform *platform, int ifindex, gboolean include_default)
NMPlatformIP6Route route;
struct nl_object *object;
routes = g_array_new (TRUE, FALSE, sizeof (NMPlatformIP6Route));
routes = g_array_new (FALSE, FALSE, sizeof (NMPlatformIP6Route));
for (object = nl_cache_get_first (priv->route_cache); object; object = nl_cache_get_next (object)) {
if (_route_match ((struct rtnl_route *) object, AF_INET6, ifindex)) {

View file

@ -46,7 +46,7 @@ test_ip4_route ()
SignalData *route_changed = add_signal (NM_PLATFORM_IP4_ROUTE_CHANGED, ip4_route_callback);
SignalData *route_removed = add_signal (NM_PLATFORM_IP4_ROUTE_REMOVED, ip4_route_callback);
GArray *routes;
NMPlatformIP4Route rts[4];
NMPlatformIP4Route rts[3];
in_addr_t network;
int plen = 24;
in_addr_t gateway;
@ -129,7 +129,7 @@ test_ip6_route ()
SignalData *route_changed = add_signal (NM_PLATFORM_IP6_ROUTE_CHANGED, ip6_route_callback);
SignalData *route_removed = add_signal (NM_PLATFORM_IP6_ROUTE_REMOVED, ip6_route_callback);
GArray *routes;
NMPlatformIP6Route rts[4];
NMPlatformIP6Route rts[3];
struct in6_addr network;
int plen = 64;
struct in6_addr gateway;