Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/rasops Misc clean-up's:



details:   https://anonhg.NetBSD.org/src/rev/1fc53f7528d9
branches:  trunk
changeset: 453009:1fc53f7528d9
user:      rin <rin%NetBSD.org@localhost>
date:      Wed Jul 31 00:14:25 2019 +0000

description:
Misc clean-up's:
- protect private stuff in rasops.h by _RASOPS_PRIVATE
- staticify rasops_copycols() and rasops_isgray[]
- G/C unused extern int cold

diffstat:

 sys/dev/rasops/rasops.c   |  19 ++++-----
 sys/dev/rasops/rasops.h   |  85 ++++++++++++++++++++++------------------------
 sys/dev/rasops/rasops1.c  |   6 ++-
 sys/dev/rasops/rasops15.c |   6 ++-
 sys/dev/rasops/rasops2.c  |   6 ++-
 sys/dev/rasops/rasops24.c |   6 ++-
 sys/dev/rasops/rasops32.c |   6 ++-
 sys/dev/rasops/rasops4.c  |   6 ++-
 sys/dev/rasops/rasops8.c  |   6 ++-
 9 files changed, 78 insertions(+), 68 deletions(-)

diffs (truncated from 376 to 300 lines):

diff -r 6d754eb6d14f -r 1fc53f7528d9 sys/dev/rasops/rasops.c
--- a/sys/dev/rasops/rasops.c   Tue Jul 30 20:28:50 2019 +0000
+++ b/sys/dev/rasops/rasops.c   Wed Jul 31 00:14:25 2019 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: rasops.c,v 1.101 2019/07/30 15:29:40 rin Exp $        */
+/*      $NetBSD: rasops.c,v 1.102 2019/07/31 00:14:25 rin Exp $        */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.101 2019/07/30 15:29:40 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.102 2019/07/31 00:14:25 rin Exp $");
 
 #include "opt_rasops.h"
 #include "rasops_glue.h"
@@ -47,6 +47,8 @@
 #include <dev/wscons/wsdisplayvar.h>
 #include <dev/wscons/wsconsio.h>
 #include <dev/wsfont/wsfont.h>
+
+#define        _RASOPS_PRIVATE
 #include <dev/rasops/rasops.h>
 
 #ifndef _KERNEL
@@ -127,11 +129,9 @@
 };
 
 /* True if color is gray */
-const uint8_t rasops_isgray[16] = {
-       1, 0, 0, 0,
-       0, 0, 0, 1,
-       1, 0, 0, 0,
-       0, 0, 0, 1,
+static const uint8_t rasops_isgray[16] = {
+       1, 0, 0, 0, 0, 0, 0, 1,
+       1, 0, 0, 0, 0, 0, 0, 1,
 };
 
 #ifdef RASOPS_APPLE_PALETTE
@@ -181,6 +181,7 @@
 
 /* Generic functions */
 static void    rasops_copyrows(void *, int, int, int);
+static void    rasops_copycols(void *, int, int, int, int);
 static int     rasops_mapchar(void *, int, u_int *);
 static void    rasops_cursor(void *, int, int, int);
 static int     rasops_allocattr_color(void *, int, int, int, long *);
@@ -223,8 +224,6 @@
 void   rasops_make_box_chars_32(struct rasops_info *);
 void   rasops_make_box_chars_alpha(struct rasops_info *);
 
-extern int cold;
-
 /*
  * Initialize a 'rasops_info' descriptor.
  */
@@ -725,7 +724,7 @@
  * We simply cop-out here and use memmove(), since it handles all of
  * these cases anyway.
  */
-void
+static void
 rasops_copycols(void *cookie, int row, int src, int dst, int num)
 {
        struct rasops_info *ri = (struct rasops_info *)cookie;
diff -r 6d754eb6d14f -r 1fc53f7528d9 sys/dev/rasops/rasops.h
--- a/sys/dev/rasops/rasops.h   Tue Jul 30 20:28:50 2019 +0000
+++ b/sys/dev/rasops/rasops.h   Wed Jul 31 00:14:25 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rasops.h,v 1.38 2019/07/29 08:13:50 rin Exp $ */
+/*     $NetBSD: rasops.h,v 1.39 2019/07/31 00:14:25 rin Exp $ */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -100,8 +100,7 @@
         * on depths other than 15, 16, 24 and 32 bits per pel. On
         * 24 bit displays, ri_{r,g,b}num must be 8.
         */
-       uint8_t ri_rnum;
-       /* number of bits for red */
+       uint8_t ri_rnum;        /* number of bits for red */
        uint8_t ri_gnum;        /* number of bits for green */
        uint8_t ri_bnum;        /* number of bits for blue */
        uint8_t ri_rpos;        /* which bit red starts at */
@@ -139,8 +138,6 @@
 #endif
 };
 
-#define DELTA(p, d, cast) ((p) = (cast)((uint8_t *)(p) + (d)))
-
 #define CHAR_IN_FONT(c,font)                                   \
        ((c) >= (font)->firstchar &&                            \
        ((c) - (font)->firstchar) < (font)->numchars)
@@ -149,6 +146,44 @@
                          (ri->ri_optfont.data != NULL)) ? \
                         &ri->ri_optfont : ri->ri_font
 
+/*
+ * rasops_init().
+ *
+ * Integer parameters are the number of rows and columns we'd *like*.
+ *
+ * In terms of optimization, fonts that are a multiple of 8 pixels wide
+ * work the best.
+ *
+ * rasops_init() takes care of rasops_reconfig(). The parameters to both
+ * are the same. If calling rasops_reconfig() to change the font and
+ * ri_wsfcookie >= 0, you must call wsfont_unlock() on it, and reset it
+ * to -1 (or a new, valid cookie).
+ */
+
+/* rasops.c */
+int    rasops_init(struct rasops_info *, int, int);
+int    rasops_reconfig(struct rasops_info *, int, int);
+void   rasops_unpack_attr(long, int *, int *, int *);
+void   rasops_eraserows(void *, int, int, long);
+void   rasops_erasecols(void *, int, int, int, long);
+int    rasops_get_cmap(struct rasops_info *, uint8_t *, size_t);
+
+extern const uint8_t   rasops_cmap[256 * 3];
+
+#ifdef _RASOPS_PRIVATE
+/*
+ * Per-depth initialization functions.
+ */
+void   rasops1_init(struct rasops_info *);
+void   rasops2_init(struct rasops_info *);
+void   rasops4_init(struct rasops_info *);
+void   rasops8_init(struct rasops_info *);
+void   rasops15_init(struct rasops_info *);
+void   rasops24_init(struct rasops_info *);
+void   rasops32_init(struct rasops_info *);
+
+#define        DELTA(p, d, cast) ((p) = (cast)((uint8_t *)(p) + (d)))
+
 #define        FONT_GLYPH(uc, font, ri)                                        \
        ((uint8_t *)(font)->data + ((uc) - ((font)->firstchar)) *       \
            (ri)->ri_fontscale)
@@ -164,44 +199,6 @@
        u |= p[3];
        return u;
 }
-
-/*
- * rasops_init().
- *
- * Integer parameters are the number of rows and columns we'd *like*.
- *
- * In terms of optimization, fonts that are a multiple of 8 pixels wide
- * work the best.
- *
- * rasops_init() takes care of rasops_reconfig(). The parameters to both
- * are the same. If calling rasops_reconfig() to change the font and
- * ri_wsfcookie >= 0, you must call wsfont_unlock() on it, and reset it
- * to -1 (or a new, valid cookie).
- */
-
-/*
- * Per-depth initialization functions. These should not be called outside
- * the rasops code.
- */
-void   rasops1_init(struct rasops_info *);
-void   rasops2_init(struct rasops_info *);
-void   rasops4_init(struct rasops_info *);
-void   rasops8_init(struct rasops_info *);
-void   rasops15_init(struct rasops_info *);
-void   rasops24_init(struct rasops_info *);
-void   rasops32_init(struct rasops_info *);
-
-/* rasops.c */
-int    rasops_init(struct rasops_info *, int, int);
-int    rasops_reconfig(struct rasops_info *, int, int);
-void   rasops_unpack_attr(long, int *, int *, int *);
-void   rasops_eraserows(void *, int, int, long);
-void   rasops_erasecols(void *, int, int, int, long);
-void   rasops_copycols(void *, int, int, int, int);
-int    rasops_get_cmap(struct rasops_info *, uint8_t *, size_t);
-
-
-extern const uint8_t   rasops_isgray[16];
-extern const uint8_t   rasops_cmap[256*3];
+#endif /* _RASOPS_PRIVATE */
 
 #endif /* _RASOPS_H_ */
diff -r 6d754eb6d14f -r 1fc53f7528d9 sys/dev/rasops/rasops1.c
--- a/sys/dev/rasops/rasops1.c  Tue Jul 30 20:28:50 2019 +0000
+++ b/sys/dev/rasops/rasops1.c  Wed Jul 31 00:14:25 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rasops1.c,v 1.31 2019/07/30 15:29:40 rin Exp $ */
+/*     $NetBSD: rasops1.c,v 1.32 2019/07/31 00:14:25 rin Exp $ */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rasops1.c,v 1.31 2019/07/30 15:29:40 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops1.c,v 1.32 2019/07/31 00:14:25 rin Exp $");
 
 #include "opt_rasops.h"
 
@@ -41,6 +41,8 @@
 
 #include <dev/wscons/wsdisplayvar.h>
 #include <dev/wscons/wsconsio.h>
+
+#define        _RASOPS_PRIVATE
 #include <dev/rasops/rasops.h>
 #include <dev/rasops/rasops_masks.h>
 
diff -r 6d754eb6d14f -r 1fc53f7528d9 sys/dev/rasops/rasops15.c
--- a/sys/dev/rasops/rasops15.c Tue Jul 30 20:28:50 2019 +0000
+++ b/sys/dev/rasops/rasops15.c Wed Jul 31 00:14:25 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rasops15.c,v 1.31 2019/07/29 10:55:56 rin Exp $        */
+/*     $NetBSD: rasops15.c,v 1.32 2019/07/31 00:14:25 rin Exp $        */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rasops15.c,v 1.31 2019/07/29 10:55:56 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops15.c,v 1.32 2019/07/31 00:14:25 rin Exp $");
 
 #include "opt_rasops.h"
 
@@ -40,6 +40,8 @@
 
 #include <dev/wscons/wsdisplayvar.h>
 #include <dev/wscons/wsconsio.h>
+
+#define        _RASOPS_PRIVATE
 #include <dev/rasops/rasops.h>
 
 static void    rasops15_putchar(void *, int, int, u_int, long);
diff -r 6d754eb6d14f -r 1fc53f7528d9 sys/dev/rasops/rasops2.c
--- a/sys/dev/rasops/rasops2.c  Tue Jul 30 20:28:50 2019 +0000
+++ b/sys/dev/rasops/rasops2.c  Wed Jul 31 00:14:25 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rasops2.c,v 1.26 2019/07/29 03:01:09 rin Exp $ */
+/*     $NetBSD: rasops2.c,v 1.27 2019/07/31 00:14:25 rin Exp $ */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rasops2.c,v 1.26 2019/07/29 03:01:09 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops2.c,v 1.27 2019/07/31 00:14:25 rin Exp $");
 
 #include "opt_rasops.h"
 
@@ -41,6 +41,8 @@
 
 #include <dev/wscons/wsdisplayvar.h>
 #include <dev/wscons/wsconsio.h>
+
+#define        _RASOPS_PRIVATE
 #include <dev/rasops/rasops.h>
 #include <dev/rasops/rasops_masks.h>
 
diff -r 6d754eb6d14f -r 1fc53f7528d9 sys/dev/rasops/rasops24.c
--- a/sys/dev/rasops/rasops24.c Tue Jul 30 20:28:50 2019 +0000
+++ b/sys/dev/rasops/rasops24.c Wed Jul 31 00:14:25 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rasops24.c,v 1.39 2019/07/30 15:23:23 rin Exp $        */
+/*     $NetBSD: rasops24.c,v 1.40 2019/07/31 00:14:25 rin Exp $        */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rasops24.c,v 1.39 2019/07/30 15:23:23 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops24.c,v 1.40 2019/07/31 00:14:25 rin Exp $");
 
 #include "opt_rasops.h"
 
@@ -43,6 +43,8 @@
 
 #include <dev/wscons/wsdisplayvar.h>
 #include <dev/wscons/wsconsio.h>
+
+#define        _RASOPS_PRIVATE
 #include <dev/rasops/rasops.h>
 
 static void    rasops24_erasecols(void *, int, int, int, long);
diff -r 6d754eb6d14f -r 1fc53f7528d9 sys/dev/rasops/rasops32.c
--- a/sys/dev/rasops/rasops32.c Tue Jul 30 20:28:50 2019 +0000
+++ b/sys/dev/rasops/rasops32.c Wed Jul 31 00:14:25 2019 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: rasops32.c,v 1.39 2019/07/29 10:55:56 rin Exp $       */



Home | Main Index | Thread Index | Old Index