bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 36/66] i386/i386at/kd.c: simplify code


From: Samuel Thibault
Subject: Re: [PATCH 36/66] i386/i386at/kd.c: simplify code
Date: Mon, 9 Dec 2013 00:08:55 +0900
User-agent: Mutt/1.5.21+34 (58baf7c9f32f) (2010-12-30)

Marin Ramesa, le Thu 05 Dec 2013 22:03:30 +0100, a écrit :
> Variable fb_byte_width is always zero. Use this to simplify
> the code.

Ditto.

> * i386/i386at/kd.c (fb_byte_width): Remove variable.
> (to): Remove variable.
> (bit2fbptr): Remove assignment.
> (to): Likewise.
> (to, fp, i): Remove variables.
> (bit2fbptr): Remove assignments.
> Remove for loop.
> (count): Remove assignment.
> (from_xbit): Simplify assignment.
> (count): Remove assignment.
> (kd_slmwd): Simplify call.
> (line, cp): Remove variables.
> (bit2fbptr): Remove assignment.
> Remove for loop.
> Simplify return value.
> * i386/i386at/kdsoft.h (fb_byte_width): Remove declaration.
> 
> ---
>  i386/i386at/kd.c     | 32 +++++++-------------------------
>  i386/i386at/kdsoft.h |  1 -
>  2 files changed, 7 insertions(+), 26 deletions(-)
> 
> diff --git a/i386/i386at/kd.c b/i386/i386at/kd.c
> index 0783531..1d0b84f 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        fb_byte_width   = 0;            /* fb_width/NBBY */
>  short        font_byte_width = 0;            /* num bytes in 1 scan line of 
> font */
>  
>  /*
> @@ -2711,17 +2710,16 @@ csrpos_t pos;
>  char ch, chattr;
>  {
>       short xbit, ybit;               /* u/l corner of char pos */
> -     u_char *to, *from;
> +     u_char *from;
>       short i;
>  
>       if ((u_char)ch >= chars_in_font)
>               ch = K_QUES;
>  
>       bmpch2bit(pos, &xbit, &ybit);
> -     to = bit2fbptr(xbit, ybit);
> +     bit2fbptr(xbit, ybit);
>       from = font_start;
>       for (i = 0; i < char_height; ++i) {
> -             to += fb_byte_width;
>               from += font_byte_width;
>       }
>  }
> @@ -2736,19 +2734,12 @@ csrpos_t from, to;
>  {
>       short from_xbit, from_ybit;
>       short to_xbit, to_ybit;
> -     u_char *tp, *fp;
> -     short i;
>  
>       bmpch2bit(from, &from_xbit, &from_ybit);
>       bmpch2bit(to, &to_xbit, &to_ybit);
>  
> -     tp = bit2fbptr(to_xbit, to_ybit);
> -     fp = bit2fbptr(from_xbit, from_ybit);
> -
> -     for (i = 0; i < char_height; ++i) {
> -             tp += fb_byte_width;
> -             fp += fb_byte_width;
> -     }
> +     bit2fbptr(to_xbit, to_ybit);
> +     bit2fbptr(from_xbit, from_ybit);
>  }
>  
>  /*
> @@ -2771,7 +2762,6 @@ int     count;
>               from_xbit = to_xbit = 0;
>               bmppaintcsr(kd_curpos, char_black); /* don't copy cursor */
>               count /= kd_cols;       /* num lines */
> -             count *= fb_byte_width * (char_height+cursor_height);
>               kd_slmscu(bit2fbptr(from_xbit, from_ybit),
>                         bit2fbptr(to_xbit, to_ybit),
>                         count/SLAMBPW);
> @@ -2805,11 +2795,10 @@ int   count;
>           && to_xbit == xstart + (kd_cols - 1) * char_width
>           && count%kd_cols == 0) {
>               /* fast case - entire lines*/
> -             from_xbit = to_xbit = 8 * (fb_byte_width - 1);
> +             from_xbit = to_xbit = -8;
>                                       /* last byte on line */
>               bmppaintcsr(kd_curpos, char_black); /* don't copy cursor */
>               count /= kd_cols;       /* num lines */
> -             count *= fb_byte_width * (char_height+cursor_height);
>               kd_slmscd(bit2fbptr(from_xbit, from_ybit),
>                         bit2fbptr(to_xbit, to_ybit),
>                         count/SLAMBPW);
> @@ -2840,8 +2829,7 @@ char    chattr;                         /* reverse or 
> normal */
>       clearval = (u_short)(clearbyte<<8) + clearbyte;
>       if (to == 0 && count >= kd_lines * kd_cols) {
>               /* fast case - entire page */
> -             kd_slmwd(vid_start, (fb_byte_width * fb_height)/SLAMBPW,
> -                      clearval);
> +             kd_slmwd(vid_start, 0, clearval);
>       } else
>               /* slow case */
>               for (i = 0; i < count; ++i) {
> @@ -2872,15 +2860,9 @@ csrpos_t pos;
>  u_char       val;
>  {
>       short xbit, ybit;
> -     u_char *cp;
> -     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) {
> -             cp += fb_byte_width;
> -     }
>  }
>  
>  /*
> @@ -2910,7 +2892,7 @@ u_char *
>  bit2fbptr(xb, yb)
>  short        xb, yb;
>  {
> -     return(vid_start + yb * fb_byte_width + xb/8);
> +     return(vid_start + xb/8);
>  }
>  
>  
> diff --git a/i386/i386at/kdsoft.h b/i386/i386at/kdsoft.h
> index e4fb12b..a9aba78 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 fb_byte_width;          /* fb_width/8 */
>  extern short font_byte_width;        /* num bytes in 1 scan line of font */
>  
>  #endif /* _KDSOFT_H_ */
> -- 
> 1.8.1.4
> 
> 

-- 
Samuel
<y> le y est un animal discret se logeant facilement dans un terminal
*** c has changed the topic on channel #ens-mim to ne pas jeter de cacahuetes 
aux ys, svp
 -+- #ens-mim - n'oubliez pas le guide -+-



reply via email to

[Prev in Thread] Current Thread [Next in Thread]