Changeset a35b458 in mainline for uspace/lib/c/generic/io/chargrid.c


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/lib/c/generic/io/chargrid.c

    r3061bc1 ra35b458  
    5757            sizeof(chargrid_t) + cols * rows * sizeof(charfield_t);
    5858        chargrid_t *scrbuf;
    59        
     59
    6060        if ((flags & CHARGRID_FLAG_SHARED) == CHARGRID_FLAG_SHARED) {
    6161                scrbuf = (chargrid_t *) as_area_create(AS_AREA_ANY, size,
     
    6969                        return NULL;
    7070        }
    71        
     71
    7272        scrbuf->size = size;
    7373        scrbuf->flags = flags;
     
    7575        scrbuf->rows = rows;
    7676        scrbuf->cursor_visible = false;
    77        
     77
    7878        scrbuf->attrs.type = CHAR_ATTR_STYLE;
    7979        scrbuf->attrs.val.style = STYLE_NORMAL;
    80        
     80
    8181        scrbuf->top_row = 0;
    8282        chargrid_clear(scrbuf);
    83        
     83
    8484        return scrbuf;
    8585}
     
    107107                scrbuf->top_row = (scrbuf->top_row + 1) % scrbuf->rows;
    108108                chargrid_clear_row(scrbuf, scrbuf->row);
    109                
     109
    110110                return scrbuf->rows;
    111111        }
    112        
     112
    113113        return 2;
    114114}
     
    122122                return chargrid_update_rows(scrbuf);
    123123        }
    124        
     124
    125125        return 1;
    126126}
     
    144144        assert(scrbuf->col < scrbuf->cols);
    145145        assert(scrbuf->row < scrbuf->rows);
    146        
     146
    147147        charfield_t *field =
    148148            chargrid_charfield_at(scrbuf, scrbuf->col, scrbuf->row);
    149        
     149
    150150        field->ch = ch;
    151151        field->attrs = scrbuf->attrs;
    152152        field->flags |= CHAR_FLAG_DIRTY;
    153        
     153
    154154        if (update) {
    155155                scrbuf->col++;
    156156                return chargrid_update_cols(scrbuf);
    157157        }
    158        
     158
    159159        return 1;
    160160}
     
    173173        assert(scrbuf->col < scrbuf->cols);
    174174        assert(scrbuf->row < scrbuf->rows);
    175        
     175
    176176        scrbuf->col = 0;
    177177        scrbuf->row++;
    178        
     178
    179179        return chargrid_update_rows(scrbuf);
    180180}
     
    194194        assert(scrbuf->col < scrbuf->cols);
    195195        assert(scrbuf->row < scrbuf->rows);
    196        
     196
    197197        sysarg_t spaces = tab_size - scrbuf->cols % tab_size;
    198198        sysarg_t flush = 1;
    199        
     199
    200200        for (sysarg_t i = 0; i < spaces; i++)
    201201                flush += chargrid_putchar(scrbuf, ' ', true) - 1;
    202        
     202
    203203        return flush;
    204204}
     
    220220        assert(scrbuf->col < scrbuf->cols);
    221221        assert(scrbuf->row < scrbuf->rows);
    222        
     222
    223223        if ((scrbuf->col == 0) && (scrbuf->row == 0))
    224224                return 0;
    225        
     225
    226226        if (scrbuf->col == 0) {
    227227                scrbuf->col = scrbuf->cols - 1;
    228228                scrbuf->row--;
    229                
     229
    230230                chargrid_putchar(scrbuf, ' ', false);
    231231                return 2;
    232232        }
    233        
     233
    234234        scrbuf->col--;
    235235        chargrid_putchar(scrbuf, ' ', false);
     
    249249                scrbuf->data[pos].flags = CHAR_FLAG_DIRTY;
    250250        }
    251        
     251
    252252        scrbuf->col = 0;
    253253        scrbuf->row = 0;
     
    284284        assert(col);
    285285        assert(row);
    286        
     286
    287287        *col = scrbuf->col;
    288288        *row = scrbuf->row;
     
    305305                charfield_t *field =
    306306                    chargrid_charfield_at(scrbuf, col, row);
    307                
     307
    308308                field->ch = 0;
    309309                field->attrs = scrbuf->attrs;
Note: See TracChangeset for help on using the changeset viewer.