summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorDan Winship <danw@gnome.org>2014-08-25 10:33:53 -0400
committerDan Winship <danw@gnome.org>2014-09-04 09:21:05 -0400
commit3e5b3833aa4964f6d2224560f3ad8c7ffa1e8027 (patch)
tree411d50040fa8997bcd912e1f4eebd83c364a0e4a /examples
parent074c2093b6a733c3d5712a7c58386e1e652a8903 (diff)
downloadNetworkManager-3e5b3833aa4964f6d2224560f3ad8c7ffa1e8027.tar.gz
libnm: change empty-GPtrArray-return semantics
libnm functions that return GPtrArrays of objects had a rule that if the array was empty, they would return NULL rather than a 0-length array. As it turns out, this is just a nuisance to clients, since in most places the code for the non-empty case would end up doing the right thing for the empty case as well (and where it doesn't, we can check "array->len == 0" just as easily as "array == NULL"). So just return the 0-length array instead.
Diffstat (limited to 'examples')
-rw-r--r--examples/C/glib/get-ap-info-libnm.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/examples/C/glib/get-ap-info-libnm.c b/examples/C/glib/get-ap-info-libnm.c
index c5e9b5b238..044cec9c04 100644
--- a/examples/C/glib/get-ap-info-libnm.c
+++ b/examples/C/glib/get-ap-info-libnm.c
@@ -182,7 +182,7 @@ show_wifi_device_info (NMDevice *device)
aps = nm_device_wifi_get_access_points (NM_DEVICE_WIFI (device));
/* Print AP details */
- for (i = 0; aps && (i < aps->len); i++) {
+ for (i = 0; i < aps->len; i++) {
NMAccessPoint *ap = g_ptr_array_index (aps, i);
show_access_point_info (ap);
}
@@ -212,7 +212,7 @@ int main (int argc, char *argv[])
devices = nm_client_get_devices (client);
/* Go through the array and process Wi-Fi devices */
- for (i = 0; devices && (i < devices->len); i++) {
+ for (i = 0; i < devices->len; i++) {
NMDevice *device = g_ptr_array_index (devices, i);
if (NM_IS_DEVICE_WIFI (device))
show_wifi_device_info (device);