From 43a6974cb35759d4772f610f3c92b0d31f0503ac Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 24 Jan 2012 15:13:32 +0000 Subject: daemon: blkid: Whitespace changes, and use size_t for i instead of pointer. This is just a code clean-up with no functional change. --- daemon/blkid.c | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) (limited to 'daemon/blkid.c') diff --git a/daemon/blkid.c b/daemon/blkid.c index 3126f85e..ada2d7b0 100644 --- a/daemon/blkid.c +++ b/daemon/blkid.c @@ -129,23 +129,24 @@ test_blkid_p_i_opt (void) static char ** blkid_with_p_i_opt (const char *device) { + size_t i; int r; char *out = NULL, *err = NULL; char **lines = NULL; char **ret = NULL; int size = 0, alloc = 0; - r = command(&out, &err, "blkid", "-c", "/dev/null", + r = command (&out, &err, "blkid", "-c", "/dev/null", "-p", "-i", "-o", "export", device, NULL); if (r == -1) { - reply_with_error("%s", err); + reply_with_error ("%s", err); goto error; } /* Split the command output into lines */ - lines = split_lines(out); + lines = split_lines (out); if (lines == NULL) { - reply_with_perror("malloc"); + reply_with_perror ("malloc"); goto error; } @@ -164,38 +165,40 @@ blkid_with_p_i_opt (const char *device) * PART_ENTRY_SIZE=104857600 * PART_ENTRY_DISK=8:0 */ - for (char **i = lines; *i != NULL; i++) { - char *line = *i; + for (i = 0; lines[i] != NULL; ++i) { + char *line = lines[i]; /* Skip blank lines (shouldn't happen) */ if (line[0] == '\0') continue; /* Split the line in 2 at the equals sign */ - char *eq = strchr(line, '='); + char *eq = strchr (line, '='); if (eq) { *eq = '\0'; eq++; /* Add the key/value pair to the output */ - if (add_string(&ret, &size, &alloc, line) == -1 || - add_string(&ret, &size, &alloc, eq) == -1) goto error; + if (add_string (&ret, &size, &alloc, line) == -1 || + add_string (&ret, &size, &alloc, eq) == -1) goto error; } else { - fprintf(stderr, "blkid: unexpected blkid output ignored: %s", line); + fprintf (stderr, "blkid: unexpected blkid output ignored: %s", line); } } - if (add_string(&ret, &size, &alloc, NULL) == -1) goto error; + if (add_string (&ret, &size, &alloc, NULL) == -1) goto error; - free(out); - free(err); - free(lines); + free (out); + free (err); + free (lines); return ret; error: - free(out); - free(err); - if (lines) free(lines); - if (ret) free_strings(ret); + free (out); + free (err); + if (lines) + free (lines); + if (ret) + free_strings (ret); return NULL; } -- cgit