[klibc] [PATCH 5/5] tests: checkpatch fixlets

maximilian attems max at stro.at
Thu Jul 7 06:24:03 PDT 2011


fix:
WARNING: braces {} are not necessary for single statement blocks

ERROR: do not use assignment in if condition

WARNING: braces {} are not necessary for any arm of this statement

WARNING: static char array declaration should probably be static const char

Signed-off-by: maximilian attems <max at stro.at>
---
 usr/klibc/tests/environ.c    |    3 +--
 usr/klibc/tests/fcntl.c      |    3 ++-
 usr/klibc/tests/setjmptest.c |    5 ++---
 usr/klibc/tests/sigint.c     |    2 +-
 4 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/usr/klibc/tests/environ.c b/usr/klibc/tests/environ.c
index b5b082d..5253d51 100644
--- a/usr/klibc/tests/environ.c
+++ b/usr/klibc/tests/environ.c
@@ -12,9 +12,8 @@ int main(int argc, char *argv[], char *envp[])
 
 	/* Test argc/argv */
 	printf("argc = %d, argv = %p\n", argc, argv);
-	for (i = 0; i < argc; i++) {
+	for (i = 0; i < argc; i++)
 		printf("argv[%2d] = %s\n", i, argv[i]);
-	}
 
 	/* Test environ */
 	for (i = 0; envp[i]; i++)
diff --git a/usr/klibc/tests/fcntl.c b/usr/klibc/tests/fcntl.c
index 219423e..30cc900 100644
--- a/usr/klibc/tests/fcntl.c
+++ b/usr/klibc/tests/fcntl.c
@@ -23,7 +23,8 @@ int main(int argc, char *argv[])
 
 	/* Get the flags on this FD */
 
-	if ((flags = fcntl(fd, F_GETFL)) == -1) {
+	flags = fcntl(fd, F_GETFL);
+	if (flags == -1) {
 		perror("F_GETFL");
 		exit(1);
 	}
diff --git a/usr/klibc/tests/setjmptest.c b/usr/klibc/tests/setjmptest.c
index 30c4e16..fd9cb1c 100644
--- a/usr/klibc/tests/setjmptest.c
+++ b/usr/klibc/tests/setjmptest.c
@@ -15,11 +15,10 @@ void do_stuff(int v)
 
 void recurse(int ctr, int v)
 {
-	if (ctr--) {
+	if (ctr--)
 		recurse(ctr, v);
-	} else {
+	else
 		do_stuff(v);
-	}
 
 	printf("ERROR!\n");	/* We should never get here... */
 }
diff --git a/usr/klibc/tests/sigint.c b/usr/klibc/tests/sigint.c
index f11ae1f..ec62e33 100644
--- a/usr/klibc/tests/sigint.c
+++ b/usr/klibc/tests/sigint.c
@@ -7,7 +7,7 @@ static sig_atomic_t counter = 0;
 
 static void sig_handler(int signum)
 {
-	static char msg[] = "Signal handler\n";
+	static const char msg[] = "Signal handler\n";
 
 	(void)signum;
 
-- 
1.7.5.4



More information about the klibc mailing list