[klibc] kinit minor checkpatch cleanup
Just various small coding style fixes.
Size shows that kinit didn't change as expected.
Signed-off-by: maximilian attems <max@stro.at>
diff --git a/usr/kinit/initrd.c b/usr/kinit/initrd.c
index 1c3ec56..d2efc59 100644
--- a/usr/kinit/initrd.c
+++ b/usr/kinit/initrd.c
@@ -122,7 +122,8 @@
_exit(255);
} else if (pid > 0) {
dprintf("kinit: Waiting for linuxrc to complete...\n");
- while (waitpid(pid, NULL, 0) != pid) ;
+ while (waitpid(pid, NULL, 0) != pid)
+ ;
dprintf("kinit: linuxrc done\n");
} else {
return -errno;
diff --git a/usr/kinit/kinit.c b/usr/kinit/kinit.c
index 4a1f40b..a60c3be 100644
--- a/usr/kinit/kinit.c
+++ b/usr/kinit/kinit.c
@@ -26,14 +26,12 @@
printf(" argc == %d\n", argc);
- for (i = 0; i < argc; i++) {
+ for (i = 0; i < argc; i++)
printf(" argv[%d]: \"%s\"\n", i, argv[i]);
- }
- if (argv[argc] != NULL) {
+ if (argv[argc] != NULL)
printf(" argv[%d]: \"%s\" (SHOULD BE NULL)\n",
argc, argv[argc]);
- }
}
#endif /* DEBUG */
@@ -125,9 +123,8 @@
{
struct stat st;
- if (stat(check, &st) == 0) {
+ if (stat(check, &st) == 0)
return 0;
- }
mkdir(fsname, 0555);
@@ -220,9 +217,8 @@
dup2(fd, STDOUT_FILENO);
dup2(fd, STDERR_FILENO);
- if (fd > STDERR_FILENO) {
+ if (fd > STDERR_FILENO)
close(fd);
- }
}
mnt_procfs = mount_sys_fs("/proc/cmdline", "/proc", "proc") >= 0;
diff --git a/usr/kinit/kinit.h b/usr/kinit/kinit.h
index c2e67b7..71414b1 100644
--- a/usr/kinit/kinit.h
+++ b/usr/kinit/kinit.h
@@ -36,17 +36,17 @@
* "unnecessary" pointer comparison.
* From the Linux kernel.
*/
-#define min(x,y) ({ \
- typeof(x) _x = (x); \
- typeof(y) _y = (y); \
- (void) (&_x == &_y); \
- _x < _y ? _x : _y; })
+#define min(x, y) ({ \
+ typeof(x) _x = (x); \
+ typeof(y) _y = (y); \
+ (void) (&_x == &_y); \
+ _x < _y ? _x : _y; })
-#define max(x,y) ({ \
- typeof(x) _x = (x); \
- typeof(y) _y = (y); \
- (void) (&_x == &_y); \
- _x > _y ? _x : _y; })
+#define max(x, y) ({ \
+ typeof(x) _x = (x); \
+ typeof(y) _y = (y); \
+ (void) (&_x == &_y); \
+ _x > _y ? _x : _y; })
#ifdef DEBUG
diff --git a/usr/kinit/name_to_dev.c b/usr/kinit/name_to_dev.c
index d491285..d8c1736 100644
--- a/usr/kinit/name_to_dev.c
+++ b/usr/kinit/name_to_dev.c
@@ -69,7 +69,7 @@
return res + part;
}
- fail:
+fail:
return (dev_t) 0;
}
@@ -122,8 +122,8 @@
return st.st_rdev;
if (strncmp(name, "/dev/", 5)) {
- if ((cptr = strchr(devname+5, ':')) &&
- cptr[1] != '\0') {
+ cptr = strchr(devname+5, ':');
+ if (cptr && cptr[1] != '\0') {
/* Colon-separated decimal device number */
*cptr = '\0';
major_num = strtoul(devname+5, &e1, 10);
diff --git a/usr/kinit/nfsroot.c b/usr/kinit/nfsroot.c
index b5ab3bb..3b80773 100644
--- a/usr/kinit/nfsroot.c
+++ b/usr/kinit/nfsroot.c
@@ -56,9 +56,8 @@
dev_bootpath = dev->bootpath;
break;
}
- if (dev->ip_addr != INADDR_NONE && dev->ip_addr != INADDR_ANY) {
+ if (dev->ip_addr != INADDR_NONE && dev->ip_addr != INADDR_ANY)
client = dev->ip_addr;
- }
}
/*
@@ -107,6 +106,6 @@
goto done;
}
- done:
+done:
return ret;
}