Changeset a35b458 in mainline for uspace/app/bdsh/compl.c


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

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

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

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

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

File:
1 edited

Legend:

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

    r3061bc1 ra35b458  
    9595        char *dirname = NULL;
    9696        errno_t retval;
    97        
     97
    9898        token_t *tokens = calloc(WORD_MAX, sizeof(token_t));
    9999        if (tokens == NULL) {
     
    101101                goto error;
    102102        }
    103        
     103
    104104        size_t pref_size;
    105105        char *rpath_sep;
     
    108108        ssize_t current_token;
    109109        size_t tokens_length;
    110        
     110
    111111        cs = calloc(1, sizeof(compl_t));
    112112        if (!cs) {
     
    114114                goto error;
    115115        }
    116        
     116
    117117        /* Convert text buffer to string */
    118118        stext = wstr_to_astr(text);
     
    121121                goto error;
    122122        }
    123        
     123
    124124        /* Tokenize the input string */
    125125        retval = tok_init(&tok, stext, tokens, WORD_MAX);
     
    127127                goto error;
    128128        }
    129        
     129
    130130        retval = tok_tokenize(&tok, &tokens_length);
    131131        if (retval != EOK) {
    132132                goto error;
    133133        }
    134        
     134
    135135        /* Find the current token */
    136136        for (current_token = 0; current_token < (ssize_t) tokens_length;
     
    138138                token_t *t = &tokens[current_token];
    139139                size_t end = t->char_start + t->char_length;
    140                
     140
    141141                /*
    142142                 * Check if the caret lies inside the token or immediately
     
    147147                }
    148148        }
    149        
     149
    150150        if (tokens_length == 0)
    151151                current_token = -1;
    152        
     152
    153153        if ((current_token >= 0) && (tokens[current_token].type != TOKTYPE_SPACE))
    154154                *cstart = tokens[current_token].char_start;
    155155        else
    156156                *cstart = pos;
    157        
     157
    158158        /*
    159159         * Extract the prefix being completed
     
    183183        if ((prev_token >= 0) && (tokens[prev_token].type == TOKTYPE_SPACE))
    184184                prev_token--;
    185        
     185
    186186        /*
    187187         * It is a command if it is the first token or if it immediately
     
    236236
    237237        cs->prefix_len = str_length(cs->prefix);
    238        
     238
    239239        tok_fini(&tok);
    240240
     
    244244error:
    245245        /* Error cleanup */
    246        
     246
    247247        tok_fini(&tok);
    248248
     
    258258        if ((cs != NULL) && (cs->prefix != NULL))
    259259                free(cs->prefix);
    260        
     260
    261261        if (dirname != NULL)
    262262                free(dirname);
    263        
     263
    264264        if (prefix != NULL)
    265265                free(prefix);
    266        
     266
    267267        if (stext != NULL)
    268268                free(stext);
    269        
     269
    270270        if (cs != NULL)
    271271                free(cs);
    272        
     272
    273273        if (tokens != NULL)
    274274                free(tokens);
Note: See TracChangeset for help on using the changeset viewer.