Changeset 1b20da0 in mainline for uspace/lib/c/generic


Ignore:
Timestamp:
2018-02-28T17:52:03Z (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:
3061bc1
Parents:
df6ded8
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-02-28 17:26:03)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-02-28 17:52:03)
Message:

style: Remove trailing whitespace on non-empty lines, in certain file types.

Command used: tools/srepl '\([^[:space:]]\)\s\+$' '\1' -- *.c *.h *.py *.sh *.s *.S *.ag

Location:
uspace/lib/c/generic
Files:
31 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/adt/hash_table.c

    rdf6ded8 r1b20da0  
    22 * Copyright (c) 2008 Jakub Jermar
    33 * Copyright (c) 2012 Adam Hraska
    4  * 
     4 *
    55 * All rights reserved.
    66 *
     
    3737/*
    3838 * This is an implementation of a generic resizable chained hash table.
    39  * 
    40  * The table grows to 2*n+1 buckets each time, starting at n == 89, 
     39 *
     40 * The table grows to 2*n+1 buckets each time, starting at n == 89,
    4141 * per Thomas Wang's recommendation:
    4242 * http://www.concentric.net/~Ttwang/tech/hashsize.htm
    43  * 
     43 *
    4444 * This policy produces prime table sizes for the first five resizes
    45  * and generally produces table sizes which are either prime or 
     45 * and generally produces table sizes which are either prime or
    4646 * have fairly large (prime/odd) divisors. Having a prime table size
    4747 * mitigates the use of suboptimal hash functions and distributes
     
    7979 * @param h        Hash table structure. Will be initialized by this call.
    8080 * @param init_size Initial desired number of hash table buckets. Pass zero
    81  *                 if you want the default initial size. 
     81 *                 if you want the default initial size.
    8282 * @param max_load The table is resized when the average load per bucket
    8383 *                 exceeds this number. Pass zero if you want the default.
     
    8686 *                 upon removal. equal() is optional if and only if
    8787 *                 hash_table_insert_unique() will never be invoked.
    88  *                 All other operations are mandatory. 
     88 *                 All other operations are mandatory.
    8989 *
    9090 * @return True on success
     
    210210 * @param h    Hash table.
    211211 * @param item Item to be inserted into the hash table.
    212  * 
    213  * @return False if such an item had already been inserted. 
     212 *
     213 * @return False if such an item had already been inserted.
    214214 * @return True if the inserted item was the only item with such a lookup key.
    215215 */
     
    225225        /* Check for duplicates. */
    226226        list_foreach(h->bucket[idx], link, ht_link_t, cur_link) {
    227                 /* 
    228                  * We could filter out items using their hashes first, but 
     227                /*
     228                 * We could filter out items using their hashes first, but
    229229                 * calling equal() might very well be just as fast.
    230230                 */
     
    255255
    256256        list_foreach(h->bucket[idx], link, ht_link_t, cur_link) {
    257                 /* 
    258                  * Is this is the item we are looking for? We could have first 
    259                  * checked if the hashes match but op->key_equal() may very well be 
     257                /*
     258                 * Is this is the item we are looking for? We could have first
     259                 * checked if the hashes match but op->key_equal() may very well be
    260260                 * just as fast as op->hash().
    261261                 */
     
    278278                assert(cur);
    279279                ht_link_t *cur_link = member_to_inst(cur, ht_link_t, link);
    280                 /* 
    281                  * Is this is the item we are looking for? We could have first 
    282                  * checked if the hashes match but op->equal() may very well be 
     280                /*
     281                 * Is this is the item we are looking for? We could have first
     282                 * checked if the hashes match but op->equal() may very well be
    283283                 * just as fast as op->hash().
    284284                 */
     
    299299 *             the hash table.
    300300 * @param keys Number of keys in the 'key' array.
    301  * 
     301 *
    302302 * @return Returns the number of removed items.
    303303 */
     
    343343 *
    344344 * @param h   Hash table.
    345  * @param f   Function to be applied. Return false if no more items 
     345 * @param f   Function to be applied. Return false if no more items
    346346 *            should be visited. The functor may only delete the supplied
    347  *            item. It must not delete the successor of the item passed 
     347 *            item. It must not delete the successor of the item passed
    348348 *            in the first argument.
    349349 * @param arg Argument to be passed to the function.
    350350 */
    351351void hash_table_apply(hash_table_t *h, bool (*f)(ht_link_t *, void *), void *arg)
    352 {       
     352{
    353353        assert(f);
    354354        assert(h && h->bucket);
     
    362362                list_foreach_safe(h->bucket[idx], cur, next) {
    363363                        ht_link_t *cur_link = member_to_inst(cur, ht_link_t, link);
    364                         /* 
    365                          * The next pointer had already been saved. f() may safely 
     364                        /*
     365                         * The next pointer had already been saved. f() may safely
    366366                         * delete cur (but not next!).
    367367                         */
     
    410410{
    411411        if (h->item_cnt <= h->full_item_cnt / 4 && HT_MIN_BUCKETS < h->bucket_cnt) {
    412                 /* 
    413                  * Keep the bucket_cnt odd (possibly also prime). 
     412                /*
     413                 * Keep the bucket_cnt odd (possibly also prime).
    414414                 * Shrink from 2n + 1 to n. Integer division discards the +1.
    415415                 */
     
    431431
    432432/** Allocates and rehashes items to a new table. Frees the old table. */
    433 static void resize(hash_table_t *h, size_t new_bucket_cnt) 
     433static void resize(hash_table_t *h, size_t new_bucket_cnt)
    434434{
    435435        assert(h && h->bucket);
  • uspace/lib/c/generic/adt/list.c

    rdf6ded8 r1b20da0  
    7979void list_splice(list_t *list, link_t *pos)
    8080{
    81         if (list_empty(list)) 
     81        if (list_empty(list))
    8282                return;
    8383       
  • uspace/lib/c/generic/adt/odict.c

    rdf6ded8 r1b20da0  
    10841084         * visit_tree(A->a), visit(A), visit(A->b). If key(A) < key(B),
    10851085         * we will first visit A, then while visiting all nodes with values
    1086          * between A and B we will not leave subtree A->b. 
     1086         * between A and B we will not leave subtree A->b.
    10871087         */
    10881088
  • uspace/lib/c/generic/async.c

    rdf6ded8 r1b20da0  
    10871087/** Unsubscribe from IRQ notification.
    10881088 *
    1089  * @param cap     IRQ capability handle. 
     1089 * @param cap     IRQ capability handle.
    10901090 *
    10911091 * @return Zero on success or an error code.
  • uspace/lib/c/generic/ddi.c

    rdf6ded8 r1b20da0  
    211211 *
    212212 * @param range I/O range to be enable.
    213  * @param virt  Virtual address for application's PIO operations. 
     213 * @param virt  Virtual address for application's PIO operations.
    214214 */
    215215errno_t pio_enable_range(addr_range_t *range, void **virt)
     
    257257        }
    258258
    259         return pio_enable((void *) addr, size, virt);   
     259        return pio_enable((void *) addr, size, virt);
    260260}
    261261
  • uspace/lib/c/generic/device/hw_res_parsed.c

    rdf6ded8 r1b20da0  
    268268        rc = pio_window_get(sess, &pio_window);
    269269        if (rc != EOK)
    270                 return rc; 
     270                return rc;
    271271       
    272272        rc = hw_res_get_resource_list(sess, &hw_resources);
  • uspace/lib/c/generic/device/pio_window.c

    rdf6ded8 r1b20da0  
    11/*
    2  * Copyright (c) 2013 Jakub Jermar 
     2 * Copyright (c) 2013 Jakub Jermar
    33 * All rights reserved.
    44 *
  • uspace/lib/c/generic/dlfcn.c

    rdf6ded8 r1b20da0  
    3030 * @brief
    3131 * @{
    32  */ 
     32 */
    3333/**
    3434 * @file
  • uspace/lib/c/generic/double_to_str.c

    rdf6ded8 r1b20da0  
    103103
    104104        /* Denote 32 bit parts of x a y as: x == a b, y == c d. Then:
    105          *        a  b   
     105         *        a  b
    106106         *  *     c  d
    107107         *  ----------
     
    126126        ret.exponent = x.exponent + y.exponent + significand_width;
    127127       
    128         return ret;                     
     128        return ret;
    129129}
    130130
     
    146146
    147147/** Returns the interval [low, high] of numbers that convert to binary val. */
    148 static void get_normalized_bounds(ieee_double_t val, fp_num_t *high, 
     148static void get_normalized_bounds(ieee_double_t val, fp_num_t *high,
    149149        fp_num_t *low, fp_num_t *val_dist)
    150150{
    151         /* 
     151        /*
    152152         * Only works if val comes directly from extract_ieee_double without
    153          * being manipulated in any way (eg it must not be normalized). 
     153         * being manipulated in any way (eg it must not be normalized).
    154154         */
    155155        assert(!is_normalized(val.pos_val));
     
    173173        *high = normalize(*high);
    174174
    175         /* 
     175        /*
    176176         * Lower bound may not be normalized if subtracting 1 unit
    177          * reset the most-significant bit to 0. 
     177         * reset the most-significant bit to 0.
    178178         */
    179179        low->significand = low->significand << (low->exponent - high->exponent);
    180180        low->exponent = high->exponent;
    181181
    182         val_dist->significand = 
     182        val_dist->significand =
    183183                val_dist->significand << (val_dist->exponent - high->exponent);
    184184        val_dist->exponent = high->exponent;
    185185}
    186186
    187 /** Determines the interval of numbers that have the binary representation 
     187/** Determines the interval of numbers that have the binary representation
    188188 *  of val.
    189  * 
     189 *
    190190 * Numbers in the range [scaled_upper_bound - bounds_delta, scaled_upper_bound]
    191  * have the same double binary representation as val. 
     191 * have the same double binary representation as val.
    192192 *
    193193 * Bounds are scaled by 10^scale so that alpha <= exponent <= gamma.
     
    197197 * val_dist == (upper_bound - val) * 10^scale
    198198 */
    199 static void calc_scaled_bounds(ieee_double_t val, fp_num_t *scaled_upper_bound, 
     199static void calc_scaled_bounds(ieee_double_t val, fp_num_t *scaled_upper_bound,
    200200        fp_num_t *bounds_delta, fp_num_t *val_dist, int *scale)
    201201{
     
    208208        assert(normalize(val.pos_val).exponent == upper_bound.exponent);
    209209
    210         /* 
     210        /*
    211211         * Find such a cached normalized power of 10 that if multiplied
    212          * by upper_bound the binary exponent of upper_bound almost vanishes, 
     212         * by upper_bound the binary exponent of upper_bound almost vanishes,
    213213         * ie:
    214214         *   upper_scaled := upper_bound * 10^scale
     
    231231        assert(alpha <= upper_scaled.exponent && upper_scaled.exponent <= gamma);
    232232
    233         /* 
     233        /*
    234234         * Any value between lower and upper bound would be represented
    235235         * in binary as the double val originated from. The bounds were
    236          * however scaled by an imprecise power of 10 (error less than 
    237          * 1 ulp) so the scaled bounds have an error of less than 1 ulp. 
    238          * Conservatively round the lower bound up and the upper bound 
     236         * however scaled by an imprecise power of 10 (error less than
     237         * 1 ulp) so the scaled bounds have an error of less than 1 ulp.
     238         * Conservatively round the lower bound up and the upper bound
    239239         * down by 1 ulp just to be on the safe side. It avoids pronouncing
    240240         * produced decimal digits as correct if such a decimal number
    241          * is close to the bounds to within 1 ulp. 
     241         * is close to the bounds to within 1 ulp.
    242242         */
    243243        upper_scaled.significand -= 1;
     
    263263         *
    264264         * delta = upper - lower .. conservative/safe interval
    265          * w_dist = upper - w   
     265         * w_dist = upper - w
    266266         * upper = "number represented by digits in buf" + rest
    267          * 
    268          * Changing buf[len - 1] changes the value represented by buf 
     267         *
     268         * Changing buf[len - 1] changes the value represented by buf
    269269         * by digit_val_diff * scaling, where scaling is shared by
    270          * all parameters. 
     270         * all parameters.
    271271         *
    272272         */
     
    277277        bool next_in_val_rng = cur_greater_w && (rest + digit_val_diff < delta);
    278278        /* Rounding down by one would bring buf closer to the processed number. */
    279         bool next_closer = next_in_val_rng 
     279        bool next_closer = next_in_val_rng
    280280                && (rest + digit_val_diff < w_dist || rest - w_dist < w_dist - rest);
    281281
    282         /* Of the shortest strings pick the one that is closest to the actual 
     282        /* Of the shortest strings pick the one that is closest to the actual
    283283           floating point number. */
    284284        while (next_closer) {
     
    291291                cur_greater_w = rest < w_dist;
    292292                next_in_val_rng = cur_greater_w && (rest + digit_val_diff < delta);
    293                 next_closer = next_in_val_rng 
     293                next_closer = next_in_val_rng
    294294                        && (rest + digit_val_diff < w_dist || rest - w_dist < w_dist - rest);
    295295        }
     
    299299/** Generates the shortest accurate decimal string representation.
    300300 *
    301  * Outputs (mostly) the shortest accurate string representation 
     301 * Outputs (mostly) the shortest accurate string representation
    302302 * for the number scaled_upper - val_dist. Numbers in the interval
    303303 * [scaled_upper - delta, scaled_upper] have the same binary
     
    305305 * shortest string representation (up to the rounding of the last
    306306 * digit to bring the shortest string also the closest to the
    307  * actual number). 
     307 * actual number).
    308308 *
    309309 * @param scaled_upper Scaled upper bound of numbers that have the
     
    315315 *              decimal string we're generating.
    316316 * @param scale Decimal scaling of the value to convert (ie scaled_upper).
    317  * @param buf   Buffer to store the string representation. Must be large 
     317 * @param buf   Buffer to store the string representation. Must be large
    318318 *              enough to store all digits and a null terminator. At most
    319319 *              MAX_DOUBLE_STR_LEN digits will be written (not counting
    320320 *              the null terminator).
    321  * @param buf_size Size of buf in bytes. 
    322  * @param dec_exponent Will be set to the decimal exponent of the number 
     321 * @param buf_size Size of buf in bytes.
     322 * @param dec_exponent Will be set to the decimal exponent of the number
    323323 *              string in buf.
    324324 *
    325325 * @return Number of digits; negative on failure (eg buffer too small).
    326326 */
    327 static int gen_dec_digits(fp_num_t scaled_upper, fp_num_t delta, 
     327static int gen_dec_digits(fp_num_t scaled_upper, fp_num_t delta,
    328328        fp_num_t val_dist, int scale, char *buf, size_t buf_size, int *dec_exponent)
    329329{
    330         /* 
    331          * The integral part of scaled_upper is 5 to 32 bits long while 
     330        /*
     331         * The integral part of scaled_upper is 5 to 32 bits long while
    332332         * the remaining fractional part is 59 to 32 bits long because:
    333333         * -59 == alpha <= scaled_upper.e <= gamma == -32
     
    341341         *  ` lower
    342342         *
    343          */ 
     343         */
    344344        assert(scaled_upper.significand != 0);
    345345        assert(alpha <= scaled_upper.exponent && scaled_upper.exponent <= gamma);
     
    359359
    360360        /*
    361          * Extract the integral part of scaled_upper. 
    362          *  upper / one == upper >> -one.e 
     361         * Extract the integral part of scaled_upper.
     362         *  upper / one == upper >> -one.e
    363363         */
    364364        uint32_t int_part = (uint32_t)(scaled_upper.significand >> (-one.exponent));
    365365       
    366         /* 
     366        /*
    367367         * Fractional part of scaled_upper.
    368          *  upper % one == upper & (one.f - 1) 
     368         *  upper % one == upper & (one.f - 1)
    369369         */
    370370        uint64_t frac_part = scaled_upper.significand & (one.significand - 1);
    371371
    372372        /*
    373          * The integral part of upper has at least 5 bits (64 + alpha) and 
    374          * at most 32 bits (64 + gamma). The integral part has at most 10 
    375          * decimal digits, so kappa <= 10. 
     373         * The integral part of upper has at least 5 bits (64 + alpha) and
     374         * at most 32 bits (64 + gamma). The integral part has at most 10
     375         * decimal digits, so kappa <= 10.
    376376         */
    377377        int kappa = 10;
     
    397397                }
    398398
    399                 /* 
     399                /*
    400400                 * Difference between the so far produced decimal number and upper
    401                  * is calculated as: remaining_int_part * one + frac_part 
     401                 * is calculated as: remaining_int_part * one + frac_part
    402402                 */
    403403                uint64_t remainder = (((uint64_t)int_part) << -one.exponent) + frac_part;
     
    422422                /*
    423423                 * Does not overflow because at least 5 upper bits were
    424                  * taken by the integral part and are now unused in frac_part. 
     424                 * taken by the integral part and are now unused in frac_part.
    425425                 */
    426426                frac_part *= 10;
     
    456456
    457457        /* Of the shortest representations choose the numerically closest one. */
    458         round_last_digit(frac_part, val_dist.significand, delta.significand, 
     458        round_last_digit(frac_part, val_dist.significand, delta.significand,
    459459                one.significand, buf, len);
    460460
     
    476476
    477477
    478 /** Converts a non-special double into its shortest accurate string 
     478/** Converts a non-special double into its shortest accurate string
    479479 *  representation.
    480480 *
    481  * Produces an accurate string representation, ie the string will 
     481 * Produces an accurate string representation, ie the string will
    482482 * convert back to the same binary double (eg via strtod). In the
    483483 * vast majority of cases (99%) the string will be the shortest such
     
    492492 * @param ieee_val Binary double description to convert. Must be the product
    493493 *                 of extract_ieee_double and it must not be a special number.
    494  * @param buf      Buffer to store the string representation. Must be large 
     494 * @param buf      Buffer to store the string representation. Must be large
    495495 *                 enough to store all digits and a null terminator. At most
    496496 *                 MAX_DOUBLE_STR_LEN digits will be written (not counting
    497497 *                 the null terminator).
    498498 * @param buf_size Size of buf in bytes.
    499  * @param dec_exponent Will be set to the decimal exponent of the number 
     499 * @param dec_exponent Will be set to the decimal exponent of the number
    500500 *                 string in buf.
    501501 *
     
    503503 *         an error: buf too small (or ieee_val.is_special).
    504504 */
    505 int double_to_short_str(ieee_double_t ieee_val, char *buf, size_t buf_size, 
     505int double_to_short_str(ieee_double_t ieee_val, char *buf, size_t buf_size,
    506506        int *dec_exponent)
    507507{
     
    523523        int scale;
    524524
    525         calc_scaled_bounds(ieee_val, &scaled_upper_bound, 
     525        calc_scaled_bounds(ieee_val, &scaled_upper_bound,
    526526                &delta, &val_dist, &scale);
    527527
    528         int len = gen_dec_digits(scaled_upper_bound, delta, val_dist, scale, 
     528        int len = gen_dec_digits(scaled_upper_bound, delta, val_dist, scale,
    529529                buf, buf_size, dec_exponent);
    530530
     
    540540 *              alpha <= exponent <= gamma
    541541 * @param scale Decimal scaling of the value to convert (ie w_scaled).
    542  * @param signif_d_cnt Maximum number of significant digits to output. 
     542 * @param signif_d_cnt Maximum number of significant digits to output.
    543543 *              Negative if as many as possible are requested.
    544544 * @param frac_d_cnt   Maximum number of fractional digits to output.
    545545 *              Negative if as many as possible are requested.
    546546 *              Eg. if 2 then 1.234 -> "1.23"; if 2 then 3e-9 -> "0".
    547  * @param buf   Buffer to store the string representation. Must be large 
     547 * @param buf   Buffer to store the string representation. Must be large
    548548 *              enough to store all digits and a null terminator. At most
    549549 *              MAX_DOUBLE_STR_LEN digits will be written (not counting
    550550 *              the null terminator).
    551  * @param buf_size Size of buf in bytes. 
     551 * @param buf_size Size of buf in bytes.
    552552 *
    553553 * @return Number of digits; negative on failure (eg buffer too small).
    554554 */
    555 static int gen_fixed_dec_digits(fp_num_t w_scaled, int scale, int signif_d_cnt, 
     555static int gen_fixed_dec_digits(fp_num_t w_scaled, int scale, int signif_d_cnt,
    556556        int frac_d_cnt, char *buf, size_t buf_size, int *dec_exponent)
    557557{
     
    561561        }
    562562
    563         /* 
    564          * The integral part of w_scaled is 5 to 32 bits long while the 
     563        /*
     564         * The integral part of w_scaled is 5 to 32 bits long while the
    565565         * remaining fractional part is 59 to 32 bits long because:
    566566         * -59 == alpha <= w_scaled.e <= gamma == -32
    567          * 
     567         *
    568568         * Therefore:
    569569         *  | 5..32 bits | 32..59 bits | == w_scaled == w * 10^scale
    570570         *  |  int_part  |  frac_part  |
    571571         *  |0 0  ..  0 1|0 0   ..  0 0| == one == 1.0
    572          *  |      0     |0 0   ..  0 1| == w_err == 1 * 2^w_scaled.e 
     572         *  |      0     |0 0   ..  0 1| == w_err == 1 * 2^w_scaled.e
    573573        */
    574574        assert(alpha <= w_scaled.exponent && w_scaled.exponent <= gamma);
    575575        assert(0 != w_scaled.significand);
    576576
    577         /* 
     577        /*
    578578         * Scaling the number being converted by 10^scale introduced
    579579         * an error of less that 1 ulp. The actual value of w_scaled
    580          * could lie anywhere between w_scaled.signif +/- w_err. 
     580         * could lie anywhere between w_scaled.signif +/- w_err.
    581581         * Scale the error locally as we scale the fractional part
    582582         * of w_scaled.
     
    589589        one.exponent = w_scaled.exponent;
    590590
    591         /* Extract the integral part of w_scaled. 
     591        /* Extract the integral part of w_scaled.
    592592           w_scaled / one == w_scaled >> -one.e */
    593593        uint32_t int_part = (uint32_t)(w_scaled.significand >> (-one.exponent));
     
    598598
    599599        size_t len = 0;
    600         /* 
    601          * The integral part of w_scaled has at least 5 bits (64 + alpha = 5) 
    602          * and at most 32 bits (64 + gamma = 32). The integral part has 
    603          * at most 10 decimal digits, so kappa <= 10. 
     600        /*
     601         * The integral part of w_scaled has at least 5 bits (64 + alpha = 5)
     602         * and at most 32 bits (64 + gamma = 32). The integral part has
     603         * at most 10 decimal digits, so kappa <= 10.
    604604         */
    605605        int kappa = 10;
     
    607607
    608608        int rem_signif_d_cnt = signif_d_cnt;
    609         int rem_frac_d_cnt = 
     609        int rem_frac_d_cnt =
    610610                (frac_d_cnt >= 0) ? (kappa - scale + frac_d_cnt) : INT_MAX;
    611611
     
    638638                /*
    639639                 * Does not overflow because at least 5 upper bits were
    640                  * taken by the integral part and are now unused in frac_part. 
     640                 * taken by the integral part and are now unused in frac_part.
    641641                 */
    642642                frac_part *= 10;
     
    673673                assert(frac_d_cnt < 0 || -frac_d_cnt <= *dec_exponent);
    674674        } else {
    675                 /* 
    676                  * The number of fractional digits was too limiting to produce 
    677                  * any digits. 
     675                /*
     676                 * The number of fractional digits was too limiting to produce
     677                 * any digits.
    678678                 */
    679679                assert(rem_frac_d_cnt <= 0 || w_scaled.significand == 0);
     
    699699 * Conversion errors are tracked, so all produced digits except the
    700700 * last one are accurate. Garbage digits are never produced.
    701  * If the requested number of digits cannot be produced accurately 
    702  * due to conversion errors less digits are produced than requested 
     701 * If the requested number of digits cannot be produced accurately
     702 * due to conversion errors less digits are produced than requested
    703703 * and the last digit has an error of +/- 1 (so if '7' is the last
    704704 * converted digit it might have been converted to any of '6'..'8'
    705  * had the conversion been completely precise). 
    706  *
    707  * If no error occurs at least one digit is output. 
    708  *
    709  * The conversion stops once the requested number of significant or 
    710  * fractional digits is reached or the conversion error is too large 
     705 * had the conversion been completely precise).
     706 *
     707 * If no error occurs at least one digit is output.
     708 *
     709 * The conversion stops once the requested number of significant or
     710 * fractional digits is reached or the conversion error is too large
    711711 * to generate any more digits (whichever happens first).
    712712 *
     
    731731 *                 of extract_ieee_double and it must not be a special number.
    732732 * @param signif_d_cnt Maximum number of significant digits to produce.
    733  *                 The output is not rounded. 
     733 *                 The output is not rounded.
    734734 *                 Set to a negative value to generate as many digits
    735735 *                 as accurately possible.
    736736 * @param frac_d_cnt Maximum number of fractional digits to produce including
    737  *                 any zeros immediately trailing the decimal point. 
    738  *                 The output is not rounded. 
     737 *                 any zeros immediately trailing the decimal point.
     738 *                 The output is not rounded.
    739739 *                 Set to a negative value to generate as many digits
    740740 *                 as accurately possible.
    741  * @param buf      Buffer to store the string representation. Must be large 
     741 * @param buf      Buffer to store the string representation. Must be large
    742742 *                 enough to store all digits and a null terminator. At most
    743743 *                 MAX_DOUBLE_STR_LEN digits will be written (not counting
    744744 *                 the null terminator).
    745745 * @param buf_size Size of buf in bytes.
    746  * @param dec_exponent Set to the decimal exponent of the number string 
     746 * @param dec_exponent Set to the decimal exponent of the number string
    747747 *                 in buf.
    748748 *
    749749 * @return The number of output digits. A negative value indicates
    750  *         an error: buf too small (or ieee_val.is_special, or 
     750 *         an error: buf too small (or ieee_val.is_special, or
    751751 *         signif_d_cnt == 0).
    752752 */
     
    779779
    780780        /* Produce decimal digits from the scaled number. */
    781         int len = gen_fixed_dec_digits(w_scaled, scale, signif_d_cnt, frac_d_cnt, 
     781        int len = gen_fixed_dec_digits(w_scaled, scale, signif_d_cnt, frac_d_cnt,
    782782                buf, buf_size, dec_exponent);
    783783
  • uspace/lib/c/generic/elf/elf_load.c

    rdf6ded8 r1b20da0  
    5151/** Load ELF program.
    5252 *
    53  * @param file File handle 
     53 * @param file File handle
    5454 * @param info Place to store ELF program information
    5555 * @return EE_OK on success or an EE_x error code
  • uspace/lib/c/generic/elf/elf_mod.c

    rdf6ded8 r1b20da0  
    152152        rc = vfs_read(elf->fd, &pos, header, sizeof(elf_header_t), &nr);
    153153        if (rc != EOK || nr != sizeof(elf_header_t)) {
    154                 DPRINTF("Read error.\n"); 
     154                DPRINTF("Read error.\n");
    155155                return EE_IO;
    156156        }
     
    160160        /* Identify ELF */
    161161        if (header->e_ident[EI_MAG0] != ELFMAG0 ||
    162             header->e_ident[EI_MAG1] != ELFMAG1 || 
     162            header->e_ident[EI_MAG1] != ELFMAG1 ||
    163163            header->e_ident[EI_MAG2] != ELFMAG2 ||
    164164            header->e_ident[EI_MAG3] != ELFMAG3) {
     
    169169        /* Identify ELF compatibility */
    170170        if (header->e_ident[EI_DATA] != ELF_DATA_ENCODING ||
    171             header->e_machine != ELF_MACHINE || 
     171            header->e_machine != ELF_MACHINE ||
    172172            header->e_ident[EI_VERSION] != EV_CURRENT ||
    173173            header->e_version != EV_CURRENT ||
  • uspace/lib/c/generic/event.c

    rdf6ded8 r1b20da0  
    11/*
    2  * Copyright (c) 2009 Jakub Jermar 
     2 * Copyright (c) 2009 Jakub Jermar
    33 * All rights reserved.
    44 *
  • uspace/lib/c/generic/fibril.c

    rdf6ded8 r1b20da0  
    128128
    129129void fibril_teardown(fibril_t *fibril, bool locked)
    130 {       
     130{
    131131        if (!locked)
    132132                futex_lock(&fibril_futex);
     
    236236                    link);
    237237               
    238                 if (stype == FIBRIL_FROM_DEAD) 
     238                if (stype == FIBRIL_FROM_DEAD)
    239239                        dstf->clean_after_me = srcf;
    240240                break;
  • uspace/lib/c/generic/fibril_synch.c

    rdf6ded8 r1b20da0  
    11/*
    2  * Copyright (c) 2009 Jakub Jermar 
     2 * Copyright (c) 2009 Jakub Jermar
    33 * All rights reserved.
    44 *
     
    175175       
    176176        futex_down(&async_futex);
    177         if (fm->counter <= 0) 
     177        if (fm->counter <= 0)
    178178                locked = true;
    179179        futex_up(&async_futex);
  • uspace/lib/c/generic/getopt.c

    rdf6ded8 r1b20da0  
    197197                        if (IN_ORDER) {
    198198                                /*
    199                                  * GNU extension: 
     199                                 * GNU extension:
    200200                                 * return non-option as argument to option 1
    201201                                 */
     
    243243        if (optchar == 'W' && oli[1] == ';') {          /* -W long-option */
    244244                /* XXX: what if no long options provided (called by getopt)? */
    245                 if (*place) 
     245                if (*place)
    246246                        return -2;
    247247
     
    450450                        *long_options[match].flag = long_options[match].val;
    451451                        retval = 0;
    452                 } else 
     452                } else
    453453                        retval = long_options[match].val;
    454454                if (idx)
  • uspace/lib/c/generic/ieee_double.c

    rdf6ded8 r1b20da0  
    5454        bits.val = val;
    5555
    56         /* 
    57          * Extract the binary ieee representation of the double. 
     56        /*
     57         * Extract the binary ieee representation of the double.
    5858         * Relies on integers having the same endianness as doubles.
    5959         */
    60         uint64_t num = bits.num;       
     60        uint64_t num = bits.num;
    6161
    6262        ieee_double_t ret;
     
    9898                        ret.pos_val.exponent = raw_exponent - exponent_bias;
    9999
    100                         /* The predecessor is closer to val than the successor 
     100                        /* The predecessor is closer to val than the successor
    101101                         * if val is a normal value of the form 2^k (hence
    102                          * raw_significand == 0) with the only exception being 
    103                          * the smallest normal (raw_exponent == 1). The smallest 
    104                          * normal's predecessor is the largest denormal and denormals 
    105                          * do not get an extra bit of precision because their exponent 
     102                         * raw_significand == 0) with the only exception being
     103                         * the smallest normal (raw_exponent == 1). The smallest
     104                         * normal's predecessor is the largest denormal and denormals
     105                         * do not get an extra bit of precision because their exponent
    106106                         * stays the same (ie it does not decrease from k to k-1).
    107107                         */
  • uspace/lib/c/generic/io/io.c

    rdf6ded8 r1b20da0  
    5454static FILE stdin_null = {
    5555        .fd = -1,
    56         .pos = 0, 
     56        .pos = 0,
    5757        .error = true,
    5858        .eof = true,
     
    6969static FILE stdout_kio = {
    7070        .fd = -1,
    71         .pos = 0, 
     71        .pos = 0,
    7272        .error = false,
    7373        .eof = false,
     
    8484static FILE stderr_kio = {
    8585        .fd = -1,
    86         .pos = 0, 
     86        .pos = 0,
    8787        .error = false,
    8888        .eof = false,
     
    827827                        errno = rc;
    828828                        stream->error = true;
    829                         return -1;     
     829                        return -1;
    830830                }
    831831                stream->pos = st.size + offset;
  • uspace/lib/c/generic/io/printf_core.c

    rdf6ded8 r1b20da0  
    592592
    593593/** Prints a special double (ie NaN, infinity) padded to width characters. */
    594 static int print_special(ieee_double_t val, int width, uint32_t flags, 
     594static int print_special(ieee_double_t val, int width, uint32_t flags,
    595595        printf_spec_t *ps)
    596596{
     
    615615        /* Leading padding. */
    616616        if (!(flags & __PRINTF_FLAG_LEFTALIGNED)) {
    617                 if ((ret = print_padding(' ', padding_len, ps)) < 0) 
     617                if ((ret = print_padding(' ', padding_len, ps)) < 0)
    618618                        return -1;
    619619
     
    636636        /* Trailing padding. */
    637637        if (flags & __PRINTF_FLAG_LEFTALIGNED) {
    638                 if ((ret = print_padding(' ', padding_len, ps)) < 0) 
     638                if ((ret = print_padding(' ', padding_len, ps)) < 0)
    639639                        return -1;
    640640
     
    698698
    699699
    700 /** Format and print the double string repressentation according 
    701  *  to the %f specifier. 
    702  */
    703 static int print_double_str_fixed(double_str_t *val_str, int precision, int width, 
     700/** Format and print the double string repressentation according
     701 *  to the %f specifier.
     702 */
     703static int print_double_str_fixed(double_str_t *val_str, int precision, int width,
    704704        uint32_t flags, printf_spec_t *ps)
    705705{
     
    742742
    743743        if (!(flags & (__PRINTF_FLAG_LEFTALIGNED | __PRINTF_FLAG_ZEROPADDED))) {
    744                 if ((ret = print_padding(' ', padding_len, ps)) < 0) 
     744                if ((ret = print_padding(' ', padding_len, ps)) < 0)
    745745                        return -1;
    746746
     
    749749
    750750        if (sign) {
    751                 if ((ret = ps->str_write(&sign, 1, ps->data)) < 0) 
     751                if ((ret = ps->str_write(&sign, 1, ps->data)) < 0)
    752752                        return -1;
    753753               
     
    756756
    757757        if (flags & __PRINTF_FLAG_ZEROPADDED) {
    758                 if ((ret = print_padding('0', padding_len, ps)) < 0) 
     758                if ((ret = print_padding('0', padding_len, ps)) < 0)
    759759                        return -1;
    760760
     
    767767
    768768        if (0 < buf_int_len) {
    769                 if ((ret = ps->str_write(buf, buf_int_len, ps->data)) < 0) 
     769                if ((ret = ps->str_write(buf, buf_int_len, ps->data)) < 0)
    770770                        return -1;
    771771
     
    773773
    774774                /* Print trailing zeros of the integral part of the number. */
    775                 if ((ret = print_padding('0', int_len - buf_int_len, ps)) < 0) 
     775                if ((ret = print_padding('0', int_len - buf_int_len, ps)) < 0)
    776776                        return -1;
    777777        } else {
    778778                /* Single leading integer 0. */
    779779                char ch = '0';
    780                 if ((ret = ps->str_write(&ch, 1, ps->data)) < 0) 
     780                if ((ret = ps->str_write(&ch, 1, ps->data)) < 0)
    781781                        return -1;
    782782        }
     
    788788                char ch = '.';
    789789
    790                 if ((ret = ps->str_write(&ch, 1, ps->data)) < 0) 
     790                if ((ret = ps->str_write(&ch, 1, ps->data)) < 0)
    791791                        return -1;
    792792               
     
    794794
    795795                /* Print leading zeros of the fractional part of the number. */
    796                 if ((ret = print_padding('0', leading_frac_zeros, ps)) < 0) 
     796                if ((ret = print_padding('0', leading_frac_zeros, ps)) < 0)
    797797                        return -1;
    798798
     
    801801                /* Print significant digits of the fractional part of the number. */
    802802                if (0 < signif_frac_figs) {
    803                         if ((ret = ps->str_write(buf_frac, signif_frac_figs, ps->data)) < 0) 
     803                        if ((ret = ps->str_write(buf_frac, signif_frac_figs, ps->data)) < 0)
    804804                                return -1;
    805805
     
    808808
    809809                /* Print trailing zeros of the fractional part of the number. */
    810                 if ((ret = print_padding('0', trailing_frac_zeros, ps)) < 0) 
     810                if ((ret = print_padding('0', trailing_frac_zeros, ps)) < 0)
    811811                        return -1;
    812812
     
    816816        /* Trailing padding. */
    817817        if (flags & __PRINTF_FLAG_LEFTALIGNED) {
    818                 if ((ret = print_padding(' ', padding_len, ps)) < 0) 
     818                if ((ret = print_padding(' ', padding_len, ps)) < 0)
    819819                        return -1;
    820820
     
    826826
    827827
    828 /** Convert, format and print a double according to the %f specifier. 
     828/** Convert, format and print a double according to the %f specifier.
    829829 *
    830830 * @param g     Double to print.
     
    832832 *              decimal point will be printed unless the flag
    833833 *              __PRINTF_FLAG_DECIMALPT is specified.
    834  * @param width Minimum number of characters to display. Pads 
     834 * @param width Minimum number of characters to display. Pads
    835835 *              with '0' or ' ' depending on the set flags;
    836836 * @param flags Printf flags.
     
    839839 * @return The number of characters printed; negative on failure.
    840840 */
    841 static int print_double_fixed(double g, int precision, int width, uint32_t flags, 
     841static int print_double_fixed(double g, int precision, int width, uint32_t flags,
    842842        printf_spec_t *ps)
    843843{
     
    854854        if (val.is_special) {
    855855                return print_special(val, width, flags, ps);
    856         } 
     856        }
    857857
    858858        char buf[MAX_DOUBLE_STR_BUF_SIZE];
     
    864864
    865865        if (0 <= precision) {
    866                 /* 
     866                /*
    867867                 * Request one more digit so we can round the result. The last
    868                  * digit it returns may have an error of at most +/- 1. 
     868                 * digit it returns may have an error of at most +/- 1.
    869869                 */
    870                 val_str.len = double_to_fixed_str(val, -1, precision + 1, buf, buf_size, 
     870                val_str.len = double_to_fixed_str(val, -1, precision + 1, buf, buf_size,
    871871                        &val_str.dec_exp);
    872872
    873                 /* 
    874                  * Round using the last digit to produce precision fractional digits. 
    875                  * If less than precision+1 fractional digits were output the last 
    876                  * digit is definitely inaccurate so also round to get rid of it. 
     873                /*
     874                 * Round using the last digit to produce precision fractional digits.
     875                 * If less than precision+1 fractional digits were output the last
     876                 * digit is definitely inaccurate so also round to get rid of it.
    877877                 */
    878878                fp_round_up(buf, &val_str.len, &val_str.dec_exp);
     
    901901        char exp_ch = (flags & __PRINTF_FLAG_BIGCHARS) ? 'E' : 'e';
    902902
    903         if ((ret = ps->str_write(&exp_ch, 1, ps->data)) < 0) 
     903        if ((ret = ps->str_write(&exp_ch, 1, ps->data)) < 0)
    904904                return -1;
    905905       
     
    925925        const char *exp_str_start = &exp_str[3] - exp_len;
    926926
    927         if ((ret = ps->str_write(exp_str_start, exp_len, ps->data)) < 0) 
     927        if ((ret = ps->str_write(exp_str_start, exp_len, ps->data)) < 0)
    928928                return -1;
    929929
     
    934934
    935935
    936 /** Format and print the double string repressentation according 
    937  *  to the %e specifier. 
    938  */
    939 static int print_double_str_scient(double_str_t *val_str, int precision, 
     936/** Format and print the double string repressentation according
     937 *  to the %e specifier.
     938 */
     939static int print_double_str_scient(double_str_t *val_str, int precision,
    940940        int width, uint32_t flags, printf_spec_t *ps)
    941941{
     
    972972
    973973        if (!(flags & (__PRINTF_FLAG_LEFTALIGNED | __PRINTF_FLAG_ZEROPADDED))) {
    974                 if ((ret = print_padding(' ', padding_len, ps)) < 0) 
     974                if ((ret = print_padding(' ', padding_len, ps)) < 0)
    975975                        return -1;
    976976
     
    979979
    980980        if (sign) {
    981                 if ((ret = ps->str_write(&sign, 1, ps->data)) < 0) 
     981                if ((ret = ps->str_write(&sign, 1, ps->data)) < 0)
    982982                        return -1;
    983983               
     
    986986
    987987        if (flags & __PRINTF_FLAG_ZEROPADDED) {
    988                 if ((ret = print_padding('0', padding_len, ps)) < 0) 
     988                if ((ret = print_padding('0', padding_len, ps)) < 0)
    989989                        return -1;
    990990
     
    993993
    994994        /* Single leading integer. */
    995         if ((ret = ps->str_write(buf, 1, ps->data)) < 0) 
     995        if ((ret = ps->str_write(buf, 1, ps->data)) < 0)
    996996                return -1;
    997997
     
    10021002                char ch = '.';
    10031003
    1004                 if ((ret = ps->str_write(&ch, 1, ps->data)) < 0) 
     1004                if ((ret = ps->str_write(&ch, 1, ps->data)) < 0)
    10051005                        return -1;
    10061006               
     
    10091009                /* Print significant digits of the fractional part of the number. */
    10101010                if (0 < signif_frac_figs) {
    1011                         if ((ret = ps->str_write(buf + 1, signif_frac_figs, ps->data)) < 0) 
     1011                        if ((ret = ps->str_write(buf + 1, signif_frac_figs, ps->data)) < 0)
    10121012                                return -1;
    10131013
     
    10161016
    10171017                /* Print trailing zeros of the fractional part of the number. */
    1018                 if ((ret = print_padding('0', trailing_frac_zeros, ps)) < 0) 
     1018                if ((ret = print_padding('0', trailing_frac_zeros, ps)) < 0)
    10191019                        return -1;
    10201020
     
    10231023
    10241024        /* Print the exponent. */
    1025         if ((ret = print_exponent(exp_val, flags, ps)) < 0) 
     1025        if ((ret = print_exponent(exp_val, flags, ps)) < 0)
    10261026                return -1;
    10271027
     
    10291029
    10301030        if (flags & __PRINTF_FLAG_LEFTALIGNED) {
    1031                 if ((ret = print_padding(' ', padding_len, ps)) < 0) 
     1031                if ((ret = print_padding(' ', padding_len, ps)) < 0)
    10321032                        return -1;
    10331033
     
    10391039
    10401040
    1041 /** Convert, format and print a double according to the %e specifier. 
    1042  *
    1043  * Note that if g is large, the output may be huge (3e100 prints 
     1041/** Convert, format and print a double according to the %e specifier.
     1042 *
     1043 * Note that if g is large, the output may be huge (3e100 prints
    10441044 * with at least 100 digits).
    10451045 *
     
    10541054 *              __PRINTF_FLAG_DECIMALPT is specified. If negative
    10551055 *              the shortest accurate number will be printed.
    1056  * @param width Minimum number of characters to display. Pads 
     1056 * @param width Minimum number of characters to display. Pads
    10571057 *              with '0' or ' ' depending on the set flags;
    10581058 * @param flags Printf flags.
     
    10611061 * @return The number of characters printed; negative on failure.
    10621062 */
    1063 static int print_double_scientific(double g, int precision, int width, 
     1063static int print_double_scientific(double g, int precision, int width,
    10641064        uint32_t flags, printf_spec_t *ps)
    10651065{
     
    10721072        if (val.is_special) {
    10731073                return print_special(val, width, flags, ps);
    1074         } 
     1074        }
    10751075
    10761076        char buf[MAX_DOUBLE_STR_BUF_SIZE];
     
    10821082
    10831083        if (0 <= precision) {
    1084                 /* 
    1085                  * Request one more digit (in addition to the leading integer) 
    1086                  * so we can round the result. The last digit it returns may 
    1087                  * have an error of at most +/- 1. 
     1084                /*
     1085                 * Request one more digit (in addition to the leading integer)
     1086                 * so we can round the result. The last digit it returns may
     1087                 * have an error of at most +/- 1.
    10881088                 */
    1089                 val_str.len = double_to_fixed_str(val, precision + 2, -1, buf, buf_size, 
     1089                val_str.len = double_to_fixed_str(val, precision + 2, -1, buf, buf_size,
    10901090                        &val_str.dec_exp);
    10911091
    1092                 /* 
    1093                  * Round the extra digit to produce precision+1 significant digits. 
    1094                  * If less than precision+2 significant digits were returned the last 
    1095                  * digit is definitely inaccurate so also round to get rid of it. 
     1092                /*
     1093                 * Round the extra digit to produce precision+1 significant digits.
     1094                 * If less than precision+2 significant digits were returned the last
     1095                 * digit is definitely inaccurate so also round to get rid of it.
    10961096                 */
    10971097                fp_round_up(buf, &val_str.len, &val_str.dec_exp);
     
    11131113
    11141114
    1115 /** Convert, format and print a double according to the %g specifier. 
    1116  *
    1117  * %g style chooses between %f and %e. 
     1115/** Convert, format and print a double according to the %g specifier.
     1116 *
     1117 * %g style chooses between %f and %e.
    11181118 *
    11191119 * @param g     Double to print.
     
    11211121 *              any leading zeros from this count. If negative
    11221122 *              the shortest accurate number will be printed.
    1123  * @param width Minimum number of characters to display. Pads 
     1123 * @param width Minimum number of characters to display. Pads
    11241124 *              with '0' or ' ' depending on the set flags;
    11251125 * @param flags Printf flags.
     
    11281128 * @return The number of characters printed; negative on failure.
    11291129 */
    1130 static int print_double_generic(double g, int precision, int width, 
     1130static int print_double_generic(double g, int precision, int width,
    11311131        uint32_t flags, printf_spec_t *ps)
    11321132{
     
    11351135        if (val.is_special) {
    11361136                return print_special(val, width, flags, ps);
    1137         } 
     1137        }
    11381138
    11391139        char buf[MAX_DOUBLE_STR_BUF_SIZE];
     
    11441144        /* Honor the user requested number of significant digits. */
    11451145        if (0 <= precision) {
    1146                 /* 
    1147                  * Do a quick and dirty conversion of a single digit to determine 
     1146                /*
     1147                 * Do a quick and dirty conversion of a single digit to determine
    11481148                 * the decimal exponent.
    11491149                 */
     
    11551155                if (-4 <= dec_exp && dec_exp < precision) {
    11561156                        precision = precision - (dec_exp + 1);
    1157                         return print_double_fixed(g, precision, width, 
     1157                        return print_double_fixed(g, precision, width,
    11581158                                flags | __PRINTF_FLAG_NOFRACZEROS, ps);
    11591159                } else {
    11601160                        --precision;
    1161                         return print_double_scientific(g, precision, width, 
     1161                        return print_double_scientific(g, precision, width,
    11621162                                flags | __PRINTF_FLAG_NOFRACZEROS, ps);
    11631163                }
     
    11941194
    11951195
    1196 /** Convert, format and print a double according to the specifier. 
     1196/** Convert, format and print a double according to the specifier.
    11971197 *
    11981198 * Depending on the specifier it prints the double using the styles
     
    12061206 *              the shortest accurate number will be printed for style %g;
    12071207 *              negative precision defaults to 6 for styles %f, %e.
    1208  * @param width Minimum number of characters to display. Pads 
     1208 * @param width Minimum number of characters to display. Pads
    12091209 *              with '0' or ' ' depending on the set flags;
    12101210 * @param flags Printf flags.
     
    12131213 * @return The number of characters printed; negative on failure.
    12141214 */
    1215 static int print_double(double g, char spec, int precision, int width, 
     1215static int print_double(double g, char spec, int precision, int width,
    12161216        uint32_t flags, printf_spec_t *ps)
    12171217{
     
    15421542                        case 'E':
    15431543                        case 'e':
    1544                                 retval = print_double(va_arg(ap, double), uc, precision, 
     1544                                retval = print_double(va_arg(ap, double), uc, precision,
    15451545                                        width, flags, ps);
    15461546                               
  • uspace/lib/c/generic/malloc.c

    rdf6ded8 r1b20da0  
    216216                /*
    217217                 * Malloc never switches fibrils while the heap is locked.
    218                  * Similarly, it never creates new threads from within the 
    219                  * locked region. Therefore, if there are no other threads 
    220                  * except this one, the whole operation will complete without 
     218                 * Similarly, it never creates new threads from within the
     219                 * locked region. Therefore, if there are no other threads
     220                 * except this one, the whole operation will complete without
    221221                 * any interruptions.
    222222                 */
     
    232232                /*
    233233                 * Malloc never switches fibrils while the heap is locked.
    234                  * Similarly, it never creates new threads from within the 
    235                  * locked region. Therefore, if there are no other threads 
    236                  * except this one, the whole operation will complete without 
     234                 * Similarly, it never creates new threads from within the
     235                 * locked region. Therefore, if there are no other threads
     236                 * except this one, the whole operation will complete without
    237237                 * any interruptions.
    238238                 */
  • uspace/lib/c/generic/mem.c

    rdf6ded8 r1b20da0  
    197197
    198198        /* Non-overlapping? */
    199         if (dst >= src + n || src >= dst + n) { 
     199        if (dst >= src + n || src >= dst + n) {
    200200                return memcpy(dst, src, n);
    201201        }
  • uspace/lib/c/generic/power_of_ten.c

    rdf6ded8 r1b20da0  
    3939 *
    4040 * The smallest interval of binary exponents computed by hand
    41  * is [-1083, 987]. Add 200 (exponent change > 3 * 64 bits) 
     41 * is [-1083, 987]. Add 200 (exponent change > 3 * 64 bits)
    4242 * to both bounds just to be on the safe side; ie [-1283, 1187].
    4343 */
     
    144144
    145145
    146 /** 
    147  * Returns the smallest precomputed power of 10 such that 
     146/**
     147 * Returns the smallest precomputed power of 10 such that
    148148 *  binary_exp <= power_of_10.bin_exp
    149149 * where
    150  *  10^decimal_exp = power_of_10.significand * 2^bin_exp 
     150 *  10^decimal_exp = power_of_10.significand * 2^bin_exp
    151151 * with an error of 0.5 ulp in the significand.
    152152 */
     
    160160        assert(min_bin_exp <= binary_exp && binary_exp <= max_bin_exp);
    161161
    162         /* 
    163          * Binary exponent difference between adjacent powers of 10 
     162        /*
     163         * Binary exponent difference between adjacent powers of 10
    164164         * is lg(10^8) = 26.575. The starting search index seed_idx
    165165         * undershoots the actual position by less than 1.6%, ie it
    166166         * skips 26.575/27 = 98.4% of all the smaller powers. This
    167          * translates to at most three extra tests. 
     167         * translates to at most three extra tests.
    168168         */
    169169        int seed_idx = (binary_exp - min_bin_exp) / max_bin_exp_diff;
  • uspace/lib/c/generic/rcu.c

    rdf6ded8 r1b20da0  
    3232/**
    3333 * @file
    34  * 
    35  * User space RCU is based on URCU utilizing signals [1]. This 
    36  * implementation does not however signal each thread of the process 
     34 *
     35 * User space RCU is based on URCU utilizing signals [1]. This
     36 * implementation does not however signal each thread of the process
    3737 * to issue a memory barrier. Instead, we introduced a syscall that
    3838 * issues memory barriers (via IPIs) on cpus that are running threads
    3939 * of the current process. First, it does not require us to schedule
    40  * and run every thread of the process. Second, IPIs are less intrusive 
     40 * and run every thread of the process. Second, IPIs are less intrusive
    4141 * than switching contexts and entering user space.
    42  * 
     42 *
    4343 * This algorithm is further modified to require a single instead of
    4444 * two reader group changes per grace period. Signal-URCU flips
    45  * the reader group and waits for readers of the previous group 
     45 * the reader group and waits for readers of the previous group
    4646 * twice in succession in order to wait for new readers that were
    47  * delayed and mistakenly associated with the previous reader group. 
     47 * delayed and mistakenly associated with the previous reader group.
    4848 * The modified algorithm ensures that the new reader group is
    4949 * always empty (by explicitly waiting for it to become empty).
    5050 * Only then does it flip the reader group and wait for preexisting
    5151 * readers of the old reader group (invariant of SRCU [2, 3]).
    52  * 
    53  * 
     52 *
     53 *
    5454 * [1] User-level implementations of read-copy update,
    5555 *     2012, appendix
    5656 *     http://www.rdrop.com/users/paulmck/RCU/urcu-supp-accepted.2011.08.30a.pdf
    57  * 
     57 *
    5858 * [2] linux/kernel/srcu.c in Linux 3.5-rc2,
    5959 *     2012
    6060 *     http://tomoyo.sourceforge.jp/cgi-bin/lxr/source/kernel/srcu.c?v=linux-3.5-rc2-ccs-1.8.3
    6161 *
    62  * [3] [RFC PATCH 5/5 single-thread-version] implement 
     62 * [3] [RFC PATCH 5/5 single-thread-version] implement
    6363 *     per-domain single-thread state machine,
    6464 *     2012, Lai
     
    162162
    163163/** Registers a fibril so it may start using RCU read sections.
    164  * 
     164 *
    165165 * A fibril must be registered with rcu before it can enter RCU critical
    166166 * sections delineated by rcu_read_lock() and rcu_read_unlock().
     
    178178
    179179/** Deregisters a fibril that had been using RCU read sections.
    180  * 
     180 *
    181181 * A fibril must be deregistered before it exits if it had
    182182 * been registered with rcu via rcu_register_fibril().
     
    186186        assert(fibril_rcu.registered);
    187187       
    188         /* 
     188        /*
    189189         * Forcefully unlock any reader sections. The fibril is exiting
    190190         * so it is not holding any references to data protected by the
    191          * rcu section. Therefore, it is safe to unlock. Otherwise, 
     191         * rcu section. Therefore, it is safe to unlock. Otherwise,
    192192         * rcu_synchronize() would wait indefinitely.
    193193         */
     
    202202}
    203203
    204 /** Delimits the start of an RCU reader critical section. 
    205  * 
    206  * RCU reader sections may be nested. 
     204/** Delimits the start of an RCU reader critical section.
     205 *
     206 * RCU reader sections may be nested.
    207207 */
    208208void rcu_read_lock(void)
     
    252252        lock_sync(blocking_mode);
    253253       
    254         /* 
    255          * Exit early if we were stuck waiting for the mutex for a full grace 
     254        /*
     255         * Exit early if we were stuck waiting for the mutex for a full grace
    256256         * period. Started waiting during gp_in_progress (or gp_in_progress + 1
    257257         * if the value propagated to this cpu too late) so wait for the next
     
    267267        ++ACCESS_ONCE(rcu.cur_gp);
    268268       
    269         /* 
    270          * Pairs up with MB_FORCE_L (ie CC_BAR_L). Makes changes prior 
    271          * to rcu_synchronize() visible to new readers. 
     269        /*
     270         * Pairs up with MB_FORCE_L (ie CC_BAR_L). Makes changes prior
     271         * to rcu_synchronize() visible to new readers.
    272272         */
    273273        memory_barrier(); /* MB_A */
    274274       
    275         /* 
    276          * Pairs up with MB_A. 
    277          * 
     275        /*
     276         * Pairs up with MB_A.
     277         *
    278278         * If the memory barrier is issued before CC_BAR_L in the target
    279279         * thread, it pairs up with MB_A and the thread sees all changes
    280280         * prior to rcu_synchronize(). Ie any reader sections are new
    281          * rcu readers. 
    282          * 
     281         * rcu readers.
     282         *
    283283         * If the memory barrier is issued after CC_BAR_L, it pairs up
    284284         * with MB_B and it will make the most recent nesting_cnt visible
    285285         * in this thread. Since the reader may have already accessed
    286286         * memory protected by RCU (it ran instructions passed CC_BAR_L),
    287          * it is a preexisting reader. Seeing the most recent nesting_cnt 
     287         * it is a preexisting reader. Seeing the most recent nesting_cnt
    288288         * ensures the thread will be identified as a preexisting reader
    289289         * and we will wait for it in wait_for_readers(old_reader_group).
     
    291291        force_mb_in_all_threads(); /* MB_FORCE_L */
    292292       
    293         /* 
     293        /*
    294294         * Pairs with MB_FORCE_L (ie CC_BAR_L, CC_BAR_U) and makes the most
    295295         * current fibril.nesting_cnt visible to this cpu.
     
    321321static void force_mb_in_all_threads(void)
    322322{
    323         /* 
    324          * Only issue barriers in running threads. The scheduler will 
     323        /*
     324         * Only issue barriers in running threads. The scheduler will
    325325         * execute additional memory barriers when switching to threads
    326326         * of the process that are currently not running.
     
    339339        while (!list_empty(&rcu.fibrils_list)) {
    340340                list_foreach_safe(rcu.fibrils_list, fibril_it, next_fibril) {
    341                         fibril_rcu_data_t *fib = member_to_inst(fibril_it, 
     341                        fibril_rcu_data_t *fib = member_to_inst(fibril_it,
    342342                                fibril_rcu_data_t, link);
    343343                       
     
    393393        assert(rcu.sync_lock.locked);
    394394       
    395         /* 
     395        /*
    396396         * Blocked threads have a priority over fibrils when accessing sync().
    397397         * Pass the lock onto a waiting thread.
     
    421421{
    422422        assert(rcu.sync_lock.locked);
    423         /* 
    424          * Release the futex to avoid deadlocks in singlethreaded apps 
    425          * but keep sync locked. 
     423        /*
     424         * Release the futex to avoid deadlocks in singlethreaded apps
     425         * but keep sync locked.
    426426         */
    427427        futex_up(&rcu.sync_lock.futex);
     
    446446static size_t get_other_group(size_t group)
    447447{
    448         if (group == RCU_GROUP_A) 
     448        if (group == RCU_GROUP_A)
    449449                return RCU_GROUP_B;
    450450        else
  • uspace/lib/c/generic/rtld/dynamic.c

    rdf6ded8 r1b20da0  
    3030 * @brief
    3131 * @{
    32  */ 
     32 */
    3333/**
    3434 * @file
  • uspace/lib/c/generic/rtld/module.c

    rdf6ded8 r1b20da0  
    3030 * @brief
    3131 * @{
    32  */ 
     32 */
    3333/**
    3434 * @file
  • uspace/lib/c/generic/rtld/rtld.c

    rdf6ded8 r1b20da0  
    3030 * @brief
    3131 * @{
    32  */ 
     32 */
    3333/**
    3434 * @file
  • uspace/lib/c/generic/rtld/symbol.c

    rdf6ded8 r1b20da0  
    3030 * @brief
    3131 * @{
    32  */ 
     32 */
    3333/**
    3434 * @file
     
    113113 * @param name          Name of the symbol to search for.
    114114 * @param start         Module in which to start the search..
    115  * @param mod           (output) Will be filled with a pointer to the module 
     115 * @param mod           (output) Will be filled with a pointer to the module
    116116 *                      that contains the symbol.
    117117 */
     
    131131         */
    132132
    133         /* Mark all vertices (modules) as unvisited */ 
     133        /* Mark all vertices (modules) as unvisited */
    134134        modules_untag(start->rtld);
    135135
     
    193193 * @param flags         @c ssf_none or @c ssf_noexec to not look for the symbol
    194194 *                      in the executable program.
    195  * @param mod           (output) Will be filled with a pointer to the module 
     195 * @param mod           (output) Will be filled with a pointer to the module
    196196 *                      that contains the symbol.
    197197 */
  • uspace/lib/c/generic/str.c

    rdf6ded8 r1b20da0  
    688688                        break;
    689689
    690                 ++len; 
     690                ++len;
    691691        }
    692692
  • uspace/lib/c/generic/task.c

    rdf6ded8 r1b20da0  
    202202                if (rc != EOK)
    203203                        goto error;
    204         }               
     204        }
    205205       
    206206        /* Load the program. */
     
    313313
    314314/** Setup waiting for a task.
    315  * 
     315 *
    316316 * If the task finishes after this call succeeds, it is guaranteed that
    317317 * task_wait(wait, &texit, &retval) will return correct return value for
     
    361361 * @param texit  Store type of task exit here.
    362362 * @param retval Store return value of the task here.
    363  * 
     363 *
    364364 * @return EOK on success, else error code.
    365365 */
     
    391391 * @param texit  Store type of task exit here.
    392392 * @param retval Store return value of the task here.
    393  * 
     393 *
    394394 * @return EOK on success, else error code.
    395395 */
  • uspace/lib/c/generic/vfs/canonify.c

    rdf6ded8 r1b20da0  
    2727 */
    2828
    29 /** @addtogroup libc 
     29/** @addtogroup libc
    3030 * @{
    31  */ 
     31 */
    3232
    3333/**
     
    338338                if (lenp)
    339339                        *lenp = (size_t)((tlcomp.stop - tfsl.start) + 1);
    340                 return tfsl.start; 
     340                return tfsl.start;
    341341        default:
    342342                abort();
  • uspace/lib/c/generic/vfs/inbox.c

    rdf6ded8 r1b20da0  
    2727 */
    2828
    29 /** @addtogroup libc 
     29/** @addtogroup libc
    3030 * @{
    31  */ 
     31 */
    3232
    3333/**
     
    131131                case 1:
    132132                        return -1;
    133                 } 
     133                }
    134134        }
    135135
  • uspace/lib/c/generic/vfs/vfs.c

    rdf6ded8 r1b20da0  
    6363 * - functions that operate on integer file handles, such as:
    6464 *   vfs_walk(), vfs_open(), vfs_read(), vfs_link(), ...
    65  * 
     65 *
    6666 * - functions that operate on paths, such as:
    6767 *   vfs_lookup(), vfs_link_path(), vfs_unlink_path(), vfs_rename_path(), ...
     
    10791079}
    10801080
    1081 /** Get file information 
     1081/** Get file information
    10821082 *
    10831083 * @param path          File path to get information about
     
    11431143        vfs_put(file);
    11441144
    1145         return rc; 
     1145        return rc;
    11461146}
    11471147
Note: See TracChangeset for help on using the changeset viewer.