X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Futils_mount.c;h=b8dabb1703ae109d4d3eef20738ea41d8b19eb79;hb=13009ee6db333a1dc538c09fc5aafb2446db9b39;hp=a2e96a65e43dca1aca8272fa7f33c1ab6d42a163;hpb=4103105fb43cd72294f165b2541540b3a8a99532;p=collectd.git diff --git a/src/utils_mount.c b/src/utils_mount.c index a2e96a65..b8dabb17 100644 --- a/src/utils_mount.c +++ b/src/utils_mount.c @@ -216,7 +216,6 @@ uuidcache_init(void) FILE *procpt; char uuid[16], *label = NULL; char device[110]; - int firstPass; int handleOnFirst; if(uuidCache) { @@ -228,7 +227,7 @@ uuidcache_init(void) return; } - for(firstPass = 1; firstPass >= 0; firstPass--) { + for(int firstPass = 1; firstPass >= 0; firstPass--) { fseek(procpt, 0, SEEK_SET); while(fgets(line, sizeof(line), procpt)) { if(sscanf(line, " %d %d %d %[^\n ]", @@ -318,14 +317,13 @@ static char * get_spec_by_uuid(const char *s) { char uuid[16]; - int i; if(strlen(s) != 36 || s[8] != '-' || s[13] != '-' || s[18] != '-' || s[23] != '-') { goto bad_uuid; } - for(i=0; i<16; i++) { + for(int i=0; i<16; i++) { if(*s == '-') { s++; } @@ -382,7 +380,6 @@ static char *get_device_name(const char *optstr) static cu_mount_t *cu_mount_listmntent (void) { cu_mount_t *last = *list; - struct tabmntent *p; struct mntent *mnt; struct tabmntent *mntlist; @@ -394,7 +391,7 @@ static cu_mount_t *cu_mount_listmntent (void) #endif /* COLLECT_DEBUG */ } - for(p = mntlist; p; p = p->next) { + for(struct tabmntent *p = mntlist; p; p = p->next) { char *loop = NULL, *device = NULL; mnt = p->ment; @@ -451,7 +448,6 @@ static cu_mount_t *cu_mount_getfsstat (void) STRUCT_STATFS *buf; int num; - int i; cu_mount_t *first = NULL; cu_mount_t *last = NULL; @@ -484,7 +480,7 @@ static cu_mount_t *cu_mount_getfsstat (void) return (NULL); } - for (i = 0; i < num; i++) + for (int i = 0; i < num; i++) { if ((new = calloc (1, sizeof (*new))) == NULL) break; @@ -741,10 +737,9 @@ cu_mount_t *cu_mount_getlist(cu_mount_t **list) void cu_mount_freelist (cu_mount_t *list) { - cu_mount_t *this; cu_mount_t *next; - for (this = list; this != NULL; this = next) + for (cu_mount_t *this = list; this != NULL; this = next) { next = this->next;