Ignore:
Timestamp:
2018-03-02T20:10:49Z (7 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f1380b7
Parents:
3061bc1
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-02-28 17:38:31)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-03-02 20:10:49)
Message:

style: Remove trailing whitespace on _all_ lines, including empty ones, for particular file types.

Command used: tools/srepl '\s\+$' '' -- *.c *.h *.py *.sh *.s *.S *.ag

Currently, whitespace on empty lines is very inconsistent.
There are two basic choices: Either remove the whitespace, or keep empty lines
indented to the level of surrounding code. The former is AFAICT more common,
and also much easier to do automatically.

Alternatively, we could write script for automatic indentation, and use that
instead. However, if such a script exists, it's possible to use the indented
style locally, by having the editor apply relevant conversions on load/save,
without affecting remote repository. IMO, it makes more sense to adopt
the simpler rule.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/dist/src/c/demos/tetris/screen.c

    r3061bc1 ra35b458  
    148148        sysarg_t ccap;
    149149        errno_t rc = console_get_color_cap(console, &ccap);
    150        
     150
    151151        if (rc != EOK)
    152152                return false;
    153        
     153
    154154        return ((ccap & CONSOLE_CAP_RGB) == CONSOLE_CAP_RGB);
    155155}
     
    161161{
    162162        winsize_t ws;
    163        
     163
    164164        Rows = 0;
    165165        Cols = 0;
    166        
     166
    167167        if (get_display_size(&ws) == 0) {
    168168                Rows = ws.ws_row;
     
    171171
    172172        use_color = get_display_color_sup();
    173        
     173
    174174        if ((Rows < MINROWS) || (Cols < MINCOLS)) {
    175175                char smallscr[55];
    176                
     176
    177177                snprintf(smallscr, sizeof(smallscr),
    178178                    "the screen is too small (must be at least %dx%d)",
     
    181181        }
    182182        isset = 1;
    183        
     183
    184184        scr_clear();
    185185}
     
    197197        if (isset)
    198198                scr_end();
    199        
     199
    200200        errx(1, "aborting: %s", why);
    201201}
     
    213213        int j;
    214214        int ccol;
    215        
     215
    216216        /* Always leave cursor after last displayed point */
    217217        curscreen[D_LAST * B_COLS - 1] = -1;
    218        
     218
    219219        if (score != curscore) {
    220220                moveto(0, 0);
     
    222222                curscore = score;
    223223        }
    224        
     224
    225225        /* Draw preview of next pattern */
    226226        if ((showpreview) && (nextshape != lastshape)) {
     
    228228                static int r = 5, c = 2;
    229229                int tr, tc, t;
    230                
     230
    231231                lastshape = nextshape;
    232                
     232
    233233                /* Clean */
    234234                resume_normal();
     
    241241                moveto(r + 2, c - 1);
    242242                putstr("          ");
    243                
     243
    244244                moveto(r - 3, c - 2);
    245245                putstr("Next shape:");
    246                
     246
    247247                /* Draw */
    248248                start_standout(nextshape->color);
     
    252252                        t = c + r * B_COLS;
    253253                        t += nextshape->off[i];
    254                        
     254
    255255                        tr = t / B_COLS;
    256256                        tc = t % B_COLS;
    257                        
     257
    258258                        moveto(tr, 2*tc);
    259259                        putstr("  ");
     
    261261                resume_normal();
    262262        }
    263        
     263
    264264        bp = &board[D_FIRST * B_COLS];
    265265        sp = &curscreen[D_FIRST * B_COLS];
     
    269269                        if (*sp == (so = *bp))
    270270                                continue;
    271                        
     271
    272272                        *sp = so;
    273273                        if (i != ccol) {
     
    278278                                moveto(RTOD(j), CTOD(i));
    279279                        }
    280                        
     280
    281281                        if (so != cur_so) {
    282282                                if (so)
     
    287287                        }
    288288                        putstr("  ");
    289                        
     289
    290290                        ccol = i + 1;
    291291                        /*
     
    297297                         * the next cell is a different color.
    298298                         */
    299                        
     299
    300300                        if ((i > STOP) || (sp[1] != bp[1]) || (so != bp[1]))
    301301                                continue;
    302                        
     302
    303303                        if (sp[2] != bp[2])
    304304                                sp[1] = -1;
     
    309309                }
    310310        }
    311        
     311
    312312        if (cur_so)
    313313                resume_normal();
    314        
     314
    315315        console_flush(console);
    316316}
     
    323323{
    324324        int l = str_size(s);
    325        
     325
    326326        moveto(Rows - 2, ((Cols - l) >> 1) - 1);
    327        
     327
    328328        if (set)
    329329                putstr(s);
     
    341341{
    342342        suseconds_t timeout = fallrate;
    343        
     343
    344344        while (timeout > 0) {
    345345                cons_event_t event;
    346                
     346
    347347                if (!console_get_event_timeout(console, &event, &timeout))
    348348                        break;
     
    359359         * and increase speed.
    360360         */
    361        
     361
    362362        if (timeleft <= 0) {
    363363                faster();
    364364                timeleft = fallrate;
    365365        }
    366        
     366
    367367        /*
    368368         * Wait to see if there is any input. If so, take it and
     
    371371         * make timeleft zero and return -1.
    372372         */
    373        
     373
    374374        wchar_t c = 0;
    375        
     375
    376376        while (c == 0) {
    377377                cons_event_t event;
    378                
     378
    379379                if (!console_get_event_timeout(console, &event, &timeleft)) {
    380380                        timeleft = 0;
    381381                        return -1;
    382382                }
    383                
     383
    384384                if (event.type == CEV_KEY && event.ev.key.type == KEY_PRESS)
    385385                        c = event.ev.key.c;
    386386        }
    387        
     387
    388388        return (int) c;
    389389}
     
    395395{
    396396        wchar_t c = 0;
    397        
     397
    398398        while (c == 0) {
    399399                cons_event_t event;
    400                
     400
    401401                if (!console_get_event(console, &event))
    402402                        return -1;
    403                
     403
    404404                if (event.type == CEV_KEY && event.ev.key.type == KEY_PRESS)
    405405                        c = event.ev.key.c;
    406406        }
    407        
     407
    408408        return (int) c;
    409409}
Note: See TracChangeset for help on using the changeset viewer.