Changeset a35b458 in mainline for uspace/lib/c/generic/stats.c


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

    r3061bc1 ra35b458  
    7070        stats_cpu_t *stats_cpus =
    7171            (stats_cpu_t *) sysinfo_get_data("system.cpus", &size);
    72        
     72
    7373        if ((size % sizeof(stats_cpu_t)) != 0) {
    7474                if (stats_cpus != NULL)
     
    7777                return NULL;
    7878        }
    79        
     79
    8080        *count = size / sizeof(stats_cpu_t);
    8181        return stats_cpus;
     
    9595        stats_physmem_t *stats_physmem =
    9696            (stats_physmem_t *) sysinfo_get_data("system.physmem", &size);
    97        
     97
    9898        if (size != sizeof(stats_physmem_t)) {
    9999                if (stats_physmem != NULL)
     
    101101                return NULL;
    102102        }
    103        
     103
    104104        return stats_physmem;
    105105}
     
    119119        stats_task_t *stats_tasks =
    120120            (stats_task_t *) sysinfo_get_data("system.tasks", &size);
    121        
     121
    122122        if ((size % sizeof(stats_task_t)) != 0) {
    123123                if (stats_tasks != NULL)
     
    126126                return NULL;
    127127        }
    128        
     128
    129129        *count = size / sizeof(stats_task_t);
    130130        return stats_tasks;
     
    144144        char name[SYSINFO_STATS_MAX_PATH];
    145145        snprintf(name, SYSINFO_STATS_MAX_PATH, "system.tasks.%" PRIu64, task_id);
    146        
     146
    147147        size_t size = 0;
    148148        stats_task_t *stats_task =
    149149            (stats_task_t *) sysinfo_get_data(name, &size);
    150        
     150
    151151        if (size != sizeof(stats_task_t)) {
    152152                if (stats_task != NULL)
     
    154154                return NULL;
    155155        }
    156        
     156
    157157        return stats_task;
    158158}
     
    172172        stats_thread_t *stats_threads =
    173173            (stats_thread_t *) sysinfo_get_data("system.threads", &size);
    174        
     174
    175175        if ((size % sizeof(stats_thread_t)) != 0) {
    176176                if (stats_threads != NULL)
     
    179179                return NULL;
    180180        }
    181        
     181
    182182        *count = size / sizeof(stats_thread_t);
    183183        return stats_threads;
     
    197197        char name[SYSINFO_STATS_MAX_PATH];
    198198        snprintf(name, SYSINFO_STATS_MAX_PATH, "system.threads.%" PRIu64, thread_id);
    199        
     199
    200200        size_t size = 0;
    201201        stats_thread_t *stats_thread =
    202202            (stats_thread_t *) sysinfo_get_data(name, &size);
    203        
     203
    204204        if (size != sizeof(stats_thread_t)) {
    205205                if (stats_thread != NULL)
     
    207207                return NULL;
    208208        }
    209        
     209
    210210        return stats_thread;
    211211}
     
    225225        stats_exc_t *stats_exceptions =
    226226            (stats_exc_t *) sysinfo_get_data("system.exceptions", &size);
    227        
     227
    228228        if ((size % sizeof(stats_exc_t)) != 0) {
    229229                if (stats_exceptions != NULL)
     
    232232                return NULL;
    233233        }
    234        
     234
    235235        *count = size / sizeof(stats_exc_t);
    236236        return stats_exceptions;
     
    250250        char name[SYSINFO_STATS_MAX_PATH];
    251251        snprintf(name, SYSINFO_STATS_MAX_PATH, "system.exceptions.%u", excn);
    252        
     252
    253253        size_t size = 0;
    254254        stats_exc_t *stats_exception =
    255255            (stats_exc_t *) sysinfo_get_data(name, &size);
    256        
     256
    257257        if (size != sizeof(stats_exc_t)) {
    258258                if (stats_exception != NULL)
     
    260260                return NULL;
    261261        }
    262        
     262
    263263        return stats_exception;
    264264}
     
    278278        load_t *load =
    279279            (load_t *) sysinfo_get_data("system.load", &size);
    280        
     280
    281281        if ((size % sizeof(load_t)) != 0) {
    282282                if (load != NULL)
     
    285285                return NULL;
    286286        }
    287        
     287
    288288        *count = size / sizeof(load_t);
    289289        return load;
     
    303303        /* Print the whole part */
    304304        printf("%u.", upper / LOAD_UNIT);
    305        
     305
    306306        load_t rest = (upper % LOAD_UNIT) * 10;
    307        
     307
    308308        unsigned int i;
    309309        for (i = 0; i < dec_length; i++) {
     
    317317        if (state <= Lingering)
    318318                return thread_states[state];
    319        
     319
    320320        return thread_states[Invalid];
    321321}
Note: See TracChangeset for help on using the changeset viewer.