diff mbox

[U-Boot,v2,01/15] kbuild: fixdep: optimize code slightly

Message ID 1438434891-8345-2-git-send-email-yamada.masahiro@socionext.com
State Superseded
Delegated to: Tom Rini
Headers show

Commit Message

Masahiro Yamada Aug. 1, 2015, 1:14 p.m. UTC
If the target string matches "CONFIG_", move the pointer p
forward.  This saves several 7-chars adjustments.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

Changes in v2: None

 scripts/basic/fixdep.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

Tom Rini Aug. 1, 2015, 2:47 p.m. UTC | #1
On Sat, Aug 01, 2015 at 10:14:31PM +0900, Masahiro Yamada wrote:

> If the target string matches "CONFIG_", move the pointer p
> forward.  This saves several 7-chars adjustments.
> 
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

Reviewed-by: Tom Rini <trini@konsulko.com>
Simon Glass Aug. 3, 2015, 2:06 p.m. UTC | #2
On 1 August 2015 at 07:14, Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:
> If the target string matches "CONFIG_", move the pointer p
> forward.  This saves several 7-chars adjustments.
>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> ---
>
> Changes in v2: None
>
>  scripts/basic/fixdep.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>
diff mbox

Patch

diff --git a/scripts/basic/fixdep.c b/scripts/basic/fixdep.c
index b304068..46cc1b3 100644
--- a/scripts/basic/fixdep.c
+++ b/scripts/basic/fixdep.c
@@ -251,7 +251,8 @@  static void parse_config_file(const char *map, size_t len)
 			continue;
 		if (memcmp(p, "CONFIG_", 7))
 			continue;
-		for (q = p + 7; q < map + len; q++) {
+		p += 7;
+		for (q = p; q < map + len; q++) {
 			if (!(isalnum(*q) || *q == '_'))
 				goto found;
 		}
@@ -260,9 +261,9 @@  static void parse_config_file(const char *map, size_t len)
 	found:
 		if (!memcmp(q - 7, "_MODULE", 7))
 			q -= 7;
-		if( (q-p-7) < 0 )
+		if (q - p < 0)
 			continue;
-		use_config(p+7, q-p-7);
+		use_config(p, q - p);
 	}
 }