mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@intel.com>
To: Jonathan Corbet <corbet@lwn.net>,
	linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org
Cc: jani.nikula@intel.com
Subject: [PATCH 5/9] docproc: reduce unnecessary indentation
Date: Thu, 12 May 2016 16:15:40 +0300	[thread overview]
Message-ID: <ce795dbddc83d8d4639c1ddc19bc5381c80f64c6.1463058396.git.jani.nikula@intel.com> (raw)
In-Reply-To: <cover.1463058396.git.jani.nikula@intel.com>
In-Reply-To: <cover.1463058396.git.jani.nikula@intel.com>

Improves clarity. No functional changes.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 scripts/docproc.c | 93 ++++++++++++++++++++++++++++---------------------------
 1 file changed, 47 insertions(+), 46 deletions(-)

diff --git a/scripts/docproc.c b/scripts/docproc.c
index 48abc01a920e..fb195f0ed0ef 100644
--- a/scripts/docproc.c
+++ b/scripts/docproc.c
@@ -445,52 +445,53 @@ static void parse_file(FILE *infile)
 	char line[MAXLINESZ];
 	char * s;
 	while (fgets(line, MAXLINESZ, infile)) {
-		if (line[0] == '!') {
-			s = line + 2;
-			switch (line[1]) {
-				case 'E':
-					while (*s && !isspace(*s)) s++;
-					*s = '\0';
-					externalfunctions(line+2);
-					break;
-				case 'I':
-					while (*s && !isspace(*s)) s++;
-					*s = '\0';
-					internalfunctions(line+2);
-					break;
-				case 'D':
-					while (*s && !isspace(*s)) s++;
-					*s = '\0';
-					symbolsonly(line+2);
-					break;
-				case 'F':
-					/* filename */
-					while (*s && !isspace(*s)) s++;
-					*s++ = '\0';
-					/* function names */
-					while (isspace(*s))
-						s++;
-					singlefunctions(line +2, s);
-					break;
-				case 'P':
-					/* filename */
-					while (*s && !isspace(*s)) s++;
-					*s++ = '\0';
-					/* DOC: section name */
-					while (isspace(*s))
-						s++;
-					docsection(line + 2, s);
-					break;
-				case 'C':
-					while (*s && !isspace(*s)) s++;
-					*s = '\0';
-					if (findall)
-						findall(line+2);
-					break;
-				default:
-					defaultline(line);
-			}
-		} else {
+		if (line[0] != '!') {
+			defaultline(line);
+			continue;
+		}
+
+		s = line + 2;
+		switch (line[1]) {
+		case 'E':
+			while (*s && !isspace(*s)) s++;
+			*s = '\0';
+			externalfunctions(line+2);
+			break;
+		case 'I':
+			while (*s && !isspace(*s)) s++;
+			*s = '\0';
+			internalfunctions(line+2);
+			break;
+		case 'D':
+			while (*s && !isspace(*s)) s++;
+			*s = '\0';
+			symbolsonly(line+2);
+			break;
+		case 'F':
+			/* filename */
+			while (*s && !isspace(*s)) s++;
+			*s++ = '\0';
+			/* function names */
+			while (isspace(*s))
+				s++;
+			singlefunctions(line +2, s);
+			break;
+		case 'P':
+			/* filename */
+			while (*s && !isspace(*s)) s++;
+			*s++ = '\0';
+			/* DOC: section name */
+			while (isspace(*s))
+				s++;
+			docsection(line + 2, s);
+			break;
+		case 'C':
+			while (*s && !isspace(*s)) s++;
+			*s = '\0';
+			if (findall)
+				findall(line+2);
+			break;
+		default:
 			defaultline(line);
 		}
 	}
-- 
2.1.4

  parent reply	other threads:[~2016-05-12 13:17 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-12 13:15 [PATCH 0/9] kernel-doc/docproc prep work for reStructuredText Jani Nikula
2016-05-12 13:15 ` [PATCH 1/9] kernel-doc: rewrite usage description, remove duplicated comments Jani Nikula
2016-05-12 13:15 ` [PATCH 2/9] kernel-doc: produce RestructuredText output Jani Nikula
2016-05-12 13:15 ` [PATCH 3/9] kernel-doc: use rst C domain directives and references for types Jani Nikula
2016-05-12 13:15 ` [PATCH 4/9] docproc: add variables for subcommand and filename Jani Nikula
2016-05-12 13:15 ` Jani Nikula [this message]
2016-05-12 13:15 ` [PATCH 6/9] docproc: abstract docproc directive detection Jani Nikula
2016-05-12 13:15 ` [PATCH 7/9] docproc: abstract terminating lines at first space Jani Nikula
2016-05-12 13:15 ` [PATCH 8/9] docproc: add support for reStructuredText format via --rst option Jani Nikula
2016-05-12 13:15 ` [PATCH 9/9] docproc: print a comment about autogeneration for rst output Jani Nikula
2016-05-14 16:01 ` [PATCH 0/9] kernel-doc/docproc prep work for reStructuredText Jonathan Corbet

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=ce795dbddc83d8d4639c1ddc19bc5381c80f64c6.1463058396.git.jani.nikula@intel.com \
    --to=jani.nikula@intel.com \
    --cc=corbet@lwn.net \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®