X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fopenldap.c;h=282e2dc7d1f128d6097695c8230945c52ebbeab5;hb=f0d468892e1c173b226f739be48291981473b4fb;hp=3dac057eb4bd9bb64768ae36cff670191c1b1b43;hpb=3fae5596643f1e361eb18c3d65448f8bc02fdd80;p=collectd.git diff --git a/src/openldap.c b/src/openldap.c index 3dac057e..282e2dc7 100644 --- a/src/openldap.c +++ b/src/openldap.c @@ -27,6 +27,7 @@ **/ #include "collectd.h" + #include "common.h" #include "plugin.h" #include "configfile.h" @@ -208,7 +209,7 @@ static void cldap_submit_gauge (const char *type, const char *type_instance, /* static int cldap_read_host (user_data_t *ud) /* {{{ */ { cldap_t *st; - LDAPMessage *e, *result; + LDAPMessage *result; char *dn; int rc; int status; @@ -249,7 +250,7 @@ static int cldap_read_host (user_data_t *ud) /* {{{ */ return (-1); } - for (e = ldap_first_entry (st->ld, result); e != NULL; + for (LDAPMessage *e = ldap_first_entry (st->ld, result); e != NULL; e = ldap_next_entry (st->ld, e)) { if ((dn = ldap_get_dn (st->ld, e)) != NULL) @@ -558,7 +559,6 @@ static int cldap_read_host (user_data_t *ud) /* {{{ */ static int cldap_config_add (oconfig_item_t *ci) /* {{{ */ { cldap_t *st; - int i; int status; st = calloc (1, sizeof (*st)); @@ -580,7 +580,7 @@ static int cldap_config_add (oconfig_item_t *ci) /* {{{ */ st->verifyhost = 1; st->version = LDAP_VERSION3; - for (i = 0; i < ci->children_num; i++) + for (int i = 0; i < ci->children_num; i++) { oconfig_item_t *child = ci->children + i; @@ -686,10 +686,9 @@ static int cldap_config_add (oconfig_item_t *ci) /* {{{ */ static int cldap_config (oconfig_item_t *ci) /* {{{ */ { - int i; int status = 0; - for (i = 0; i < ci->children_num; i++) + for (int i = 0; i < ci->children_num; i++) { oconfig_item_t *child = ci->children + i; @@ -719,9 +718,7 @@ static int cldap_init (void) /* {{{ */ static int cldap_shutdown (void) /* {{{ */ { - size_t i; - - for (i = 0; i < databases_num; i++) + for (size_t i = 0; i < databases_num; i++) if (databases[i]->ld != NULL) ldap_unbind_ext_s (databases[i]->ld, NULL, NULL); sfree (databases);