Re: [patch 3/2] drivers/char/vt.c: remove unnecessary code

colbuse
2005-02-28T15:06:39Z

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