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

    r3061bc1 ra35b458  
    7979        bool check_enabled = true;
    8080        bool progress = true;
    81        
     81
    8282        if (argc < 2) {
    8383                printf(NAME ": Error, argument missing.\n");
     
    8585                return 1;
    8686        }
    87        
     87
    8888        /* Skip program name */
    8989        --argc; ++argv;
    90        
     90
    9191        if (argc > 0 && str_cmp(*argv, "--no-check") == 0) {
    9292                check_enabled = false;
    9393                --argc; ++argv;
    9494        }
    95        
     95
    9696        if (argc > 0 && str_cmp(*argv, "--no-progress") == 0) {
    9797                progress = false;
    9898                --argc; ++argv;
    9999        }
    100        
     100
    101101        if (argc != 1) {
    102102                printf(NAME ": Error, unexpected argument.\n");
     
    104104                return 1;
    105105        }
    106        
     106
    107107        file_name = *argv;
    108        
     108
    109109        buf = calloc(BUFELEMS, sizeof(uint64_t));
    110110        if (buf == NULL) {
     
    112112                return 1;
    113113        }
    114        
     114
    115115        file = fopen(file_name, "r");
    116116        if (file == NULL) {
     
    118118                return 1;
    119119        }
    120        
     120
    121121        expected = 0;
    122122        offset = 0;
     
    127127        gettimeofday(&start_time, NULL);
    128128        prev_time = start_time;
    129        
     129
    130130        while (!feof(file)) {
    131131                size_t elems = fread(buf, sizeof(uint64_t), BUFELEMS, file);
     
    136136                        return 1;
    137137                }
    138                
     138
    139139                for (i = 0; i < elems; i++) {
    140140                        if (check_enabled && uint64_t_le2host(buf[i]) != expected) {
     
    147147                        offset += sizeof(uint64_t);
    148148                }
    149                
     149
    150150                if (progress && offset >= next_mark) {
    151151                        struct timeval cur_time;
    152152                        gettimeofday(&cur_time, NULL);
    153                        
     153
    154154                        uint32_t last_run = cur_time.tv_sec - prev_time.tv_sec;
    155155                        uint32_t total_time = cur_time.tv_sec - start_time.tv_sec;
     
    166166                }
    167167        }
    168        
     168
    169169        struct timeval final_time;
    170170        gettimeofday(&final_time, NULL);
    171        
     171
    172172        uint32_t total_run_time = final_time.tv_sec - start_time.tv_sec;
    173173        if (total_run_time > 0) {
     
    178178                    offset/total_run_time);
    179179        }
    180        
     180
    181181        fclose(file);
    182182        free(buf);
Note: See TracChangeset for help on using the changeset viewer.