Changeset 3bacee1 in mainline for uspace/lib/c


Ignore:
Timestamp:
2018-04-12T16:27:17Z (7 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
3cf22f9
Parents:
76d0981d
git-author:
Jiri Svoboda <jiri@…> (2018-04-11 19:25:33)
git-committer:
Jiri Svoboda <jiri@…> (2018-04-12 16:27:17)
Message:

Make ccheck-fix again and commit more good files.

Location:
uspace/lib/c
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/arch/arm32/include/libarch/tls.h

    r76d0981d r3bacee1  
    6363        tls += sizeof(tcb_t) + ARM_TP_OFFSET;
    6464        asm volatile (
    65                 "mov r9, %0"
    66                 :
    67                 : "r" (tls)
     65            "mov r9, %0"
     66            :
     67            : "r" (tls)
    6868        );
    6969}
     
    7979        void *ret;
    8080        asm volatile (
    81                 "mov %0, r9"
    82                 : "=r"(ret)
     81            "mov %0, r9"
     82            : "=r" (ret)
    8383        );
    8484        return (tcb_t *) (ret - ARM_TP_OFFSET - sizeof(tcb_t));
  • uspace/lib/c/arch/ia32/include/libarch/tls.h

    r76d0981d r3bacee1  
    5151}
    5252
    53 static inline tcb_t * __tcb_get(void)
     53static inline tcb_t *__tcb_get(void)
    5454{
    5555        void *retval;
  • uspace/lib/c/arch/ia64/include/libarch/elf_linux.h

    r76d0981d r3bacee1  
    4747{
    4848        /* TODO */
    49         (void) istate; (void) elf_regs;
     49        (void) istate;
     50        (void) elf_regs;
    5051}
    5152
  • uspace/lib/c/arch/sparc64/include/libarch/tls.h

    r76d0981d r3bacee1  
    5151}
    5252
    53 static inline tcb_t * __tcb_get(void)
     53static inline tcb_t *__tcb_get(void)
    5454{
    5555        void *retval;
  • uspace/lib/c/generic/async.c

    r76d0981d r3bacee1  
    943943        link_t *tmp = timeout_list.head.next;
    944944        while (tmp != &timeout_list.head) {
    945                 awaiter_t *cur
    946                     = list_get_instance(tmp, awaiter_t, to_event.link);
     945                awaiter_t *cur =
     946                    list_get_instance(tmp, awaiter_t, to_event.link);
    947947
    948948                if (tv_gteq(&cur->to_event.expires, &wd->to_event.expires))
     
    12551255                 */
    12561256                futex_down(&async_futex);
    1257                 if ((usecs) && (conn->wdata.to_event.occurred)
    1258                     && (list_empty(&conn->msg_queue))) {
     1257                if ((usecs) && (conn->wdata.to_event.occurred) &&
     1258                    (list_empty(&conn->msg_queue))) {
    12591259                        /* If we timed out -> exit */
    12601260                        futex_up(&async_futex);
  • uspace/lib/c/generic/double_to_str.c

    r76d0981d r3bacee1  
    5656static bool is_normalized(fp_num_t num)
    5757{
    58         assert(8*sizeof(num.significand) == significand_width);
     58        assert(8 * sizeof(num.significand) == significand_width);
    5959
    6060        /* Normalized == most significant bit of the significand is set. */
     
    147147/** Returns the interval [low, high] of numbers that convert to binary val. */
    148148static void get_normalized_bounds(ieee_double_t val, fp_num_t *high,
    149         fp_num_t *low, fp_num_t *val_dist)
     149    fp_num_t *low, fp_num_t *val_dist)
    150150{
    151151        /*
     
    181181
    182182        val_dist->significand =
    183                 val_dist->significand << (val_dist->exponent - high->exponent);
     183            val_dist->significand << (val_dist->exponent - high->exponent);
    184184        val_dist->exponent = high->exponent;
    185185}
     
    198198 */
    199199static void calc_scaled_bounds(ieee_double_t val, fp_num_t *scaled_upper_bound,
    200         fp_num_t *bounds_delta, fp_num_t *val_dist, int *scale)
     200    fp_num_t *bounds_delta, fp_num_t *val_dist, int *scale)
    201201{
    202202        fp_num_t upper_bound, lower_bound;
     
    251251/** Rounds the last digit of buf so that it is closest to the converted number.*/
    252252static void round_last_digit(uint64_t rest, uint64_t w_dist, uint64_t delta,
    253         uint64_t digit_val_diff, char *buf, int len)
     253    uint64_t digit_val_diff, char *buf, int len)
    254254{
    255255        /*
     
    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
    280                 && (rest + digit_val_diff < w_dist || rest - w_dist < w_dist - rest);
     279        bool next_closer = next_in_val_rng &&
     280            (rest + digit_val_diff < w_dist || rest - w_dist < w_dist - rest);
    281281
    282282        /* Of the shortest strings pick the one that is closest to the actual
     
    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
    294                         && (rest + digit_val_diff < w_dist || rest - w_dist < w_dist - rest);
     293                next_closer = next_in_val_rng &&
     294                    (rest + digit_val_diff < w_dist || rest - w_dist < w_dist - rest);
    295295        }
    296296}
     
    326326 */
    327327static int gen_dec_digits(fp_num_t scaled_upper, fp_num_t delta,
    328         fp_num_t val_dist, int scale, char *buf, size_t buf_size, int *dec_exponent)
     328    fp_num_t val_dist, int scale, char *buf, size_t buf_size, int *dec_exponent)
    329329{
    330330        /*
     
    411411                        /* Of the shortest representations choose the numerically closest. */
    412412                        round_last_digit(remainder, val_dist.significand, delta.significand,
    413                                 (uint64_t)div << (-one.exponent), buf, len);
     413                            (uint64_t)div << (-one.exponent), buf, len);
    414414                        return len;
    415415                }
     
    457457        /* Of the shortest representations choose the numerically closest one. */
    458458        round_last_digit(frac_part, val_dist.significand, delta.significand,
    459                 one.significand, buf, len);
     459            one.significand, buf, len);
    460460
    461461        return len;
     
    504504 */
    505505int double_to_short_str(ieee_double_t ieee_val, char *buf, size_t buf_size,
    506         int *dec_exponent)
     506    int *dec_exponent)
    507507{
    508508        /* The whole computation assumes 64bit significand. */
     
    524524
    525525        calc_scaled_bounds(ieee_val, &scaled_upper_bound,
    526                 &delta, &val_dist, &scale);
     526            &delta, &val_dist, &scale);
    527527
    528528        int len = gen_dec_digits(scaled_upper_bound, delta, val_dist, scale,
    529                 buf, buf_size, dec_exponent);
     529            buf, buf_size, dec_exponent);
    530530
    531531        assert(len <= MAX_DOUBLE_STR_LEN);
     
    554554 */
    555555static int gen_fixed_dec_digits(fp_num_t w_scaled, int scale, int signif_d_cnt,
    556         int frac_d_cnt, char *buf, size_t buf_size, int *dec_exponent)
     556    int frac_d_cnt, char *buf, size_t buf_size, int *dec_exponent)
    557557{
    558558        /* We'll produce at least one digit and a null terminator. */
     
    608608        int rem_signif_d_cnt = signif_d_cnt;
    609609        int rem_frac_d_cnt =
    610                 (frac_d_cnt >= 0) ? (kappa - scale + frac_d_cnt) : INT_MAX;
     610            (frac_d_cnt >= 0) ? (kappa - scale + frac_d_cnt) : INT_MAX;
    611611
    612612        /* Produce decimal digits for the integral part of w_scaled. */
     
    752752 */
    753753int double_to_fixed_str(ieee_double_t ieee_val, int signif_d_cnt,
    754         int frac_d_cnt, char *buf, size_t buf_size, int *dec_exponent)
     754    int frac_d_cnt, char *buf, size_t buf_size, int *dec_exponent)
    755755{
    756756        /* The whole computation assumes 64bit significand. */
     
    780780        /* Produce decimal digits from the scaled number. */
    781781        int len = gen_fixed_dec_digits(w_scaled, scale, signif_d_cnt, frac_d_cnt,
    782                 buf, buf_size, dec_exponent);
     782            buf, buf_size, dec_exponent);
    783783
    784784        assert(len <= MAX_DOUBLE_STR_LEN);
  • uspace/lib/c/generic/elf/elf_mod.c

    r76d0981d r3bacee1  
    273273                // FIXME: This actually won't work, because the text segment is
    274274                // not loaded yet.
    275                 #if 0
     275#if 0
    276276                if (elf->info->interp[entry->p_filesz - 1] != '\0') {
    277277                        DPRINTF("Unterminated ELF interp string.\n");
     
    279279                }
    280280                DPRINTF("interpreter: \"%s\"\n", elf->info->interp);
    281                 #endif
     281#endif
    282282                break;
    283283        case PT_DYNAMIC:
     
    286286                    (void *)((uint8_t *)entry->p_vaddr + elf->bias);
    287287                DPRINTF("dynamic section found at %p\n",
    288                         (void *)elf->info->dynamic);
     288                    (void *)elf->info->dynamic);
    289289                break;
    290290        case 0x70000000:
     
    334334
    335335        DPRINTF("Load segment at addr %p, size 0x%zx\n", (void *) seg_addr,
    336                 entry->p_memsz);
     336            entry->p_memsz);
    337337
    338338        if (entry->p_align > 1) {
     
    394394         * need to set the right access mode and ensure SMC coherence.
    395395         */
    396         if ((elf->flags & ELDF_RW) != 0) return EE_OK;
     396        if ((elf->flags & ELDF_RW) != 0)
     397                return EE_OK;
    397398
    398399//      printf("set area flags to %d\n", flags);
  • uspace/lib/c/generic/getopt.c

    r76d0981d r3bacee1  
    132132
    133133        for (i = 0; i < ncycle; i++) {
    134                 cstart = panonopt_end+i;
     134                cstart = panonopt_end + i;
    135135                pos = cstart;
    136136                for (j = 0; j < cyclelen; j++) {
     
    181181                                    optind, nargv);
    182182                                optind -= nonopt_end - nonopt_start;
    183                         }
    184                         else if (nonopt_start != -1) {
     183                        } else if (nonopt_start != -1) {
    185184                                /*
    186185                                 * If we skipped non-options, set optind
     
    192191                        return -1;
    193192                }
    194                 if ((*(place = nargv[optind]) != '-')
    195                     || (place[1] == '\0')) {    /* found non-option */
     193                if ((*(place = nargv[optind]) != '-') ||
     194                    (place[1] == '\0')) {    /* found non-option */
    196195                        place = EMSG;
    197196                        if (IN_ORDER) {
     
    289288 *      Parse argc/argv argument vector.
    290289 */
    291 int getopt(int nargc, char * const *nargv, const char *options)
     290int getopt(int nargc, char *const *nargv, const char *options)
    292291{
    293292        int retval;
     
    305304                if (nonopt_end != -1) {
    306305                        permute_args(nonopt_start, nonopt_end, optind,
    307                                        (char **)nargv);
     306                            (char **)nargv);
    308307                        optind -= nonopt_end - nonopt_start;
    309308                }
     
    318317 *      Parse argc/argv argument vector.
    319318 */
    320 int getopt_long(int nargc, char * const *nargv, const char *options,
     319int getopt_long(int nargc, char *const *nargv, const char *options,
    321320    const struct option *long_options, int *idx)
    322321{
     
    389388                        if (PRINT_ERROR)
    390389                                printf(ambig, (int)current_argv_len,
    391                                      current_argv);
     390                                    current_argv);
    392391                        optopt = 0;
    393392                        return BADCH;
    394393                }
    395394                if (match != -1) {                      /* option found */
    396                         if (long_options[match].has_arg == no_argument
    397                             && has_equal) {
     395                        if (long_options[match].has_arg == no_argument &&
     396                            has_equal) {
    398397                                if (PRINT_ERROR)
    399398                                        printf(noarg, (int)current_argv_len,
    400                                              current_argv);
     399                                            current_argv);
    401400                                /*
    402401                                 * XXX: GNU sets optopt to val regardless of
     
    422421                                }
    423422                        }
    424                         if ((long_options[match].has_arg == required_argument)
    425                             && (optarg == NULL)) {
     423                        if ((long_options[match].has_arg == required_argument) &&
     424                            (optarg == NULL)) {
    426425                                /*
    427426                                 * Missing argument; leading ':'
  • uspace/lib/c/generic/io/io.c

    r76d0981d r3bacee1  
    388388        int rc = _fclose_nofree(stream);
    389389
    390         if ((stream != &stdin_null)
    391             && (stream != &stdout_kio)
    392             && (stream != &stderr_kio))
     390        if ((stream != &stdin_null) &&
     391            (stream != &stdout_kio) &&
     392            (stream != &stderr_kio))
    393393                free(stream);
    394394
  • uspace/lib/c/generic/io/output.c

    r76d0981d r3bacee1  
    8989        ipc_call_t answer;
    9090        aid_t req = async_send_0(exch, OUTPUT_FRONTBUF_CREATE, &answer);
    91         errno_t rc = async_share_out_start(exch, frontbuf, AS_AREA_READ
    92             | AS_AREA_WRITE | AS_AREA_CACHEABLE);
     91        errno_t rc = async_share_out_start(exch, frontbuf, AS_AREA_READ |
     92            AS_AREA_WRITE | AS_AREA_CACHEABLE);
    9393
    9494        async_exchange_end(exch);
  • uspace/lib/c/generic/tls.c

    r76d0981d r3bacee1  
    154154 * @return              Pointer to TCB structure.
    155155 */
    156 tcb_t * tls_alloc_variant_2(void **data, size_t size)
     156tcb_t *tls_alloc_variant_2(void **data, size_t size)
    157157{
    158158        tcb_t *tcb;
  • uspace/lib/c/include/adt/hash.h

    r76d0981d r3bacee1  
    106106         * http://burtleburtle.net/bob/c/lookup3.c
    107107         */
    108         seed ^= hash + 0x9e3779b9
    109                 + ((seed << 5) | (seed >> (sizeof(size_t) * 8 - 5)));
     108        seed ^= hash + 0x9e3779b9 +
     109            ((seed << 5) | (seed >> (sizeof(size_t) * 8 - 5)));
    110110        return seed;
    111111}
  • uspace/lib/c/include/io/charfield.h

    r76d0981d r3bacee1  
    9191                return (a1.val.style == a2.val.style);
    9292        case CHAR_ATTR_INDEX:
    93                 return (a1.val.index.bgcolor == a2.val.index.bgcolor)
    94                     && (a1.val.index.fgcolor == a2.val.index.fgcolor)
    95                     && (a1.val.index.attr == a2.val.index.attr);
     93                return (a1.val.index.bgcolor == a2.val.index.bgcolor) &&
     94                    (a1.val.index.fgcolor == a2.val.index.fgcolor) &&
     95                    (a1.val.index.attr == a2.val.index.attr);
    9696        case CHAR_ATTR_RGB:
    97                 return (a1.val.rgb.bgcolor == a2.val.rgb.bgcolor)
    98                     && (a1.val.rgb.fgcolor == a2.val.rgb.fgcolor);
     97                return (a1.val.rgb.bgcolor == a2.val.rgb.bgcolor) &&
     98                    (a1.val.rgb.fgcolor == a2.val.rgb.fgcolor);
    9999        }
    100100
  • uspace/lib/c/test/io/table.c

    r76d0981d r3bacee1  
    3434PCUT_TEST_SUITE(table);
    3535
    36 PCUT_TEST(smoke) {
     36PCUT_TEST(smoke)
     37{
    3738        table_t *table;
    3839        errno_t rc;
  • uspace/lib/c/test/odict.c

    r76d0981d r3bacee1  
    226226        PCUT_ASSERT_EQUALS(true, odict_empty(&odict));
    227227
    228         v = 1; ep = NULL;
     228        v = 1;
     229        ep = NULL;
    229230        for (i = 0; i < test_seq_len; i++) {
    230231                e = calloc(1, sizeof(test_entry_t));
  • uspace/lib/c/test/sprintf.c

    r76d0981d r3bacee1  
    4848static char buffer[BUFFER_SIZE];
    4949
    50 PCUT_TEST_BEFORE {
     50PCUT_TEST_BEFORE
     51{
    5152        memset(buffer, 0, BUFFER_SIZE);
    5253}
  • uspace/lib/c/test/str.c

    r76d0981d r3bacee1  
    4444static char buffer[BUFFER_SIZE];
    4545
    46 PCUT_TEST_BEFORE {
     46PCUT_TEST_BEFORE
     47{
    4748        memset(buffer, 0, BUFFER_SIZE);
    4849}
    4950
    5051
    51 PCUT_TEST(rtrim) {
     52PCUT_TEST(rtrim)
     53{
    5254        SET_BUFFER("foobar");
    5355        str_rtrim(buffer, ' ');
     
    6769}
    6870
    69 PCUT_TEST(ltrim) {
     71PCUT_TEST(ltrim)
     72{
    7073        SET_BUFFER("foobar");
    7174        str_ltrim(buffer, ' ');
Note: See TracChangeset for help on using the changeset viewer.