Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1400069

[PATCH 5/9] docproc: reduce unnecessary indentation

From Jani Nikula <jani.nikula@intel.com>
Newsgroups linux.kernel
Subject [PATCH 5/9] docproc: reduce unnecessary indentation
Date 2016-05-12 15:20 +0200
Message-ID <rxYH0-6wa-25@gated-at.bofh.it> (permalink)
References <rxYH0-6wa-19@gated-at.bofh.it>
Organization Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo

Show all headers | View raw


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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/9] kernel-doc/docproc prep work for reStructuredText Jani Nikula <jani.nikula@intel.com> - 2016-05-12 15:20 +0200
  [PATCH 5/9] docproc: reduce unnecessary indentation Jani Nikula <jani.nikula@intel.com> - 2016-05-12 15:20 +0200
  [PATCH 2/9] kernel-doc: produce RestructuredText output Jani Nikula <jani.nikula@intel.com> - 2016-05-12 15:20 +0200
  [PATCH 4/9] docproc: add variables for subcommand and filename Jani Nikula <jani.nikula@intel.com> - 2016-05-12 15:20 +0200
  [PATCH 9/9] docproc: print a comment about autogeneration for rst output Jani Nikula <jani.nikula@intel.com> - 2016-05-12 15:20 +0200
  [PATCH 3/9] kernel-doc: use rst C domain directives and references for types Jani Nikula <jani.nikula@intel.com> - 2016-05-12 15:20 +0200
  [PATCH 7/9] docproc: abstract terminating lines at first space Jani Nikula <jani.nikula@intel.com> - 2016-05-12 15:20 +0200
  [PATCH 6/9] docproc: abstract docproc directive detection Jani Nikula <jani.nikula@intel.com> - 2016-05-12 15:20 +0200
  [PATCH 1/9] kernel-doc: rewrite usage description, remove duplicated comments Jani Nikula <jani.nikula@intel.com> - 2016-05-12 15:20 +0200
  Re: [PATCH 0/9] kernel-doc/docproc prep work for reStructuredText Jonathan Corbet <corbet@lwn.net> - 2016-05-14 18:10 +0200

csiph-web