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

From: colbuse
Date: Mon Feb 28 2005 - 08:15:29 EST



>On Mon, Feb 28, 2005 at 01:57:59PM +0100, colbuse@xxxxxxxxxxxxxxx wrote:
>> Please _don't_ apply this, but tell me what you think about it.

>It's broken. 8)

>> --- old/drivers/char/vt.c 2004-12-24 22:35:25.000000000 +0100
>> +++ new/drivers/char/vt.c 2005-02-28 12:53:57.933256631 +0100
>> @@ -1655,9 +1655,9 @@
>> vc_state = ESnormal;
>> return;
>> case ESsquare:
>> - for(npar = 0 ; npar < NPAR ; npar++)
>> + for(npar = NPAR-1; npar < NPAR; npar--)

>How many times do you want this for loop to run?


NPAR times :-). As I stated, npar is unsigned.


See :
$cat x.c
#include <stdio.h>
#define NPAR 5

int main(void){
unsigned int i;
int j=0;
for(i=NPAR-1;i<NPAR;i--) j++;
fprintf(stdout,"it has runned %d times :-)\n",j);
}

$gcc x.c -o x && ./x
it has runned 5 times :-)
$

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

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

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/