All of lore.kernel.org
 help / color / mirror / Atom feed
From: colbuse@ensisun.imag.fr
To: linux-kernel@vger.kernel.org, arjan@infradead.org
Subject: Re: [patch 3/2] drivers/char/vt.c: remove unnecessary code
Date: Mon, 28 Feb 2005 16:06:14 +0100	[thread overview]
Message-ID: <1109603174.42233366e4fed@webmail.imag.fr> (raw)




>> - for(npar = 0 ; npar < NPAR ; npar++)
>> + for(npar = NPAR - 1; npar >= 0; npar--)
>> par[npar] = 0;

>if you really want to clean this up.. 

Well, actually, I was not myself entirely convinced about it... This is the
reason for I wrote "please _don't_ apply this, but tell me what you think about
it.".

>why not use memset() instead ?

Because I simply didn't thought to it :-) .

Hey, that makes fully sense! So far I know, memset() is quicker than 
(or as quick as) a loop, and it remains fully readable (in my opinion :).

Well, such a patch would be : 

--- drivers/char/vt.c   2004-12-24 22:35:25.000000000 +0100
+++ drivers/char/vt2.c  2005-02-28 15:55:11.782717810 +0100
@@ -1655,8 +1655,8 @@
                        vc_state = ESnormal;
                return;
        case ESsquare:
-               for(npar = 0 ; npar < NPAR ; npar++)
-                       par[npar] = 0;
+               /* Setting par[]'s elems at 0.  */
+               memset(par, 0, NPAR*sizeof(unsigned int));
                npar = 0;
                vc_state = ESgetpars;
                if (c == '[') { /* Function key */


Thank you for the suggestion.
What do you think of this one?

(Please note that I'm not trying to get a patch for it _by force_ into the
kernel. If it's a bad idea, let's let thing like they currently are, 
the current loop just works.)

cu

--
Emmanuel Colbus
Club GNU/Linux
ENSIMAG - Departement telecoms

-------------------------------------------------
envoyé via Webmail/IMAG !


             reply	other threads:[~2005-02-28 15:06 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-28 15:06 colbuse [this message]
2005-02-28 16:44 ` [patch 3/2] drivers/char/vt.c: remove unnecessary code Stelian Pop
2005-02-28 17:29   ` emmanuel.colbus@ensimag.imag.fr
2005-02-28 19:18     ` Stelian Pop
2005-02-28 20:30     ` Adrian Bunk
  -- strict thread matches above, loose matches on Subject: below --
2005-02-28 13:13 colbuse
2005-02-28 13:28 ` Russell King
2005-02-28 14:01   ` colbuse
2005-02-28 14:22     ` Arjan van de Ven
2005-02-28 14:43     ` Martin Mares
2005-02-28 14:57     ` Horst von Brand
2005-02-28 13:32 ` Adrian Bunk
2005-02-28 13:48 ` Dmitry Torokhov
2005-02-28 14:02   ` Arjan van de Ven
2005-02-28 14:06     ` Dmitry Torokhov
2005-02-28 12:57 colbuse
2005-02-28 13:02 ` Russell King
2005-02-28 13:33 ` linux-os

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=1109603174.42233366e4fed@webmail.imag.fr \
    --to=colbuse@ensisun.imag.fr \
    --cc=arjan@infradead.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 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.