Changeset a35b458 in mainline for uspace/lib/c/generic/loader.c


Ignore:
Timestamp:
2018-03-02T20:10:49Z (7 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f1380b7
Parents:
3061bc1
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-02-28 17:38:31)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-03-02 20:10:49)
Message:

style: Remove trailing whitespace on _all_ lines, including empty ones, for particular file types.

Command used: tools/srepl '\s\+$' '' -- *.c *.h *.py *.sh *.s *.S *.ag

Currently, whitespace on empty lines is very inconsistent.
There are two basic choices: Either remove the whitespace, or keep empty lines
indented to the level of surrounding code. The former is AFAICT more common,
and also much easier to do automatically.

Alternatively, we could write script for automatic indentation, and use that
instead. However, if such a script exists, it's possible to use the indented
style locally, by having the editor apply relevant conversions on load/save,
without affecting remote repository. IMO, it makes more sense to adopt
the simpler rule.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/loader.c

    r3061bc1 ra35b458  
    6565        if (ldr == NULL)
    6666                return NULL;
    67        
     67
    6868        async_sess_t *sess =
    6969            service_connect_blocking(SERVICE_LOADER, INTERFACE_LOADER, 0);
     
    7272                return NULL;
    7373        }
    74        
     74
    7575        ldr->sess = sess;
    7676        return ldr;
     
    9191        /* Get task ID. */
    9292        async_exch_t *exch = async_exchange_begin(ldr->sess);
    93        
     93
    9494        ipc_call_t answer;
    9595        aid_t req = async_send_0(exch, LOADER_GET_TASKID, &answer);
    9696        errno_t rc = async_data_read_start(exch, task_id, sizeof(task_id_t));
    97        
    98         async_exchange_end(exch);
    99        
     97
     98        async_exchange_end(exch);
     99
    100100        if (rc != EOK) {
    101101                async_forget(req);
    102102                return (errno_t) rc;
    103103        }
    104        
     104
    105105        async_wait_for(req, &rc);
    106106        return (errno_t) rc;
     
    121121        if (!cwd)
    122122                return ENOMEM;
    123        
     123
    124124        if (vfs_cwd_get(cwd, MAX_PATH_LEN + 1) != EOK)
    125125                str_cpy(cwd, MAX_PATH_LEN + 1, "/");
    126        
     126
    127127        size_t len = str_length(cwd);
    128        
    129         async_exch_t *exch = async_exchange_begin(ldr->sess);
    130        
     128
     129        async_exch_t *exch = async_exchange_begin(ldr->sess);
     130
    131131        ipc_call_t answer;
    132132        aid_t req = async_send_0(exch, LOADER_SET_CWD, &answer);
    133133        errno_t rc = async_data_write_start(exch, cwd, len);
    134        
     134
    135135        async_exchange_end(exch);
    136136        free(cwd);
    137        
     137
    138138        if (rc != EOK) {
    139139                async_forget(req);
    140140                return (errno_t) rc;
    141141        }
    142        
     142
    143143        async_wait_for(req, &rc);
    144144        return (errno_t) rc;
     
    195195                name++;
    196196        }
    197        
     197
    198198        int fd;
    199199        errno_t rc = vfs_lookup(path, 0, &fd);
     
    201201                return rc;
    202202        }
    203        
     203
    204204        rc = loader_set_program(ldr, name, fd);
    205205        vfs_put(fd);
     
    232232                ap++;
    233233        }
    234        
     234
    235235        char *arg_buf = malloc(buffer_size);
    236236        if (arg_buf == NULL)
    237237                return ENOMEM;
    238        
     238
    239239        /* Now fill the buffer with null-terminated argument strings */
    240240        ap = argv;
    241241        char *dp = arg_buf;
    242        
     242
    243243        while (*ap != NULL) {
    244244                str_cpy(dp, buffer_size - (dp - arg_buf), *ap);
     
    246246                ap++;
    247247        }
    248        
     248
    249249        /* Send serialized arguments to the loader */
    250250        async_exch_t *exch = async_exchange_begin(ldr->sess);
    251        
     251
    252252        ipc_call_t answer;
    253253        aid_t req = async_send_0(exch, LOADER_SET_ARGS, &answer);
    254254        errno_t rc = async_data_write_start(exch, (void *) arg_buf,
    255255            buffer_size);
    256        
     256
    257257        async_exchange_end(exch);
    258258        free(arg_buf);
    259        
     259
    260260        if (rc != EOK) {
    261261                async_forget(req);
    262262                return (errno_t) rc;
    263263        }
    264        
     264
    265265        async_wait_for(req, &rc);
    266266        return (errno_t) rc;
     
    280280        async_exch_t *exch = async_exchange_begin(ldr->sess);
    281281        async_exch_t *vfs_exch = vfs_exchange_begin();
    282        
     282
    283283        aid_t req = async_send_0(exch, LOADER_ADD_INBOX, NULL);
    284        
     284
    285285        errno_t rc = async_data_write_start(exch, name, str_size(name) + 1);
    286286        if (rc == EOK) {
    287287                rc = vfs_pass_handle(vfs_exch, file, exch);
    288288        }
    289        
     289
    290290        async_exchange_end(vfs_exch);
    291291        async_exchange_end(exch);
    292        
     292
    293293        if (rc == EOK) {
    294294                async_wait_for(req, &rc);
     
    296296                async_forget(req);
    297297        }
    298        
     298
    299299        return (errno_t) rc;
    300300}
     
    315315        errno_t rc = async_req_0_0(exch, LOADER_LOAD);
    316316        async_exchange_end(exch);
    317        
     317
    318318        return rc;
    319319}
     
    338338        errno_t rc = async_req_0_0(exch, LOADER_RUN);
    339339        async_exchange_end(exch);
    340        
     340
    341341        if (rc != EOK)
    342342                return rc;
    343        
     343
    344344        async_hangup(ldr->sess);
    345345        free(ldr);
    346        
     346
    347347        return EOK;
    348348}
Note: See TracChangeset for help on using the changeset viewer.