Changeset a35b458 in mainline for uspace/lib/uri/uri.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/uri/uri.c

    r3061bc1 ra35b458  
    5656                return NULL;
    5757        memset(uri, 0, sizeof(uri_t));
    58        
     58
    5959        /* scheme ":" */
    6060        const char *scheme = str;
     
    6565        }
    6666        uri->scheme = cut_str(scheme, str);
    67        
     67
    6868        /* skip the colon */
    6969        str++;
    70        
     70
    7171        if (*str == '/' && str[1] == '/') {
    7272                /* "//" [user-info [":" user-credential] "@"] host [":" port] */
     
    7474                str++;
    7575                const char *authority_start = str;
    76        
     76
    7777                char *host_or_user_info = NULL;
    7878                char *port_or_user_credential = NULL;
    79        
     79
    8080                while (*str != 0 && *str != '?' && *str != '#' && *str != '@'
    8181                        && *str != ':' && *str != '/')
    8282                        str++;
    83        
     83
    8484                host_or_user_info = cut_str(authority_start, str);
    8585                if (*str == ':') {
     
    9090                        port_or_user_credential = cut_str(second_part, str);
    9191                }
    92        
     92
    9393                if (*str == '@') {
    9494                        uri->user_info = host_or_user_info;
    9595                        uri->user_credential = port_or_user_credential;
    96                
     96
    9797                        str++;
    9898                        const char *host_start = str;
     
    100100                                && *str != ':' && *str != '/') str++;
    101101                        uri->host = cut_str(host_start, str);
    102                
     102
    103103                        if (*str == ':') {
    104104                                str++;
     
    114114                }
    115115        }
    116        
     116
    117117        const char *path_start = str;
    118118        while (*str != 0 && *str != '?' && *str != '#') str++;
    119119        uri->path = cut_str(path_start, str);
    120        
     120
    121121        if (*str == '?') {
    122122                str++;
     
    125125                uri->query = cut_str(query_start, str);
    126126        }
    127        
     127
    128128        if (*str == '#') {
    129129                str++;
     
    132132                uri->fragment = cut_str(fragment_start, str);
    133133        }
    134        
     134
    135135        assert(*str == 0);
    136136        return uri;
     
    149149                return ELIMIT;
    150150        }
    151        
     151
    152152        if (!isalpha(*str)) {
    153153                *endptr = str;
    154154                return EINVAL;
    155155        }
    156        
     156
    157157        while (isalpha(*str) || isdigit(*str) ||
    158158            *str == '+' || *str == '-' || *str == '.') {
    159159                str++;
    160160        }
    161        
     161
    162162        *endptr = str;
    163163        return EOK;
     
    181181        if (str[0] == 0 || str[1] == 0 || str[2] == 0)
    182182                return ELIMIT;
    183        
     183
    184184        if (str[0] != '%' || !is_hexdig(str[1]) || !is_hexdig(str[2]))
    185185                return EINVAL;
    186        
     186
    187187        if (decoded != NULL) {
    188188                errno_t rc = str_uint8_t(str + 1, NULL, 16, true, decoded);
     
    190190                        return rc;
    191191        }
    192        
     192
    193193        *endptr = str + 3;
    194194        return EOK;
     
    207207                }
    208208        }
    209        
     209
    210210        *endptr = str;
    211211        return EOK;
     
    243243        if (uri->scheme && !uri_scheme_validate(uri->scheme))
    244244                return false;
    245        
     245
    246246        if (uri->user_info && !uri_user_info_validate(uri->user_info))
    247247                return false;
    248        
     248
    249249        if (uri->user_credential && !uri_user_info_validate(uri->user_credential))
    250250                return false;
    251        
     251
    252252        if (uri->port && !uri_port_validate(uri->port))
    253253                return false;
    254        
     254
    255255        return true;
    256256}
Note: See TracChangeset for help on using the changeset viewer.