nwrap: Use nwrap_vector_foreach instead of for loop
authorRobin Hack <hack.robin@gmail.com>
Thu, 8 Oct 2015 12:00:38 +0000 (14:00 +0200)
committerMichael Adam <obnox@samba.org>
Mon, 11 Jan 2016 11:25:28 +0000 (12:25 +0100)
Replace for loop by nwrap_vector_foreach in nwrap_lines_unload().

Signed-off-by: Robin Hack <hack.robin@gmail.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
lib/nss_wrapper/nss_wrapper.c

index 2759cd7a472c24fe4f92142e92d04448d7d120ae..393fa6ecb9e4e502ebea6a58cf2bfdb8c93f1280 100644 (file)
@@ -928,12 +928,13 @@ static void *_nwrap_load_lib_function(enum nwrap_lib lib, const char *fn_name)
 static void nwrap_lines_unload(struct nwrap_cache *const nwrap)
 {
        size_t p;
-       for (p = 0; p < nwrap->lines.count; p++) {
+       void *item;
+       nwrap_vector_foreach(item, nwrap->lines, p) {
                /* Maybe some vectors were merged ... */
-               SAFE_FREE(nwrap->lines.items[p]);
+               SAFE_FREE(item);
        }
        SAFE_FREE(nwrap->lines.items);
-       nwrap->lines.count = 0;
+       ZERO_STRUCTP(&nwrap->lines);
 }
 
 /*