All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] kbuild: Minor cleanups of fixdep
@ 2015-07-24  5:18 Masahiro Yamada
  2015-07-24  5:18 ` [PATCH 1/2] kbuild: fixdep: optimize code slightly Masahiro Yamada
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Masahiro Yamada @ 2015-07-24  5:18 UTC (permalink / raw)
  To: linux-kbuild; +Cc: Masahiro Yamada, Michal Marek, linux-kernel




Masahiro Yamada (2):
  kbuild: fixdep: optimize code slightly
  kbuild: fixdep: drop meaningless hash table initialization

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

-- 
1.9.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] kbuild: fixdep: optimize code slightly
  2015-07-24  5:18 [PATCH 0/2] kbuild: Minor cleanups of fixdep Masahiro Yamada
@ 2015-07-24  5:18 ` Masahiro Yamada
  2015-07-24  5:18 ` [PATCH 2/2] kbuild: fixdep: drop meaningless hash table initialization Masahiro Yamada
  2015-08-24 14:46 ` [PATCH 0/2] kbuild: Minor cleanups of fixdep Michal Marek
  2 siblings, 0 replies; 4+ messages in thread
From: Masahiro Yamada @ 2015-07-24  5:18 UTC (permalink / raw)
  To: linux-kbuild; +Cc: Masahiro Yamada, Michal Marek, linux-kernel

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>
---

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

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);
 	}
 }
 
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] kbuild: fixdep: drop meaningless hash table initialization
  2015-07-24  5:18 [PATCH 0/2] kbuild: Minor cleanups of fixdep Masahiro Yamada
  2015-07-24  5:18 ` [PATCH 1/2] kbuild: fixdep: optimize code slightly Masahiro Yamada
@ 2015-07-24  5:18 ` Masahiro Yamada
  2015-08-24 14:46 ` [PATCH 0/2] kbuild: Minor cleanups of fixdep Michal Marek
  2 siblings, 0 replies; 4+ messages in thread
From: Masahiro Yamada @ 2015-07-24  5:18 UTC (permalink / raw)
  To: linux-kbuild; +Cc: Masahiro Yamada, Michal Marek, linux-kernel

The clear_config() is called just once at the beginning of this
program, but the global variable hashtab[] is already zero-filled
at the start-up.

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

 scripts/basic/fixdep.c | 19 -------------------
 1 file changed, 19 deletions(-)

diff --git a/scripts/basic/fixdep.c b/scripts/basic/fixdep.c
index 46cc1b3..c68fd61 100644
--- a/scripts/basic/fixdep.c
+++ b/scripts/basic/fixdep.c
@@ -192,23 +192,6 @@ static void define_config(const char *name, int len, unsigned int hash)
 }
 
 /*
- * Clear the set of configuration strings.
- */
-static void clear_config(void)
-{
-	struct item *aux, *next;
-	unsigned int i;
-
-	for (i = 0; i < HASHSZ; i++) {
-		for (aux = hashtab[i]; aux; aux = next) {
-			next = aux->next;
-			free(aux);
-		}
-		hashtab[i] = NULL;
-	}
-}
-
-/*
  * Record the use of a CONFIG_* word.
  */
 static void use_config(const char *m, int slen)
@@ -325,8 +308,6 @@ static void parse_dep_file(void *map, size_t len)
 	int saw_any_target = 0;
 	int is_first_dep = 0;
 
-	clear_config();
-
 	while (m < end) {
 		/* Skip any "white space" */
 		while (m < end && (*m == ' ' || *m == '\\' || *m == '\n'))
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/2] kbuild: Minor cleanups of fixdep
  2015-07-24  5:18 [PATCH 0/2] kbuild: Minor cleanups of fixdep Masahiro Yamada
  2015-07-24  5:18 ` [PATCH 1/2] kbuild: fixdep: optimize code slightly Masahiro Yamada
  2015-07-24  5:18 ` [PATCH 2/2] kbuild: fixdep: drop meaningless hash table initialization Masahiro Yamada
@ 2015-08-24 14:46 ` Michal Marek
  2 siblings, 0 replies; 4+ messages in thread
From: Michal Marek @ 2015-08-24 14:46 UTC (permalink / raw)
  To: Masahiro Yamada, linux-kbuild; +Cc: linux-kernel

On 2015-07-24 07:18, Masahiro Yamada wrote:
> Masahiro Yamada (2):
>   kbuild: fixdep: optimize code slightly
>   kbuild: fixdep: drop meaningless hash table initialization
> 
>  scripts/basic/fixdep.c | 26 ++++----------------------
>  1 file changed, 4 insertions(+), 22 deletions(-)

Applied to kbuild.git#kbuild.

Michal


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-08-24 14:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-24  5:18 [PATCH 0/2] kbuild: Minor cleanups of fixdep Masahiro Yamada
2015-07-24  5:18 ` [PATCH 1/2] kbuild: fixdep: optimize code slightly Masahiro Yamada
2015-07-24  5:18 ` [PATCH 2/2] kbuild: fixdep: drop meaningless hash table initialization Masahiro Yamada
2015-08-24 14:46 ` [PATCH 0/2] kbuild: Minor cleanups of fixdep Michal Marek

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.