Changeset a35b458 in mainline for kernel/test/mm/slab1.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/test/mm/slab1.c

    r3061bc1 ra35b458  
    4242        slab_cache_t *cache;
    4343        int i;
    44        
     44
    4545        TPRINTF("Creating cache, object size: %d.\n", size);
    46        
     46
    4747        cache = slab_cache_create("test_cache", size, 0, NULL, NULL,
    4848            SLAB_CACHE_NOMAGAZINE);
    49        
     49
    5050        TPRINTF("Allocating %d items...", count);
    51        
     51
    5252        for (i = 0; i < count; i++) {
    5353                data[i] = slab_alloc(cache, 0);
    5454                memsetb(data[i], size, 0);
    5555        }
    56        
     56
    5757        TPRINTF("done.\n");
    58        
     58
    5959        TPRINTF("Freeing %d items...", count);
    60        
     60
    6161        for (i = 0; i < count; i++)
    6262                slab_free(cache, data[i]);
    63        
     63
    6464        TPRINTF("done.\n");
    65        
     65
    6666        TPRINTF("Allocating %d items...", count);
    67        
     67
    6868        for (i = 0; i < count; i++) {
    6969                data[i] = slab_alloc(cache, 0);
    7070                memsetb(data[i], size, 0);
    7171        }
    72        
     72
    7373        TPRINTF("done.\n");
    74        
     74
    7575        TPRINTF("Freeing %d items...", count / 2);
    76        
     76
    7777        for (i = count - 1; i >= count / 2; i--)
    7878                slab_free(cache, data[i]);
    79        
     79
    8080        TPRINTF("done.\n");
    81        
     81
    8282        TPRINTF("Allocating %d items...", count / 2);
    83        
     83
    8484        for (i = count / 2; i < count; i++) {
    8585                data[i] = slab_alloc(cache, 0);
    8686                memsetb(data[i], size, 0);
    8787        }
    88        
     88
    8989        TPRINTF("done.\n");
    90        
     90
    9191        TPRINTF("Freeing %d items...", count);
    92        
     92
    9393        for (i = 0; i < count; i++)
    9494                slab_free(cache, data[i]);
    95        
     95
    9696        TPRINTF("done.\n");
    97        
     97
    9898        slab_cache_destroy(cache);
    99        
     99
    100100        TPRINTF("Test complete.\n");
    101101}
     
    125125        int offs = (int) (sysarg_t) data;
    126126        int i, j;
    127        
     127
    128128        thread_detach(THREAD);
    129        
     129
    130130        TPRINTF("Starting thread #%" PRIu64 "...\n", THREAD->tid);
    131        
     131
    132132        for (j = 0; j < 10; j++) {
    133133                for (i = 0; i < THR_MEM_COUNT; i++)
     
    140140                        slab_free(thr_cache, thr_data[offs][i]);
    141141        }
    142        
     142
    143143        TPRINTF("Thread #%" PRIu64 " finished\n", THREAD->tid);
    144        
     144
    145145        semaphore_up(&thr_sem);
    146146}
     
    150150        thread_t *t;
    151151        int i;
    152        
     152
    153153        thr_cache = slab_cache_create("thread_cache", THR_MEM_SIZE, 0, NULL, NULL,
    154154            SLAB_CACHE_NOMAGAZINE);
    155        
     155
    156156        semaphore_initialize(&thr_sem, 0);
    157157        for (i = 0; i < THREADS; i++) {
     
    164164        for (i = 0; i < THREADS; i++)
    165165                semaphore_down(&thr_sem);
    166        
     166
    167167        slab_cache_destroy(thr_cache);
    168        
     168
    169169        TPRINTF("Test complete.\n");
    170170}
     
    174174        testsimple();
    175175        testthreads();
    176        
     176
    177177        return NULL;
    178178}
Note: See TracChangeset for help on using the changeset viewer.