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/drv/generic/remote_ieee80211.c

    r3061bc1 ra35b458  
    6666{
    6767        assert(results);
    68        
     68
    6969        async_exch_t *exch = async_exchange_begin(dev_sess);
    70        
     70
    7171        aid_t aid = async_send_2(exch, DEV_IFACE_ID(IEEE80211_DEV_IFACE),
    7272            IEEE80211_GET_SCAN_RESULTS, now, NULL);
     
    7474            sizeof(ieee80211_scan_results_t));
    7575        async_exchange_end(exch);
    76        
     76
    7777        errno_t res;
    7878        async_wait_for(aid, &res);
    79        
     79
    8080        if(res != EOK)
    8181                return (errno_t) res;
    82        
     82
    8383        return rc;
    8484}
     
    9090                        return false;
    9191        }
    92        
     92
    9393        return true;
    9494}
     
    9999        inet_link_info_t link_info;
    100100        size_t count;
    101        
     101
    102102        errno_t rc = inetcfg_get_link_list(&link_list, &count);
    103103        if (rc != EOK)
    104104                return -1;
    105        
     105
    106106        for (size_t i = 0; i < count; i++) {
    107107                rc = inetcfg_link_get(link_list[i], &link_info);
    108108                if (rc != EOK)
    109109                        return -1;
    110                
     110
    111111                if (mac_matches(mac, link_info.mac_addr))
    112112                        return link_list[i];
    113113        }
    114        
     114
    115115        return -1;
    116116}
     
    129129{
    130130        assert(ssid_start);
    131        
     131
    132132        errno_t rc_orig;
    133        
     133
    134134        async_exch_t *exch = async_exchange_begin(dev_sess);
    135        
     135
    136136        aid_t aid = async_send_1(exch, DEV_IFACE_ID(IEEE80211_DEV_IFACE),
    137137            IEEE80211_CONNECT, NULL);
    138        
     138
    139139        errno_t rc = async_data_write_start(exch, ssid_start,
    140140            str_size(ssid_start) + 1);
     
    142142                async_exchange_end(exch);
    143143                async_wait_for(aid, &rc_orig);
    144                
     144
    145145                if (rc_orig == EOK)
    146146                        return (errno_t) rc;
    147                
     147
    148148                return (errno_t) rc_orig;
    149149        }
    150        
     150
    151151        // FIXME: Typecasting string literal
    152152        if (password == NULL)
    153153                password = (char *) "";
    154        
     154
    155155        rc = async_data_write_start(exch, password, str_size(password) + 1);
    156156        if (rc != EOK) {
    157157                async_exchange_end(exch);
    158158                async_wait_for(aid, &rc_orig);
    159                
     159
    160160                if (rc_orig == EOK)
    161161                        return (errno_t) rc;
    162                
     162
    163163                return (errno_t) rc_orig;
    164164        }
    165        
     165
    166166        async_exchange_end(exch);
    167        
     167
    168168        async_wait_for(aid, &rc);
    169169        if (rc != EOK)
    170170                return rc;
    171        
     171
    172172        /* Send DHCP discover. */
    173173        nic_address_t wifi_mac;
     
    175175        if (rc != EOK)
    176176                return rc;
    177        
     177
    178178        sysarg_t link_id = get_link_id(wifi_mac.address);
    179179        if (link_id == ((sysarg_t) -1))
    180180                return EINVAL;
    181        
     181
    182182        rc = dhcp_discover(link_id);
    183        
     183
    184184        return (errno_t) rc;
    185185}
     
    199199            IEEE80211_DISCONNECT);
    200200        async_exchange_end(exch);
    201        
    202         if (rc != EOK)
    203                 return rc;
    204        
     201
     202        if (rc != EOK)
     203                return rc;
     204
    205205        nic_address_t wifi_mac;
    206206        rc = nic_get_address(dev_sess, &wifi_mac);
    207207        if (rc != EOK)
    208208                return rc;
    209        
     209
    210210        inet_link_info_t link_info;
    211211        inet_addr_info_t addr_info;
     
    214214        sysarg_t *route_list;
    215215        size_t count;
    216        
     216
    217217        /* Remove previous DHCP address. */
    218218        rc = inetcfg_get_addr_list(&addr_list, &count);
    219219        if (rc != EOK)
    220220                return rc;
    221        
     221
    222222        for (size_t i = 0; i < count; i++) {
    223223                rc = inetcfg_addr_get(addr_list[i], &addr_info);
    224224                if (rc != EOK)
    225225                        return rc;
    226                
     226
    227227                rc = inetcfg_link_get(addr_info.ilink, &link_info);
    228228                if (rc != EOK)
    229229                        return rc;
    230                
     230
    231231                if (mac_matches(wifi_mac.address, link_info.mac_addr)) {
    232232                        if (str_test_prefix(addr_info.name, "dhcp")) {
     
    234234                                if (rc != EOK)
    235235                                        return rc;
    236                                
     236
    237237                                break;
    238238                        }
    239239                }
    240240        }
    241        
     241
    242242        /*
    243243         * TODO: At this moment there can be only one DHCP route,
     
    249249        if (rc != EOK)
    250250                return rc;
    251        
     251
    252252        for (size_t i = 0; i < count; i++) {
    253253                rc = inetcfg_sroute_get(route_list[i], &route_info);
    254254                if (rc != EOK)
    255255                        return rc;
    256                
     256
    257257                if (str_test_prefix(route_info.name, "dhcp")) {
    258258                        rc = inetcfg_sroute_delete(route_list[i]);
    259259                        if (rc != EOK)
    260260                                return rc;
    261                        
     261
    262262                        break;
    263263                }
    264264        }
    265        
     265
    266266        return rc;
    267267}
     
    272272        ieee80211_iface_t *ieee80211_iface = (ieee80211_iface_t *) iface;
    273273        assert(ieee80211_iface->get_scan_results);
    274        
     274
    275275        ieee80211_scan_results_t scan_results;
    276276        memset(&scan_results, 0, sizeof(ieee80211_scan_results_t));
    277        
     277
    278278        bool now = IPC_GET_ARG2(*call);
    279        
     279
    280280        errno_t rc = ieee80211_iface->get_scan_results(fun, &scan_results, now);
    281281        if (rc == EOK) {
     
    287287                        return;
    288288                }
    289                
     289
    290290                if (max_len < sizeof(ieee80211_scan_results_t)) {
    291291                        async_answer_0(data_callid, ELIMIT);
     
    293293                        return;
    294294                }
    295                
     295
    296296                async_data_read_finalize(data_callid, &scan_results,
    297297                    sizeof(ieee80211_scan_results_t));
    298298        }
    299        
     299
    300300        async_answer_0(callid, rc);
    301301}
     
    306306        ieee80211_iface_t *ieee80211_iface = (ieee80211_iface_t *) iface;
    307307        assert(ieee80211_iface->connect);
    308        
     308
    309309        char ssid_start[MAX_STRING_SIZE];
    310310        char password[MAX_STRING_SIZE];
    311        
     311
    312312        ipc_callid_t data_callid;
    313313        size_t len;
     
    317317                return;
    318318        }
    319        
     319
    320320        if (len > MAX_STRING_SIZE) {
    321321                async_answer_0(data_callid, EINVAL);
     
    323323                return;
    324324        }
    325        
     325
    326326        errno_t rc = async_data_write_finalize(data_callid, ssid_start, len);
    327327        if (rc != EOK) {
     
    330330                return;
    331331        }
    332        
     332
    333333        if (!async_data_write_receive(&data_callid, &len)) {
    334334                async_answer_0(data_callid, EINVAL);
     
    336336                return;
    337337        }
    338        
     338
    339339        if (len > MAX_STRING_SIZE) {
    340340                async_answer_0(data_callid, EINVAL);
     
    342342                return;
    343343        }
    344        
     344
    345345        rc = async_data_write_finalize(data_callid, password, len);
    346346        if (rc != EOK) {
     
    349349                return;
    350350        }
    351        
     351
    352352        rc = ieee80211_iface->connect(fun, ssid_start, password);
    353        
     353
    354354        async_answer_0(callid, rc);
    355355}
Note: See TracChangeset for help on using the changeset viewer.