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/device/hw_res_parsed.c

    r3061bc1 ra35b458  
    4343        assert(res);
    4444        assert((res->type == DMA_CHANNEL_8) || (res->type == DMA_CHANNEL_16));
    45        
     45
    4646        const unsigned channel = (res->type == DMA_CHANNEL_8) ?
    4747            res->res.dma_channel.dma8 : res->res.dma_channel.dma16;
    4848        const size_t count = out->dma_channels.count;
    4949        const int keep_duplicit = flags & HW_RES_KEEP_DUPLICIT;
    50        
     50
    5151        if (!keep_duplicit) {
    5252                for (size_t i = 0; i < count; ++i) {
     
    5555                }
    5656        }
    57        
     57
    5858        out->dma_channels.channels[count] = channel;
    5959        ++out->dma_channels.count;
     
    6464{
    6565        assert(res && (res->type == INTERRUPT));
    66        
     66
    6767        int irq = res->res.interrupt.irq;
    6868        size_t count = out->irqs.count;
    6969        int keep_duplicit = flags & HW_RES_KEEP_DUPLICIT;
    70        
     70
    7171        if (!keep_duplicit) {
    7272                for (size_t i = 0; i < count; i++) {
     
    7575                }
    7676        }
    77        
     77
    7878        out->irqs.irqs[count] = irq;
    7979        out->irqs.count++;
     
    105105
    106106        assert(res && (res->type == IO_RANGE));
    107        
     107
    108108        absolute = absolutize(res->res.io_range.address,
    109109            res->res.io_range.relative, win->io.base);
     
    112112        size = res->res.io_range.size;
    113113        endianness = res->res.io_range.endianness;
    114        
     114
    115115        if ((size == 0) && (!(flags & HW_RES_KEEP_ZERO_AREA)))
    116116                return;
    117        
     117
    118118        int keep_duplicit = flags & HW_RES_KEEP_DUPLICIT;
    119119        size_t count = out->io_ranges.count;
    120        
     120
    121121        if (!keep_duplicit) {
    122122                for (size_t i = 0; i < count; i++) {
     
    126126                        s_address = RNGABS(out->io_ranges.ranges[i]);
    127127                        s_size = RNGSZ(out->io_ranges.ranges[i]);
    128                        
     128
    129129                        if ((absolute == s_address) && (size == s_size))
    130130                                return;
    131131                }
    132132        }
    133        
     133
    134134        RNGABS(out->io_ranges.ranges[count]) = absolute;
    135135        RNGREL(out->io_ranges.ranges[count]) = relative;
     
    146146        uint64_t relative;
    147147        size_t size;
    148        
     148
    149149        assert(res && (res->type == MEM_RANGE));
    150        
     150
    151151        absolute = absolutize(res->res.mem_range.address,
    152152            res->res.mem_range.relative, win->mem.base);
     
    155155        size = res->res.mem_range.size;
    156156        endianness = res->res.mem_range.endianness;
    157        
     157
    158158        if ((size == 0) && (!(flags & HW_RES_KEEP_ZERO_AREA)))
    159159                return;
    160        
     160
    161161        int keep_duplicit = flags & HW_RES_KEEP_DUPLICIT;
    162162        size_t count = out->mem_ranges.count;
    163        
     163
    164164        if (!keep_duplicit) {
    165165                for (size_t i = 0; i < count; ++i) {
     
    169169                        s_address = RNGABS(out->mem_ranges.ranges[i]);;
    170170                        s_size = RNGSZ(out->mem_ranges.ranges[i]);
    171                        
     171
    172172                        if ((absolute == s_address) && (size == s_size))
    173173                                return;
    174174                }
    175175        }
    176        
     176
    177177        RNGABS(out->mem_ranges.ranges[count]) = absolute;
    178178        RNGREL(out->mem_ranges.ranges[count]) = relative;
     
    199199        if (!res || !out)
    200200                return EINVAL;
    201        
     201
    202202        size_t res_count = res->count;
    203203        hw_res_list_parsed_clean(out);
    204        
     204
    205205        out->irqs.irqs = calloc(res_count, sizeof(int));
    206206        out->dma_channels.channels = calloc(res_count, sizeof(int));
     
    212212                return ENOMEM;
    213213        }
    214        
     214
    215215        for (size_t i = 0; i < res_count; ++i) {
    216216                const hw_resource_t *resource = &res->resources[i];
    217                
     217
    218218                switch (resource->type) {
    219219                case INTERRUPT:
     
    235235                }
    236236        }
    237        
     237
    238238        return EOK;
    239239};
     
    261261        if (!hw_res_parsed)
    262262                return EBADMEM;
    263        
     263
    264264        hw_resource_list_t hw_resources;
    265265        hw_res_list_parsed_clean(hw_res_parsed);
     
    269269        if (rc != EOK)
    270270                return rc;
    271        
     271
    272272        rc = hw_res_get_resource_list(sess, &hw_resources);
    273273        if (rc != EOK)
     
    277277            flags);
    278278        hw_res_clean_resource_list(&hw_resources);
    279        
     279
    280280        return rc;
    281281};
Note: See TracChangeset for help on using the changeset viewer.