Changeset a35b458 in mainline for kernel/genarch/src/srln/srln.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
  • kernel/genarch/src/srln/srln.c

    r3061bc1 ra35b458  
    5353        bool cr = false;
    5454        uint32_t escape = 0;
    55        
     55
    5656        while (true) {
    5757                wchar_t ch = indev_pop_character(&instance->raw);
    58                
     58
    5959                /* ANSI escape sequence processing */
    6060                if (escape != 0) {
    6161                        escape <<= 8;
    6262                        escape |= ch & 0xff;
    63                        
     63
    6464                        if ((escape == 0x1b4f) || (escape == 0x1b5b) || (escape == 0x1b5b33))
    6565                                continue;
    66                        
     66
    6767                        switch (escape) {
    6868                        case 0x1b4f46:
     
    100100                        }
    101101                }
    102                
     102
    103103                if (ch == 0x1b) {
    104104                        escape = ch & 0xff;
    105105                        continue;
    106106                }
    107                
     107
    108108                /* Replace carriage return with line feed
    109109                   and suppress any following line feed */
     
    112112                        continue;
    113113                }
    114                
     114
    115115                if (ch == '\r') {
    116116                        ch = '\n';
     
    118118                } else
    119119                        cr = false;
    120                
     120
    121121                /* Backspace */
    122122                if (ch == 0x7f)
    123123                        ch = '\b';
    124                
     124
    125125                indev_push_character(instance->sink, ch);
    126126        }
     
    134134                instance->thread = thread_create(ksrln, (void *) instance,
    135135                    TASK, THREAD_FLAG_NONE, "ksrln");
    136                
     136
    137137                if (!instance->thread) {
    138138                        free(instance);
    139139                        return NULL;
    140140                }
    141                
     141
    142142                instance->sink = NULL;
    143143                indev_initialize("srln", &instance->raw, &srln_raw_ops);
    144144        }
    145        
     145
    146146        return instance;
    147147}
     
    151151        assert(instance);
    152152        assert(sink);
    153        
     153
    154154        instance->sink = sink;
    155155        thread_ready(instance->thread);
    156        
     156
    157157        return &instance->raw;
    158158}
Note: See TracChangeset for help on using the changeset viewer.