aboutsummaryrefslogtreecommitdiff
path: root/util-linux/fbset.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-07-27 20:25:29 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-07-27 20:25:29 +0000
commit09f5ecfa470f0cc88fba251d04f790a3e7bf92e8 (patch)
tree1ff5867c86e6bfafa4dc1d8ef93c19c1cf89d5c2 /util-linux/fbset.c
parent2c7a1fd6d4dbc77c64151e7ffe3f6aea5fada33a (diff)
downloadbusybox-w32-09f5ecfa470f0cc88fba251d04f790a3e7bf92e8.tar.gz
busybox-w32-09f5ecfa470f0cc88fba251d04f790a3e7bf92e8.tar.bz2
busybox-w32-09f5ecfa470f0cc88fba251d04f790a3e7bf92e8.zip
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
Diffstat (limited to 'util-linux/fbset.c')
-rw-r--r--util-linux/fbset.c44
1 files changed, 14 insertions, 30 deletions
diff --git a/util-linux/fbset.c b/util-linux/fbset.c
index ac45fe830..5d360b75e 100644
--- a/util-linux/fbset.c
+++ b/util-linux/fbset.c
@@ -170,6 +170,14 @@ enum {
170}; 170};
171#endif 171#endif
172 172
173static void ss(uint32_t *x, uint32_t flag, char *where, const char *what)
174{
175 if (strstr(where, what))
176 *x &= ~flag;
177 else
178 *x |= flag;
179}
180
173#if ENABLE_FEATURE_FBSET_READMODE 181#if ENABLE_FEATURE_FBSET_READMODE
174static int readmode(struct fb_var_screeninfo *base, const char *fn, 182static int readmode(struct fb_var_screeninfo *base, const char *fn,
175 const char *mode) 183 const char *mode)
@@ -211,46 +219,22 @@ static int readmode(struct fb_var_screeninfo *base, const char *fn,
211 &(base->hsync_len), &(base->vsync_len)); 219 &(base->hsync_len), &(base->vsync_len));
212 } else if ((p = strstr(buf, "laced "))) { 220 } else if ((p = strstr(buf, "laced "))) {
213 //p += 6; 221 //p += 6;
214 if (strstr(buf, "false")) { 222 ss(&base->vmode, FB_VMODE_INTERLACED, buf, "false");
215 base->vmode &= ~FB_VMODE_INTERLACED;
216 } else {
217 base->vmode |= FB_VMODE_INTERLACED;
218 }
219 } else if ((p = strstr(buf, "double "))) { 223 } else if ((p = strstr(buf, "double "))) {
220 //p += 7; 224 //p += 7;
221 if (strstr(buf, "false")) { 225 ss(&base->vmode, FB_VMODE_DOUBLE, buf, "false");
222 base->vmode &= ~FB_VMODE_DOUBLE;
223 } else {
224 base->vmode |= FB_VMODE_DOUBLE;
225 }
226 } else if ((p = strstr(buf, "vsync "))) { 226 } else if ((p = strstr(buf, "vsync "))) {
227 //p += 6; 227 //p += 6;
228 if (strstr(buf, "low")) { 228 ss(&base->sync, FB_SYNC_VERT_HIGH_ACT, buf, "low");
229 base->sync &= ~FB_SYNC_VERT_HIGH_ACT;
230 } else {
231 base->sync |= FB_SYNC_VERT_HIGH_ACT;
232 }
233 } else if ((p = strstr(buf, "hsync "))) { 229 } else if ((p = strstr(buf, "hsync "))) {
234 //p += 6; 230 //p += 6;
235 if (strstr(buf, "low")) { 231 ss(&base->sync, FB_SYNC_HOR_HIGH_ACT, buf, "low");
236 base->sync &= ~FB_SYNC_HOR_HIGH_ACT;
237 } else {
238 base->sync |= FB_SYNC_HOR_HIGH_ACT;
239 }
240 } else if ((p = strstr(buf, "csync "))) { 232 } else if ((p = strstr(buf, "csync "))) {
241 //p += 6; 233 //p += 6;
242 if (strstr(buf, "low")) { 234 ss(&base->sync, FB_SYNC_COMP_HIGH_ACT, buf, "low");
243 base->sync &= ~FB_SYNC_COMP_HIGH_ACT;
244 } else {
245 base->sync |= FB_SYNC_COMP_HIGH_ACT;
246 }
247 } else if ((p = strstr(buf, "extsync "))) { 235 } else if ((p = strstr(buf, "extsync "))) {
248 //p += 8; 236 //p += 8;
249 if (strstr(buf, "false")) { 237 ss(&base->sync, FB_SYNC_EXT, buf, "false");
250 base->sync &= ~FB_SYNC_EXT;
251 } else {
252 base->sync |= FB_SYNC_EXT;
253 }
254 } 238 }
255 239
256 if (strstr(buf, "endmode")) 240 if (strstr(buf, "endmode"))