Changeset a35b458 in mainline for uspace/app/sysinfo/sysinfo.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/app/sysinfo/sysinfo.c

    r3061bc1 ra35b458  
    5454{
    5555        size_t offset = 0;
    56        
     56
    5757        while (offset < size) {
    5858                wchar_t c = str_decode(data, &offset, size);
     
    6969                return rc;
    7070        }
    71        
     71
    7272        printf("%s -> %" PRIu64 " (0x%" PRIx64 ")\n", ipath,
    7373            (uint64_t) value, (uint64_t) value);
    74        
     74
    7575        return EOK;
    7676}
     
    8484                return -1;
    8585        }
    86        
     86
    8787        printf("%s -> ", ipath);
    8888        dump_bytes_hex(data, size);
     
    9090        dump_bytes_text(data, size);
    9191        fputs("')\n", stdout);
    92        
     92
    9393        return EOK;
    9494}
     
    103103                return -1;
    104104        }
    105        
     105
    106106        printf("%s property %s -> ", ipath, iprop);
    107107        dump_bytes_hex(data, size);
     
    109109        dump_bytes_text(data, size);
    110110        fputs("')\n", stdout);
    111        
     111
    112112        return EOK;
    113113}
     
    125125        if ((keys == NULL) || (size == 0))
    126126                return;
    127        
     127
    128128        size_t pos = 0;
    129129        while (pos < size) {
     
    132132                if (keys[pos + cur_size] != 0)
    133133                        break;
    134                
     134
    135135                size_t path_size = str_size(path) + cur_size + 2;
    136136                char *cur_path = (char *) malloc(path_size);
    137137                if (cur_path == NULL)
    138138                        break;
    139                
     139
    140140                size_t length;
    141                
     141
    142142                if (path[0] != 0) {
    143143                        print_spaces(spaces);
    144144                        printf(".%s\n", keys + pos);
    145145                        length = str_length(keys + pos) + 1;
    146                        
     146
    147147                        snprintf(cur_path, path_size, "%s.%s", path, keys + pos);
    148148                } else {
    149149                        printf("%s\n", keys + pos);
    150150                        length = str_length(keys + pos);
    151                        
     151
    152152                        snprintf(cur_path, path_size, "%s", keys + pos);
    153153                }
    154                
     154
    155155                print_keys(cur_path, spaces + length);
    156                
     156
    157157                free(cur_path);
    158158                pos += cur_size + 1;
    159159        }
    160        
     160
    161161        free(keys);
    162162}
     
    165165{
    166166        int rc = 0;
    167        
     167
    168168        if (argc < 2) {
    169169                /* Print keys */
     
    171171                return rc;
    172172        }
    173        
     173
    174174        char *ipath = argv[1];
    175        
     175
    176176        if (argc < 3) {
    177177                sysinfo_item_val_type_t tag = sysinfo_get_val_type(ipath);
    178                
     178
    179179                switch (tag) {
    180180                case SYSINFO_VAL_UNDEFINED:
     
    194194                        break;
    195195                }
    196                
     196
    197197                return rc;
    198198        }
    199        
     199
    200200        char *iprop = argv[2];
    201201        rc = print_item_property(ipath, iprop);
Note: See TracChangeset for help on using the changeset viewer.