public inbox for linux-kbuild@vger.kernel.org
 help / color / mirror / Atom feed
From: "Leonardo Brás" <leobras.c@gmail.com>
To: lkcamp@lists.libreplanetbr.org
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>,
	Michal Marek <michal.lkml@markovi.net>,
	linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 1/1] Changes style to look more like list iteration.
Date: Mon, 22 Oct 2018 22:20:31 -0300	[thread overview]
Message-ID: <20181023012031.GA6920@WindFlash> (raw)

Changes the code in order to make it looks more like its a list iteration.

Signed-off-by: Leonardo Brás <leobras.c@gmail.com>
---

It's a remainer from a patch from the -Wshadow patchset.
Since it doesn't really belongs to that patchset anymore, 
I decided to release it just as a code refactor for
file2alias.c

I fixed it after Koike's suggestion (&&!dup added)

IMHO it reads better this way, and no drastic change has been made.

Thanks.

---
 scripts/mod/file2alias.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index 3015c0bdecb2..b957279c4117 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -650,26 +650,26 @@ static void do_pnp_card_entries(void *symval, unsigned long size,
 
 	device_id_check(mod->name, "pnp", size, id_size, symval);
 	DEF_FIELD_ADDR(symval, pnp_card_device_id, devs);
-	typeof(devs) devs_last;
+	DEF_FIELD_ADDR_VAR(symval, pnp_card_device_id, devs, devs_aux);
 
 	for (i = 0; i < count; i++) {
 		unsigned int j;
-		devs_last = devs + i * id_size;
+		devs_aux = devs + i * id_size;
 
 		for (j = 0; j < PNP_MAX_DEVICES; j++) {
-			const char *id = (char *)(*devs_last)[j].id;
+			const char *id = (char *)(*devs_aux)[j].id;
 			int j2;
 			int dup = 0;
 
 			if (!id[0])
 				break;
 
-			/* find duplicate, already added value */
-			while ((devs_last -= id_size) >= devs && !dup) {
+			/* find duplicate on previous devs*/
+			while ((devs_aux -= id_size) >= devs && !dup) {
 
 				for (j2 = 0; j2 < PNP_MAX_DEVICES; j2++) {
 					const char *id2 =
-						(char *)(*devs_last)[j2].id;
+						(char *)(*devs_aux)[j2].id;
 
 					if (!id2[0])
 						break;
-- 
2.19.1

                 reply	other threads:[~2018-10-23  9:41 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20181023012031.GA6920@WindFlash \
    --to=leobras.c@gmail.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkcamp@lists.libreplanetbr.org \
    --cc=michal.lkml@markovi.net \
    --cc=yamada.masahiro@socionext.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox