fbset: code shrink

function                                             old     new   delta
ss                                                     -      33     +33
fbset_main                                          1968    1844    -124
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/1 up/down: 33/-124)           Total: -91 bytes
This commit is contained in:
Denis Vlasenko 2008-07-27 20:25:29 +00:00
parent 2c7a1fd6d4
commit 09f5ecfa47

View File

@ -170,6 +170,14 @@ enum {
}; };
#endif #endif
static void ss(uint32_t *x, uint32_t flag, char *where, const char *what)
{
if (strstr(where, what))
*x &= ~flag;
else
*x |= flag;
}
#if ENABLE_FEATURE_FBSET_READMODE #if ENABLE_FEATURE_FBSET_READMODE
static int readmode(struct fb_var_screeninfo *base, const char *fn, static int readmode(struct fb_var_screeninfo *base, const char *fn,
const char *mode) const char *mode)
@ -211,46 +219,22 @@ static int readmode(struct fb_var_screeninfo *base, const char *fn,
&(base->hsync_len), &(base->vsync_len)); &(base->hsync_len), &(base->vsync_len));
} else if ((p = strstr(buf, "laced "))) { } else if ((p = strstr(buf, "laced "))) {
//p += 6; //p += 6;
if (strstr(buf, "false")) { ss(&base->vmode, FB_VMODE_INTERLACED, buf, "false");
base->vmode &= ~FB_VMODE_INTERLACED;
} else {
base->vmode |= FB_VMODE_INTERLACED;
}
} else if ((p = strstr(buf, "double "))) { } else if ((p = strstr(buf, "double "))) {
//p += 7; //p += 7;
if (strstr(buf, "false")) { ss(&base->vmode, FB_VMODE_DOUBLE, buf, "false");
base->vmode &= ~FB_VMODE_DOUBLE;
} else {
base->vmode |= FB_VMODE_DOUBLE;
}
} else if ((p = strstr(buf, "vsync "))) { } else if ((p = strstr(buf, "vsync "))) {
//p += 6; //p += 6;
if (strstr(buf, "low")) { ss(&base->sync, FB_SYNC_VERT_HIGH_ACT, buf, "low");
base->sync &= ~FB_SYNC_VERT_HIGH_ACT;
} else {
base->sync |= FB_SYNC_VERT_HIGH_ACT;
}
} else if ((p = strstr(buf, "hsync "))) { } else if ((p = strstr(buf, "hsync "))) {
//p += 6; //p += 6;
if (strstr(buf, "low")) { ss(&base->sync, FB_SYNC_HOR_HIGH_ACT, buf, "low");
base->sync &= ~FB_SYNC_HOR_HIGH_ACT;
} else {
base->sync |= FB_SYNC_HOR_HIGH_ACT;
}
} else if ((p = strstr(buf, "csync "))) { } else if ((p = strstr(buf, "csync "))) {
//p += 6; //p += 6;
if (strstr(buf, "low")) { ss(&base->sync, FB_SYNC_COMP_HIGH_ACT, buf, "low");
base->sync &= ~FB_SYNC_COMP_HIGH_ACT;
} else {
base->sync |= FB_SYNC_COMP_HIGH_ACT;
}
} else if ((p = strstr(buf, "extsync "))) { } else if ((p = strstr(buf, "extsync "))) {
//p += 8; //p += 8;
if (strstr(buf, "false")) { ss(&base->sync, FB_SYNC_EXT, buf, "false");
base->sync &= ~FB_SYNC_EXT;
} else {
base->sync |= FB_SYNC_EXT;
}
} }
if (strstr(buf, "endmode")) if (strstr(buf, "endmode"))