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

    r3061bc1 ra35b458  
    5858#ifdef CONFIG_SYMTAB
    5959        size_t i;
    60        
     60
    6161        for (i = 1; symbol_table[i].address_le; i++) {
    6262                if (addr < uint64_t_le2host(symbol_table[i].address_le))
    6363                        break;
    6464        }
    65        
     65
    6666        if (addr >= uint64_t_le2host(symbol_table[i - 1].address_le)) {
    6767                *name = symbol_table[i - 1].symbol_name;
     
    7171                return EOK;
    7272        }
    73        
     73
    7474        *name = NULL;
    7575        return ENOENT;
    76        
     76
    7777#else
    7878        *name = NULL;
     
    9797        const char *name;
    9898        errno_t rc = symtab_name_lookup(addr, &name, NULL);
    99        
     99
    100100        switch (rc) {
    101101        case EOK:
     
    121121{
    122122        size_t namelen = str_length(name);
    123        
     123
    124124        size_t pos;
    125125        for (pos = *startpos; symbol_table[pos].address_le; pos++) {
    126126                const char *curname = symbol_table[pos].symbol_name;
    127                
     127
    128128                /* Find a ':' in curname */
    129129                const char *colon = str_chr(curname, ':');
    130130                if (colon == NULL)
    131131                        continue;
    132                
     132
    133133                if (str_length(curname) < namelen)
    134134                        continue;
    135                
     135
    136136                if (str_lcmp(name, curname, namelen) == 0) {
    137137                        *startpos = pos;
     
    139139                }
    140140        }
    141        
     141
    142142        return NULL;
    143143}
     
    162162        size_t pos = 0;
    163163        const char *hint;
    164        
     164
    165165        while ((hint = symtab_search_one(name, &pos))) {
    166166                if (str_length(hint) == 0) {
     
    170170                pos++;
    171171        }
    172        
     172
    173173        if (found > 1)
    174174                return EOVERFLOW;
    175        
     175
    176176        if (found < 1)
    177177                return ENOENT;
    178        
     178
    179179        return EOK;
    180        
     180
    181181#else
    182182        return ENOTSUP;
     
    195195                pos++;
    196196        }
    197        
     197
    198198#else
    199199        printf("No symbol information available.\n");
     
    208208        size_t len = str_length(input);
    209209        struct symtab_entry **entry = (struct symtab_entry**)ctx;
    210        
     210
    211211        if (*entry == NULL)
    212212                *entry = symbol_table;
    213        
     213
    214214        for (; (*entry)->address_le; (*entry)++) {
    215215                const char *curname = (*entry)->symbol_name;
    216                
     216
    217217                /* Find a ':' in curname */
    218218                const char *colon = str_chr(curname, ':');
    219219                if (colon == NULL)
    220220                        continue;
    221                
     221
    222222                if (str_length(curname) < len)
    223223                        continue;
    224                
     224
    225225                if (str_lcmp(input, curname, len) == 0) {
    226226                        (*entry)++;
     
    230230                }
    231231        }
    232        
     232
    233233        return NULL;
    234        
     234
    235235#else
    236236        return NULL;
Note: See TracChangeset for help on using the changeset viewer.