Changeset a35b458 in mainline for kernel/generic/src/console/console.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/generic/src/console/console.c

    r3061bc1 ra35b458  
    119119                stdin = &stdin_sink;
    120120        }
    121        
     121
    122122        return stdin;
    123123}
     
    143143                stdout = &stdout_source;
    144144        }
    145        
     145
    146146        list_append(&outdev->link, &stdout->list);
    147147}
     
    189189{
    190190        void *faddr = (void *) KA2PA(kio);
    191        
     191
    192192        assert((uintptr_t) faddr % FRAME_SIZE == 0);
    193        
     193
    194194        kio_parea.pbase = (uintptr_t) faddr;
    195195        kio_parea.frames = SIZE2FRAMES(sizeof(kio));
     
    197197        kio_parea.mapped = false;
    198198        ddi_parea_register(&kio_parea);
    199        
     199
    200200        sysinfo_set_item_val("kio.faddr", NULL, (sysarg_t) faddr);
    201201        sysinfo_set_item_val("kio.pages", NULL, KIO_PAGES);
    202        
     202
    203203        event_set_unmask_callback(EVENT_KIO, kio_update);
    204204        atomic_set(&kio_inited, true);
     
    209209        event_notify_1(EVENT_KCONSOLE, false, true);
    210210        bool prev = console_override;
    211        
     211
    212212        console_override = true;
    213213        if ((stdout) && (stdout->op->redraw))
    214214                stdout->op->redraw(stdout);
    215        
     215
    216216        if ((stdin) && (!prev)) {
    217217                /*
     
    256256        size_t count = 0;
    257257        buf[offset] = 0;
    258        
     258
    259259        wchar_t ch;
    260260        while ((ch = indev_pop_character(indev)) != '\n') {
     
    265265                                putchar(' ');
    266266                                putchar('\b');
    267                                
     267
    268268                                count--;
    269269                                offset = str_lsize(buf, count);
     
    271271                        }
    272272                }
    273                
     273
    274274                if (chr_encode(ch, buf, &offset, buflen - 1) == EOK) {
    275275                        putchar(ch);
     
    278278                }
    279279        }
    280        
     280
    281281        return count;
    282282}
     
    294294        if (!atomic_get(&kio_inited))
    295295                return;
    296        
     296
    297297        spinlock_lock(&kio_lock);
    298        
     298
    299299        if (kio_uspace > 0) {
    300300                if (event_notify_3(EVENT_KIO, true, kio_start, kio_len,
     
    302302                        kio_uspace = 0;
    303303        }
    304        
     304
    305305        spinlock_unlock(&kio_lock);
    306306}
     
    312312{
    313313        bool ordy = ((stdout) && (stdout->op->write));
    314        
     314
    315315        if (!ordy)
    316316                return;
     
    347347        else
    348348                kio_start = (kio_start + 1) % KIO_LENGTH;
    349        
     349
    350350        if (kio_stored < kio_len)
    351351                kio_stored++;
    352        
     352
    353353        /* The character is stored for uspace */
    354354        if (kio_uspace < kio_len)
     
    359359{
    360360        bool ordy = ((stdout) && (stdout->op->write));
    361        
     361
    362362        spinlock_lock(&kio_lock);
    363363        kio_push_char(ch);
    364364        spinlock_unlock(&kio_lock);
    365        
     365
    366366        /* Output stored characters */
    367367        kio_flush();
    368        
     368
    369369        if (!ordy) {
    370370                /*
     
    380380                early_putchar(ch);
    381381        }
    382        
     382
    383383        /* Force notification on newline */
    384384        if (ch == '\n')
     
    409409        if (size > PAGE_SIZE)
    410410                return (sys_errno_t) ELIMIT;
    411        
     411
    412412        if (size > 0) {
    413413                data = (char *) malloc(size + 1, 0);
    414414                if (!data)
    415415                        return (sys_errno_t) ENOMEM;
    416                
     416
    417417                rc = copy_from_uspace(data, buf, size);
    418418                if (rc) {
     
    421421                }
    422422                data[size] = 0;
    423                
     423
    424424                switch (cmd) {
    425425                case KIO_WRITE:
Note: See TracChangeset for help on using the changeset viewer.