Changeset b7fd2a0 in mainline for uspace/app/bdsh/tok.c


Ignore:
Timestamp:
2018-01-13T03:10:29Z (6 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a53ed3a
Parents:
36f0738
Message:

Use errno_t in all uspace and kernel code.

Change type of every variable, parameter and return value that holds an
<errno.h> constant to either errno_t (the usual case), or sys_errno_t
(some places in kernel). This is for the purpose of self-documentation,
as well as for type-checking with a bit of type definition hackery.

Although this is a massive commit, it is a simple text replacement, and thus
is very easy to verify. Simply do the following:

`
git checkout <this commit's hash>
git reset HEAD
git add .
tools/srepl '\berrno_t\b' int
git add .
tools/srepl '\bsys_errno_t\b' sysarg_t
git reset
git diff
`

While this doesn't ensure that the replacements are correct, it does ensure
that the commit doesn't do anything except those replacements. Since errno_t
is typedef'd to int in the usual case (and sys_errno_t to sysarg_t), even if
incorrect, this commit cannot change behavior.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/bdsh/tok.c

    r36f0738 rb7fd2a0  
    3838static wchar_t tok_get_char(tokenizer_t *);
    3939static wchar_t tok_look_char(tokenizer_t *);
    40 static int tok_push_char(tokenizer_t *, wchar_t);
    41 static int tok_push_token(tokenizer_t *);
     40static errno_t tok_push_char(tokenizer_t *, wchar_t);
     41static errno_t tok_push_token(tokenizer_t *);
    4242static bool tok_pending_chars(tokenizer_t *);
    43 static int tok_finish_string(tokenizer_t *);
     43static errno_t tok_finish_string(tokenizer_t *);
    4444static void tok_start_token(tokenizer_t *, token_type_t);
    4545
     
    5151 * @param max_tokens number of elements of the out_tokens array
    5252 */
    53 int tok_init(tokenizer_t *tok, char *input, token_t *out_tokens,
     53errno_t tok_init(tokenizer_t *tok, char *input, token_t *out_tokens,
    5454    size_t max_tokens)
    5555{       
     
    8989
    9090/** Tokenize the input string into the tokens */
    91 int tok_tokenize(tokenizer_t *tok, size_t *tokens_length)
    92 {
    93         int rc;
     91errno_t tok_tokenize(tokenizer_t *tok, size_t *tokens_length)
     92{
     93        errno_t rc;
    9494        wchar_t next_char;
    9595       
     
    178178
    179179/** Finish tokenizing an opened string */
    180 int tok_finish_string(tokenizer_t *tok)
    181 {
    182         int rc;
     180errno_t tok_finish_string(tokenizer_t *tok)
     181{
     182        errno_t rc;
    183183        wchar_t next_char;
    184184       
     
    233233
    234234/** Append a char to the end of the current token */
    235 int tok_push_char(tokenizer_t *tok, wchar_t ch)
     235errno_t tok_push_char(tokenizer_t *tok, wchar_t ch)
    236236{
    237237        return chr_encode(ch, tok->outbuf, &tok->outbuf_offset, tok->outbuf_size);
     
    244244
    245245/** Push the current token to the output array */
    246 int tok_push_token(tokenizer_t *tok)
     246errno_t tok_push_token(tokenizer_t *tok)
    247247{
    248248        if (tok->outtok_offset >= tok->outtok_size) {
Note: See TracChangeset for help on using the changeset viewer.