On Thu, Jun 15, 2017 at 01:52:07PM +0200, Frederic Cambus wrote:
> On Tue, Jun 13, 2017 at 11:29:59AM +0000, Miod Vallat wrote:
> >
> > > Hi tech@,
> > >
> > > We do not support iso7 nor pcvt encoding, so remove macro definitions
> > > and commented entries.
> >
> > If you do that, then you can probably optimize away
> > vga_valid_primary_font() in sys/dev/ic/vga.c as well.
>
> Makes sense to me as well, thanks for pointing that out. Diff below.
Please discard the last diff, what did I have in mind?
The fonts we are looping through in vga_selectfont() are the builtin
font which is using the IBM encoding, and some potentially loaded fonts
which are either IBM or ISO encoded.
Therefore the condition checked by vga_valid_font() is always true, and
we can remove it.
Comments? OK?
Index: sys/dev/ic/vga.c
===================================================================
RCS file: /cvs/src/sys/dev/ic/vga.c,v
retrieving revision 1.68
diff -u -p -r1.68 vga.c
--- sys/dev/ic/vga.c 9 Sep 2015 18:23:39 -0000 1.68
+++ sys/dev/ic/vga.c 16 Jun 2017 20:50:42 -0000
@@ -344,10 +344,6 @@ bad:
* We want at least ASCII 32..127 be present in the
* first font slot.
*/
-#define vga_valid_primary_font(f) \
- (f->encoding == WSDISPLAY_FONTENC_IBM || \
- f->encoding == WSDISPLAY_FONTENC_ISO)
-
int
vga_selectfont(struct vga_config *vc, struct vgascreen *scr, const char *name1,
const char *name2) /* NULL: take first found */
@@ -362,9 +358,7 @@ vga_selectfont(struct vga_config *vc, st
struct vgafont *f = vc->vc_fonts[i];
if (!f || f->height != type->fontheight)
continue;
- if (!f1 &&
- vga_valid_primary_font(f) &&
- (!name1 || !*name1 ||
+ if (!f1 && (!name1 || !*name1 ||
!strncmp(name1, f->name, WSFONT_NAME_SIZE))) {
f1 = f;
continue;