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

    r3061bc1 ra35b458  
    106106                }
    107107        }
    108        
     108
    109109        return true;
    110110}
     
    120120        load_t *load = stats_get_load(&count);
    121121        load_t load_val;
    122        
     122
    123123        if ((load != NULL) && (count > 0)) {
    124124                load_val = load[0];
     
    126126        } else
    127127                load_val = 0;
    128        
     128
    129129        return load_val;
    130130}
     
    138138         * a lower threshold.
    139139         */
    140        
     140
    141141        suseconds_t delta = 1000000 / fps;
    142142        load_t load = get_load();
    143        
     143
    144144        if ((delta >= render_time) && (load < MIN_LOAD))
    145145                fps++;
    146        
     146
    147147        if (fps > MAX_FPS)
    148148                fps = MAX_FPS;
    149        
     149
    150150        /*
    151151         * If we lack behind then immediately
    152152         * go to the lowest FPS.
    153153         */
    154        
     154
    155155        if (delta < render_time)
    156156                fps = MIN_FPS;
    157        
     157
    158158        /*
    159159         * Crank down the FPS if the current
    160160         * load is above an upper threshold.
    161161         */
    162        
     162
    163163        if (load > MAX_LOAD)
    164164                fps--;
    165        
     165
    166166        if (fps < MIN_FPS)
    167167                fps = MIN_FPS;
    168        
     168
    169169        delta = 1000000 / fps;
    170        
     170
    171171        fibril_timer_set(frame_timer, delta, frame_timer_callback, NULL);
    172172}
     
    175175{
    176176        pixel_t next_led_color = led_colors[led_color];
    177        
     177
    178178        led_color++;
    179179        if (led_color >= LED_COLORS)
    180180                led_color = 0;
    181        
     181
    182182        list_foreach(led_devs, link, led_dev_t, dev) {
    183183                if (dev->sess)
    184184                        led_dev_color_set(dev->sess, next_led_color);
    185185        }
    186        
     186
    187187        plan_led_timer();
    188188}
     
    192192        struct timeval prev;
    193193        getuptime(&prev);
    194        
     194
    195195        frame++;
    196196        if (frame >= FRAMES)
    197197                frame = 0;
    198        
     198
    199199        update_canvas(frame_canvas, frames[frame]);
    200        
     200
    201201        struct timeval cur;
    202202        getuptime(&cur);
    203        
     203
    204204        plan_frame_timer(tv_sub_diff(&cur, &prev));
    205205}
     
    211211        if (rc != EOK)
    212212                return;
    213        
     213
    214214        service_id_t *svcs;
    215215        size_t count;
     
    217217        if (rc != EOK)
    218218                return;
    219        
     219
    220220        for (size_t i = 0; i < count; i++) {
    221221                bool known = false;
    222                
     222
    223223                /* Determine whether we already know this device. */
    224224                list_foreach(led_devs, link, led_dev_t, dev) {
     
    228228                        }
    229229                }
    230                
     230
    231231                if (!known) {
    232232                        led_dev_t *dev = (led_dev_t *) calloc(1, sizeof(led_dev_t));
    233233                        if (!dev)
    234234                                continue;
    235                        
     235
    236236                        link_initialize(&dev->link);
    237237                        dev->svc_id = svcs[i];
    238238                        dev->sess = loc_service_connect(svcs[i], INTERFACE_DDF, 0);
    239                        
     239
    240240                        list_append(&dev->link, &led_devs);
    241241                }
    242242        }
    243        
     243
    244244        // FIXME: Handle LED device removal
    245        
     245
    246246        free(svcs);
    247247}
     
    253253                return 1;
    254254        }
    255        
     255
    256256        list_initialize(&led_devs);
    257257        errno_t rc = loc_register_cat_change_cb(loc_callback);
     
    260260                return 1;
    261261        }
    262        
     262
    263263        led_timer = fibril_timer_create(NULL);
    264264        if (!led_timer) {
     
    266266                return 1;
    267267        }
    268        
     268
    269269        frame_timer = fibril_timer_create(NULL);
    270270        if (!frame_timer) {
     
    272272                return 1;
    273273        }
    274        
     274
    275275        if (!decode_frames())
    276276                return 1;
    277        
     277
    278278        winreg = argv[1];
    279279        window_t *main_window = window_open(argv[1], NULL,
     
    283283                return 1;
    284284        }
    285        
     285
    286286        frame_canvas = create_canvas(window_root(main_window), NULL,
    287287            FRAME_WIDTH, FRAME_HEIGHT, frames[frame]);
    288        
     288
    289289        if (!frame_canvas) {
    290290                window_close(main_window);
     
    292292                return 1;
    293293        }
    294        
     294
    295295        window_resize(main_window, 0, 0, FRAME_WIDTH + 8, FRAME_HEIGHT + 28,
    296296            WINDOW_PLACEMENT_RIGHT | WINDOW_PLACEMENT_BOTTOM);
    297297        window_exec(main_window);
    298        
     298
    299299        plan_led_timer();
    300300        plan_frame_timer(0);
    301        
     301
    302302        task_retval(0);
    303303        async_manager();
    304        
     304
    305305        return 0;
    306306}
Note: See TracChangeset for help on using the changeset viewer.