From 83ac84cd7a81db4ee676093373f368952b421cf3 Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Fri, 9 Oct 2015 14:51:09 +0200 Subject: [PATCH] libnm: document that some return values are immutable Document that the GPtrArray returned by - nm_device_get_lldp_neighbors() - nm_ip_config_get_addresses() - nm_ip_config_get_routes() is immutable and can be used by callers without the need of a copy. --- libnm/nm-device.c | 3 ++- libnm/nm-ip-config.c | 7 +++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/libnm/nm-device.c b/libnm/nm-device.c index 1d0e30eae..bb4231ec5 100644 --- a/libnm/nm-device.c +++ b/libnm/nm-device.c @@ -2075,7 +2075,8 @@ NM_BACKPORT_SYMBOL (libnm_1_0_6, NMMetered, nm_device_get_metered, (NMDevice *de * * Returns: (element-type NMLldpNeighbor) (transfer none): the #GPtrArray * containing #NMLldpNeighbors. This is the internal copy used by the - * device and must not be modified. + * device and must not be modified. The library never modifies the returned + * array and thus it is safe for callers to reference and keep using it. * * Since: 1.2 **/ diff --git a/libnm/nm-ip-config.c b/libnm/nm-ip-config.c index d057903e2..fc4567c42 100644 --- a/libnm/nm-ip-config.c +++ b/libnm/nm-ip-config.c @@ -406,7 +406,8 @@ nm_ip_config_get_gateway (NMIPConfig *config) * * Returns: (element-type NMIPAddress) (transfer none): the #GPtrArray * containing #NMIPAddresses. This is the internal copy used by the - * configuration and must not be modified. + * configuration and must not be modified. The library never modifies the + * returned array and thus it is safe for callers to reference and keep using it. **/ GPtrArray * nm_ip_config_get_addresses (NMIPConfig *config) @@ -491,7 +492,9 @@ nm_ip_config_get_wins_servers (NMIPConfig *config) * * Returns: (element-type NMIPRoute) (transfer none): the #GPtrArray containing * #NMIPRoutes. This is the internal copy used by the configuration, and must - * not be modified. + * not be modified. The library never modifies the returned array and thus it is + * safe for callers to reference and keep using it. + * **/ GPtrArray * nm_ip_config_get_routes (NMIPConfig *config)