public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [patch 2/2] drivers/chat/vt.c: remove unnecessary code
@ 2005-02-28 15:16 colbuse
  0 siblings, 0 replies; 3+ messages in thread
From: colbuse @ 2005-02-28 15:16 UTC (permalink / raw)
  To: linux-kernel



>On Mon, Feb 28, 2005 at 01:55:28PM +0100, colbuse@xxxxxxxxxxxxxxx wrote:
>
>> Avoid changing the state of the console two times in some cases.
>
>A bad change for several reasons.
>
>(i) more object code is generated
>(ii) the code is slower
>(iii) you change something
>
>Straight line code is cheap, jumps are expensive.
>Replacing an assignment by a jump is not an improvement.


I didn't thought to that point... 

You're right, this patch was a bad idea :(.

Sorry about this error...

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

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


^ permalink raw reply	[flat|nested] 3+ messages in thread
* [patch 2/2] drivers/chat/vt.c: remove unnecessary code
@ 2005-02-28 12:55 colbuse
  2005-02-28 14:45 ` Andries Brouwer
  0 siblings, 1 reply; 3+ messages in thread
From: colbuse @ 2005-02-28 12:55 UTC (permalink / raw)
  To: linux-kernel; +Cc: akpm


Avoid changing the state of the console two times in some cases.


Signed-off-by: Emmanuel Colbus <emmanuel.colbus@ensimag.imag.fr>


--- old/drivers/char/vt.c       2004-12-24 22:35:25.000000000 +0100
+++ new/drivers/char/vt.c       2005-02-28 12:56:46.154311486 +0100
@@ -1571,7 +1571,6 @@
        }
        switch(vc_state) {
        case ESesc:
-               vc_state = ESnormal;
                switch (c) {
                case '[':
                        vc_state = ESsquare;
@@ -1585,25 +1584,25 @@
                case 'E':
                        cr(currcons);
                        lf(currcons);
-                       return;
+                       break;
                case 'M':
                        ri(currcons);
-                       return;
+                       break;
                case 'D':
                        lf(currcons);
-                       return;
+                       break;
                case 'H':
                        tab_stop[x >> 5] |= (1 << (x & 31));
-                       return;
+                       break;
                case 'Z':
                        respond_ID(tty);
-                       return;
+                       break;
                case '7':
                        save_cur(currcons);
-                       return;
+                       break;
                case '8':
                        restore_cur(currcons);
-                       return;
+                       break;
                case '(':
                        vc_state = ESsetG0;
                        return;
@@ -1615,14 +1614,15 @@
                        return;
                case 'c':
                        reset_terminal(currcons,1);
-                       return;
+                       break;
                case '>':  /* Numeric keypad */
                        clr_kbd(kbdapplic);
-                       return;
+                       break;
                case '=':  /* Appl. keypad */
                        set_kbd(kbdapplic);
-                       return;
+                       /* Here, we don't need any break; */
                }
+               vc_state = ESnormal;
                return;
        case ESnonstd:
                if (c=='P') {   /* palette escape sequence */



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


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


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

end of thread, other threads:[~2005-02-28 15:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-02-28 15:16 [patch 2/2] drivers/chat/vt.c: remove unnecessary code colbuse
  -- strict thread matches above, loose matches on Subject: below --
2005-02-28 12:55 colbuse
2005-02-28 14:45 ` Andries Brouwer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox