All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Jones <drjones@redhat.com>
To: kvm@vger.kernel.org
Cc: rkrcmar@redhat.com, pbonzini@redhat.com, lvivier@redhat.com,
	thuth@redhat.com
Subject: [PATCH kvm-unit-tests 09/15] lib/argv: fix coding style
Date: Fri, 13 Jan 2017 19:15:27 +0100	[thread overview]
Message-ID: <20170113181533.15145-10-drjones@redhat.com> (raw)
In-Reply-To: <20170113181533.15145-1-drjones@redhat.com>

The next patch will double the amount of code in the file,
so let's fix its coding style first. No functional change.

Signed-off-by: Andrew Jones <drjones@redhat.com>
---
 lib/argv.c | 55 ++++++++++++++++++++++++++-----------------------------
 1 file changed, 26 insertions(+), 29 deletions(-)

diff --git a/lib/argv.c b/lib/argv.c
index 482ed004ee64..fe8826255c18 100644
--- a/lib/argv.c
+++ b/lib/argv.c
@@ -8,49 +8,46 @@ char *__args;
 static char args_copy[1000];
 static char *copy_ptr = args_copy;
 
-static bool isblank(char p)
-{
-    return p == ' ' || p == '\t';
-}
+#define isblank(c) ((c) == ' ' || (c) == '\t')
 
 static char *skip_blanks(char *p)
 {
-    while (isblank(*p))
-        ++p;
-    return p;
+	while (isblank(*p))
+		++p;
+	return p;
 }
 
 void __setup_args(void)
 {
-    char *args = __args;
-    char **argv = __argv + __argc;
-
-    while (*(args = skip_blanks(args)) != '\0') {
-        *argv++ = copy_ptr;
-        while (*args != '\0' && !isblank(*args))
-            *copy_ptr++ = *args++;
-        *copy_ptr++ = '\0';
-    }
-    __argc = argv - __argv;
+	char *args = __args;
+	char **argv = __argv + __argc;
+
+	while (*(args = skip_blanks(args)) != '\0') {
+		*argv++ = copy_ptr;
+		while (*args != '\0' && !isblank(*args))
+			*copy_ptr++ = *args++;
+		*copy_ptr++ = '\0';
+	}
+	__argc = argv - __argv;
 }
 
 void setup_args(char *args)
 {
-    if (!args)
-        return;
+	if (!args)
+		return;
 
-    __args = args;
-    __setup_args();
+	__args = args;
+	__setup_args();
 }
 
 void setup_args_progname(char *args)
 {
-    __argv[0] = copy_ptr;
-    strcpy(__argv[0], auxinfo.progname);
-    copy_ptr += strlen(auxinfo.progname) + 1;
-    ++__argc;
-    if (args) {
-        __args = args;
-        __setup_args();
-    }
+	__argv[0] = copy_ptr;
+	strcpy(__argv[0], auxinfo.progname);
+	copy_ptr += strlen(auxinfo.progname) + 1;
+	++__argc;
+	if (args) {
+		__args = args;
+		__setup_args();
+	}
 }
-- 
2.9.3


  parent reply	other threads:[~2017-01-13 18:15 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-13 18:15 [PATCH kvm-unit-tests 00/15] Introduce an errata framework Andrew Jones
2017-01-13 18:15 ` [PATCH kvm-unit-tests 01/15] devicetree: improve dt_get_bootargs interface Andrew Jones
2017-01-13 18:15 ` [PATCH kvm-unit-tests 02/15] devicetree: introduce dt_get_initrd Andrew Jones
2017-01-13 18:15 ` [PATCH kvm-unit-tests 03/15] arm/arm64: better document setup Andrew Jones
2017-01-13 18:15 ` [PATCH kvm-unit-tests 04/15] powerpc: " Andrew Jones
2017-01-13 18:15 ` [PATCH kvm-unit-tests 05/15] arm/arm64: import initrd Andrew Jones
2017-01-13 18:15 ` [PATCH kvm-unit-tests 06/15] powerpc: " Andrew Jones
2017-01-13 18:15 ` [PATCH kvm-unit-tests 07/15] x86_64: mbi-cmdline is a 4 byte addr Andrew Jones
2017-01-13 18:15 ` [PATCH kvm-unit-tests 08/15] x86: import initrd Andrew Jones
2017-01-13 18:15 ` Andrew Jones [this message]
2017-01-13 18:15 ` [PATCH kvm-unit-tests 10/15] lib/argv: introduce setup_env and getenv Andrew Jones
2017-01-13 18:15 ` [PATCH kvm-unit-tests 11/15] arm/arm64: enable environ Andrew Jones
2017-01-13 18:15 ` [PATCH kvm-unit-tests 12/15] powerpc: " Andrew Jones
2017-01-13 18:15 ` [PATCH kvm-unit-tests 13/15] x86: " Andrew Jones
2017-01-13 18:15 ` [PATCH kvm-unit-tests 14/15] README: reserve some environment variables Andrew Jones
2017-01-13 18:15 ` [PATCH kvm-unit-tests 15/15] Introduce lib/errata.h Andrew Jones
2017-03-03 14:40   ` Radim Krčmář

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170113181533.15145-10-drjones@redhat.com \
    --to=drjones@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=lvivier@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=rkrcmar@redhat.com \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.