Messages in this thread Patch in this message |  | | From | Keith Owens <> | Subject | 2.1.21-patch_drivers_char-2 | Date | Thu, 16 Jan 1997 11:43:12 +1100 |
| |
On Wed, 15 Jan 1997 20:36:15 +0000 (GMT), alan@lxorguk.ukuu.org.uk (Alan Cox) wrote: >> Remove warnings about "might be used uninitialised". >> >> diff -ur linux-2.1.21.orig/drivers/char/vc_screen.c linux/drivers/char/vc_screen.c >> --- linux-2.1.21.orig/drivers/char/vc_screen.c Sat Dec 14 01:04:14 1996 >> +++ linux/drivers/char/vc_screen.c Wed Jan 15 13:49:11 1997 > >You've just slowed the console down for the sake of some erroneous gcc output. >Fix gcc not the source.
You want speed :), try this one. Fixes the warnings, skips unnecessary tests when count == 0 (FWIW), removes redundant test for count > 0 ((p & 1) && count > 0) -> (p&1), should be slightly faster. Cleans up the indentation to match the rest of the source. Works for me.
diff -ur linux-2.1.21/drivers/char/vc_screen.c linux/drivers/char/vc_screen.c --- linux-2.1.21/drivers/char/vc_screen.c Sat Dec 14 01:04:14 1996 +++ linux/drivers/char/vc_screen.c Thu Jan 16 11:29:57 1997 @@ -134,18 +134,18 @@ { count--; put_user(header[p++], buf++); } } if (count > 0) { - p -= HEADER_SIZE; - org = screen_pos(currcons, p/2, viewed); - if ((p & 1) && count > 0) - { count--; put_user(func_scr_readw(org++) >> 8, buf++); } - } - while (count > 1) { - put_user(func_scr_readw(org++), (unsigned short *) buf); - buf += 2; - count -= 2; + p -= HEADER_SIZE; + org = screen_pos(currcons, p/2, viewed); + if (p & 1) + { count--; put_user(func_scr_readw(org++) >> 8, buf++); } + while (count > 1) { + put_user(func_scr_readw(org++), (unsigned short *) buf); + buf += 2; + count -= 2; + } + if (count > 0) + put_user(func_scr_readw(org) & 0xff, buf++); } - if (count > 0) - put_user(func_scr_readw(org) & 0xff, buf++); } read = buf - buf0; file->f_pos += read; @@ -200,28 +200,28 @@ putconsxy(currcons, header+2); } if (count > 0) { - p -= HEADER_SIZE; + p -= HEADER_SIZE; org = screen_pos(currcons, p/2, viewed); - if ((p & 1) && count > 0) { - char c; + if (p & 1) { + char c; count--; get_user(c,buf++); func_scr_writew((c << 8) | (func_scr_readw(org) & 0xff), org); org++; } - } - while (count > 1) { - unsigned short w; - get_user(w, (const unsigned short *) buf); - func_scr_writew(w, org++); - buf += 2; - count -= 2; - } - if (count > 0) { - unsigned char c; - get_user(c, (const unsigned char*)buf++); - func_scr_writew((func_scr_readw(org) & 0xff00) | c, org); + while (count > 1) { + unsigned short w; + get_user(w, (const unsigned short *) buf); + func_scr_writew(w, org++); + buf += 2; + count -= 2; + } + if (count > 0) { + unsigned char c; + get_user(c, (const unsigned char*)buf++); + func_scr_writew((func_scr_readw(org) & 0xff00) | c, org); + } } } written = buf - buf0;
|  |