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

    r3061bc1 ra35b458  
    6060        service_id_t sid;
    6161        errno_t rc;
    62        
     62
    6363        fibril_mutex_lock(&clip_mutex);
    64        
     64
    6565        while (clip_sess == NULL) {
    6666                rc = loc_service_get_id(SERVICE_NAME_CLIPBOARD, &sid,
     
    6868                if (rc != EOK)
    6969                        continue;
    70                
     70
    7171                clip_sess = loc_service_connect(sid, INTERFACE_CLIPBOARD,
    7272                    IPC_FLAG_BLOCKING);
    7373        }
    74        
     74
    7575        fibril_mutex_unlock(&clip_mutex);
    76        
     76
    7777        return async_exchange_begin(clip_sess);
    7878}
     
    101101{
    102102        size_t size = str_size(str);
    103        
     103
    104104        if (size == 0) {
    105105                async_exch_t *exch = clip_exchange_begin();
     
    107107                    CLIPBOARD_TAG_NONE);
    108108                clip_exchange_end(exch);
    109                
     109
    110110                return (errno_t) rc;
    111111        } else {
     
    115115                errno_t rc = async_data_write_start(exch, (void *) str, size);
    116116                clip_exchange_end(exch);
    117                
     117
    118118                if (rc != EOK) {
    119119                        errno_t rc_orig;
     
    124124                                return (errno_t) rc_orig;
    125125                }
    126                
     126
    127127                async_wait_for(req, &rc);
    128                
     128
    129129                return (errno_t) rc;
    130130        }
     
    145145        while (true) {
    146146                async_exch_t *exch = clip_exchange_begin();
    147                
     147
    148148                sysarg_t size;
    149149                sysarg_t tag;
    150150                errno_t rc = async_req_0_2(exch, CLIPBOARD_CONTENT, &size, &tag);
    151                
     151
    152152                clip_exchange_end(exch);
    153                
     153
    154154                if (rc != EOK)
    155155                        return (errno_t) rc;
    156                
     156
    157157                char *sbuf;
    158                
     158
    159159                switch (tag) {
    160160                case CLIPBOARD_TAG_NONE:
     
    162162                        if (sbuf == NULL)
    163163                                return ENOMEM;
    164                        
     164
    165165                        sbuf[0] = 0;
    166166                        *str = sbuf;
     
    170170                        if (sbuf == NULL)
    171171                                return ENOMEM;
    172                        
     172
    173173                        exch = clip_exchange_begin();
    174174                        aid_t req = async_send_1(exch, CLIPBOARD_GET_DATA, tag, NULL);
    175175                        rc = async_data_read_start(exch, (void *) sbuf, size);
    176176                        clip_exchange_end(exch);
    177                        
     177
    178178                        if ((errno_t) rc == EOVERFLOW) {
    179179                                /*
     
    183183                                break;
    184184                        }
    185                        
     185
    186186                        if (rc != EOK) {
    187187                                errno_t rc_orig;
     
    192192                                        return (errno_t) rc_orig;
    193193                        }
    194                        
     194
    195195                        async_wait_for(req, &rc);
    196                        
     196
    197197                        if (rc == EOK) {
    198198                                sbuf[size] = 0;
    199199                                *str = sbuf;
    200200                        }
    201                        
     201
    202202                        return rc;
    203203                default:
Note: See TracChangeset for help on using the changeset viewer.