minor fixes for fbset bloat
<mjn3> printf("\tgeometry %u %u %u %u %u\n", v->xres, v->yres,
<mjn3> v->xres_virtual, v->yres_virtual, v->bits_per_pixel);
<mjn3> printf("\ttimings %u %u %u %u %u %u %u\n", v->pixclock, v->left_margin,
<mjn3> v->right_margin, v->upper_margin, v->lower_margin, v->hsync_l
<mjn3> en,
<mjn3> v->vsync_len);
<mjn3> printf("\taccel %s\n", (v->accel_flags > 0 ? "true" : "false"));
<mjn3> printf("\trgba %u/%u,%u/%u,%u/%u,%u/%u\n", v->red.length,
<mjn3> v->red.offset, v->green.length, v->green.offset, v->blue.leng
<mjn3> th,
<mjn3> v->blue.offset, v->transp.length, v->transp.offset);
<mjn3> printf("endmode\n\n");
<mjn3> whay have multiple printf calls when one would do?
<mjn3> and this:
<mjn3> static struct cmdoptions_t {
<mjn3> char *name;
<mjn3> unsigned char param_count;
<mjn3> unsigned char code;
<mjn3> } g_cmdoptions[] = {
<mjn3> {
<mjn3> "-fb", 1, CMD_FB}, {
<mjn3> (repeated entries)
<mjn3> why isn't this constant? what about struct packing?
inline the helper functions that are only referenced once.
diff --git a/util-linux/fbset.c b/util-linux/fbset.c
index 2a959c2..b41612d 100644
--- a/util-linux/fbset.c
+++ b/util-linux/fbset.c
@@ -131,10 +131,10 @@
};
-static struct cmdoptions_t {
- char *name;
- unsigned char param_count;
- unsigned char code;
+const static struct cmdoptions_t {
+ const char *name;
+ const unsigned char param_count;
+ const unsigned char code;
} g_cmdoptions[] = {
{
"-fb", 1, CMD_FB}, {
@@ -284,7 +284,7 @@
return 0;
}
-static void setmode(struct fb_var_screeninfo *base,
+static inline void setmode(struct fb_var_screeninfo *base,
struct fb_var_screeninfo *set)
{
if ((int) set->xres > 0)
@@ -299,7 +299,7 @@
base->bits_per_pixel = set->bits_per_pixel;
}
-static void showmode(struct fb_var_screeninfo *v)
+static inline void showmode(struct fb_var_screeninfo *v)
{
double drate = 0, hrate = 0, vrate = 0;
@@ -312,21 +312,21 @@
hrate / (v->upper_margin + v->yres + v->lower_margin +
v->vsync_len);
}
- printf("\nmode \"%ux%u-%u\"\n", v->xres, v->yres, (int) (vrate + 0.5));
+ printf("\nmode \"%ux%u-%u\"\n"
#ifdef CONFIG_FEATURE_FBSET_FANCY
- printf("\t# D: %.3f MHz, H: %.3f kHz, V: %.3f Hz\n", drate / 1e6,
- hrate / 1e3, vrate);
+ "\t# D: %.3f MHz, H: %.3f kHz, V: %.3f Hz\n"
#endif
- printf("\tgeometry %u %u %u %u %u\n", v->xres, v->yres,
- v->xres_virtual, v->yres_virtual, v->bits_per_pixel);
- printf("\ttimings %u %u %u %u %u %u %u\n", v->pixclock, v->left_margin,
+ "\tgeometry %u %u %u %u %u\n\ttimings %u %u %u %u %u %u %u\n\taccel %s\n\trgba %u/%u,%u/%u,%u/%u,%u/%u\nendmode\n\n",
+ v->xres, v->yres, (int) (vrate + 0.5),
+#ifdef CONFIG_FEATURE_FBSET_FANCY
+ drate / 1e6, hrate / 1e3, vrate,
+#endif
+ v->xres, v->yres, v->xres_virtual, v->yres_virtual,
+ v->bits_per_pixel, v->pixclock, v->left_margin,
v->right_margin, v->upper_margin, v->lower_margin, v->hsync_len,
- v->vsync_len);
- printf("\taccel %s\n", (v->accel_flags > 0 ? "true" : "false"));
- printf("\trgba %u/%u,%u/%u,%u/%u,%u/%u\n", v->red.length,
+ v->vsync_len, (v->accel_flags > 0 ? "true" : "false"), v->red.length,
v->red.offset, v->green.length, v->green.offset, v->blue.length,
v->blue.offset, v->transp.length, v->transp.offset);
- printf("endmode\n\n");
}
#ifdef STANDALONE