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

    r3061bc1 ra35b458  
    7272{
    7373        link_t *link;
    74        
     74
    7575        while ((link = list_first(&mem_blocks)) != NULL) {
    7676                mem_block_t *block = list_get_instance(link, mem_block_t, link);
    7777                free_block(block);
    7878        }
    79        
     79
    8080        while ((link = list_first(&mem_areas)) != NULL) {
    8181                mem_area_t *area = list_get_instance(link, mem_area_t, link);
     
    8989        uint8_t *mbeg = (uint8_t *) block;
    9090        uint8_t *mend = (uint8_t *) block + sizeof(mem_block_t);
    91        
     91
    9292        /* Entry block memory <bbeg, bend) */
    9393        uint8_t *bbeg = (uint8_t *) block->addr;
    9494        uint8_t *bend = (uint8_t *) block->addr + block->size;
    95        
     95
    9696        /* Data block <dbeg, dend) */
    9797        uint8_t *dbeg = (uint8_t *) addr;
    9898        uint8_t *dend = (uint8_t *) addr + size;
    99        
     99
    100100        /* Check for overlaps */
    101101        if (((mbeg >= dbeg) && (mbeg < dend)) ||
     
    104104            ((bend > dbeg) && (bend <= dend)))
    105105                return true;
    106        
     106
    107107        return false;
    108108}
     
    122122{
    123123        bool fnd = false;
    124        
     124
    125125        list_foreach(mem_blocks, link, mem_block_t, block) {
    126126                if (overlap_match(block, addr, size)) {
     
    129129                }
    130130        }
    131        
     131
    132132        return fnd;
    133133}
     
    160160{
    161161        void *data;
    162        
     162
    163163        /* Allocate the chunk of memory */
    164164        data = malloc(size);
     
    166166        if (data == NULL)
    167167                return NULL;
    168        
     168
    169169        /* Check for overlaps with other chunks */
    170170        if (test_overlap(data, size)) {
     
    174174                error_flag = true;
    175175        }
    176        
     176
    177177        return data;
    178178}
     
    197197        if (mem_allocated >= MAX_ALLOC)
    198198                return NULL;
    199        
     199
    200200        /* Allocate the block holder */
    201201        mem_block_t *block =
     
    203203        if (block == NULL)
    204204                return NULL;
    205        
     205
    206206        link_initialize(&block->link);
    207        
     207
    208208        /* Allocate the block memory */
    209209        block->addr = checked_malloc(size);
     
    213213                return NULL;
    214214        }
    215        
     215
    216216        block->size = size;
    217        
     217
    218218        /* Register the allocated block */
    219219        list_append(&block->link, &mem_blocks);
    220220        mem_allocated += size + sizeof(mem_block_t);
    221221        mem_blocks_count++;
    222        
     222
    223223        return block;
    224224}
     
    238238        mem_allocated -= block->size + sizeof(mem_block_t);
    239239        mem_blocks_count--;
    240        
     240
    241241        /* Free the memory */
    242242        free(block->addr);
     
    272272            pos < end; pos++)
    273273                *pos = block_expected_value(block, pos);
    274        
     274
    275275        check_consistency("fill_block");
    276276}
     
    308308        if (mem_blocks_count == 0)
    309309                return NULL;
    310        
     310
    311311        unsigned long idx = rand() % mem_blocks_count;
    312312        link_t *entry = list_nth(&mem_blocks, idx);
    313        
     313
    314314        if (entry == NULL) {
    315315                TPRINTF("\nError: Corrupted list of allocated memory blocks.\n");
     
    317317                error_flag = true;
    318318        }
    319        
     319
    320320        return list_get_instance(entry, mem_block_t, link);
    321321}
     
    337337        if (area == NULL)
    338338                return NULL;
    339        
     339
    340340        link_initialize(&area->link);
    341        
     341
    342342        area->addr = as_area_create(AS_AREA_ANY, size,
    343343            AS_AREA_WRITE | AS_AREA_READ | AS_AREA_CACHEABLE,
     
    348348                return NULL;
    349349        }
    350        
     350
    351351        area->size = size;
    352        
     352
    353353        /* Register the allocated area */
    354354        list_append(&area->link, &mem_areas);
    355        
     355
    356356        return area;
    357357}
     
    369369        /* Unregister the area */
    370370        list_remove(&area->link);
    371        
     371
    372372        /* Free the memory */
    373373        errno_t ret = as_area_destroy(area->addr);
    374374        if (ret != EOK)
    375375                error_flag = true;
    376        
     376
    377377        free(area);
    378378        check_consistency("unmap_area");
     
    405405            pos < end; pos++)
    406406                *pos = area_expected_value(area, pos);
    407        
     407
    408408        check_consistency("fill_area");
    409409}
Note: See TracChangeset for help on using the changeset viewer.