[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 35/66] i386/i386at/kd.c: simplify code
From: |
Samuel Thibault |
Subject: |
Re: [PATCH 35/66] i386/i386at/kd.c: simplify code |
Date: |
Mon, 9 Dec 2013 00:08:46 +0900 |
User-agent: |
Mutt/1.5.21+34 (58baf7c9f32f) (2010-12-30) |
Marin Ramesa, le Thu 05 Dec 2013 22:03:29 +0100, a écrit :
> Variable char_byte_width is always zero. Use this to simplify
> the code.
Well, it should actually always be one. There is probably some other bug
to fix here.
> * i386/i386at/kd.c (char_byte_width): Remove variable.
> (j): Remove variable.
> (mask): Remove assignment.
> (from): Simplify assignment.
> Remove for loop.
> (j): Remove variable.
> Remove for loop.
> (byte): Remove variable.
> Remove for loop.
> * i386/i386at/kdsoft.h (char_byte_width): Remove variable declaration.
>
> ---
> i386/i386at/kd.c | 16 ++++------------
> i386/i386at/kdsoft.h | 1 -
> 2 files changed, 4 insertions(+), 13 deletions(-)
>
> diff --git a/i386/i386at/kd.c b/i386/i386at/kd.c
> index fc1604b..0783531 100644
> --- a/i386/i386at/kd.c
> +++ b/i386/i386at/kd.c
> @@ -350,7 +350,6 @@ u_char char_white = 0xff;
> short xstart = 0;
> short ystart = 0;
>
> -short char_byte_width = 0; /* char_width/NBBY */
> short fb_byte_width = 0; /* fb_width/NBBY */
> short font_byte_width = 0; /* num bytes in 1 scan line of
> font */
>
> @@ -2713,18 +2712,15 @@ char ch, chattr;
> {
> short xbit, ybit; /* u/l corner of char pos */
> u_char *to, *from;
> - short i, j;
> - u_char mask = (chattr == KA_REVERSE ? 0xff : 0);
> + short i;
>
> if ((u_char)ch >= chars_in_font)
> ch = K_QUES;
>
> bmpch2bit(pos, &xbit, &ybit);
> to = bit2fbptr(xbit, ybit);
> - from = font_start + ch * char_byte_width;
> + from = font_start;
> for (i = 0; i < char_height; ++i) {
> - for (j = 0; j < char_byte_width; ++j)
> - *(to+j) = *(from+j) ^ mask;
> to += fb_byte_width;
> from += font_byte_width;
> }
> @@ -2741,7 +2737,7 @@ csrpos_t from, to;
> short from_xbit, from_ybit;
> short to_xbit, to_ybit;
> u_char *tp, *fp;
> - short i, j;
> + short i;
>
> bmpch2bit(from, &from_xbit, &from_ybit);
> bmpch2bit(to, &to_xbit, &to_ybit);
> @@ -2750,8 +2746,6 @@ csrpos_t from, to;
> fp = bit2fbptr(from_xbit, from_ybit);
>
> for (i = 0; i < char_height; ++i) {
> - for (j = 0; j < char_byte_width; ++j)
> - *(tp+j) = *(fp+j);
> tp += fb_byte_width;
> fp += fb_byte_width;
> }
> @@ -2879,14 +2873,12 @@ u_char val;
> {
> short xbit, ybit;
> u_char *cp;
> - short line, byte;
> + short line;
>
> bmpch2bit(pos, &xbit, &ybit);
> ybit += char_height; /* position at bottom of line */
> cp = bit2fbptr(xbit, ybit);
> for (line = 0; line < cursor_height; ++line) {
> - for (byte = 0; byte < char_byte_width; ++byte)
> - *(cp+byte) = val;
> cp += fb_byte_width;
> }
> }
> diff --git a/i386/i386at/kdsoft.h b/i386/i386at/kdsoft.h
> index 1dfd2b2..e4fb12b 100644
> --- a/i386/i386at/kdsoft.h
> +++ b/i386/i386at/kdsoft.h
> @@ -203,7 +203,6 @@ extern short xstart, ystart;
> * Accelerators for bitmap displays.
> */
>
> -extern short char_byte_width; /* char_width/8 */
> extern short fb_byte_width; /* fb_width/8 */
> extern short font_byte_width; /* num bytes in 1 scan line of font */
>
> --
> 1.8.1.4
>
>
--
Samuel
La fonction memfrob() crypte les n premiers octets de la
zone de mémoire s en effectuant un OU-exclusif entre
chaque octet et le nombre 42.
(extrait de la page de man de memfrob -- Manuel du programmeur Linux)
- Re: [PATCH 36/66] i386/i386at/kd.c: simplify code, (continued)
- [PATCH 62/66] kern/syscall_sw.c: use boolean instead of an int, Marin Ramesa, 2013/12/05
- [PATCH 38/66] i386/i386at/kd.c: use boolean instead of an int, Marin Ramesa, 2013/12/05
- [PATCH 66/66] kern/processor.h: remove ifdef, Marin Ramesa, 2013/12/05
- [PATCH 37/66] i386/i386at/kd.c: simplify code, Marin Ramesa, 2013/12/05
- [PATCH 39/66] i386/i386at/kd.c: use boolean instead of an unsigned int, Marin Ramesa, 2013/12/05
- [PATCH 61/66] kern/refcount.h: remove unnecessary include, Marin Ramesa, 2013/12/05
- [PATCH 35/66] i386/i386at/kd.c: simplify code, Marin Ramesa, 2013/12/05
- Re: [PATCH 35/66] i386/i386at/kd.c: simplify code,
Samuel Thibault <=