Changeset a35b458 in mainline for uspace/app/bnchmark


Ignore:
Timestamp:
2018-03-02T20:10:49Z (8 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/bnchmark/bnchmark.c

    r3061bc1 ra35b458  
    6464        struct timeval start_time;
    6565        gettimeofday(&start_time, NULL);
    66        
     66
    6767        errno_t rc = fn(data);
    6868        if (rc != EOK) {
     
    7070                return rc;
    7171        }
    72        
     72
    7373        struct timeval final_time;
    7474        gettimeofday(&final_time, NULL);
    75        
     75
    7676        /* Calculate time difference in milliseconds */
    7777        *result = ((final_time.tv_usec - start_time.tv_usec) / 1000) +
     
    8484        char *path = (char *) data;
    8585        char *buf = malloc(BUFSIZE);
    86        
     86
    8787        if (buf == NULL)
    8888                return ENOMEM;
    89        
     89
    9090        FILE *file = fopen(path, "r");
    9191        if (file == NULL) {
     
    9494                return EIO;
    9595        }
    96        
     96
    9797        while (!feof(file)) {
    9898                fread(buf, 1, BUFSIZE, file);
     
    104104                }
    105105        }
    106        
     106
    107107        fclose(file);
    108108        free(buf);
     
    113113{
    114114        char *path = (char *) data;
    115        
     115
    116116        DIR *dir = opendir(path);
    117117        if (dir == NULL) {
     
    121121
    122122        struct dirent *dp;
    123        
     123
    124124        while ((dp = readdir(dir))) {
    125125                /* Do nothing */
    126126        }
    127        
     127
    128128        closedir(dir);
    129129        return EOK;
     
    141141        char *test_type = NULL;
    142142        char *endptr;
    143        
     143
    144144        if (argc < 5) {
    145145                fprintf(stderr, NAME ": Error, argument missing.\n");
     
    147147                return 1;
    148148        }
    149        
     149
    150150        if (argc > 5) {
    151151                fprintf(stderr, NAME ": Error, too many arguments.\n");
     
    153153                return 1;
    154154        }
    155        
     155
    156156        // Skip program name
    157157        --argc; ++argv;
     
    163163                return 1;
    164164        }
    165        
     165
    166166        --argc; ++argv;
    167167        test_type = *argv;
     
    172172        --argc; ++argv;
    173173        path = *argv;
    174        
     174
    175175        if (str_cmp(test_type, "sequential-file-read") == 0) {
    176176                fn = sequential_read_file;
     
    191191                        return 1;
    192192                }
    193        
     193
    194194                printf("%s;%s;%s;%lu;ms\n", test_type, path, log_str, milliseconds_taken);
    195195        }
Note: See TracChangeset for help on using the changeset viewer.