Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 472c09d in mainline for uspace/srv/hid/console/console.c


Ignore:
Timestamp:
2010-02-03T15:18:40Z (12 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master
Children:
b4cbef1
Parents:
28be7fa
Message:

more consistent naming scheme:

async_data_blob_receive → async_data_receive
async_data_string_receive → async_string_receive
CLIPBOARD_TAG_BLOB → CLIPBOARD_TAG_DATA

async_data_receive can now check the granularity of the received data
async_string_receive can now return the raw size of the received data

replace several common patterns of async_data_write_receive/_finalize
with a single async_data_receive/_string_receive (this greatly improves
code readability)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/hid/console/console.c

    r28be7fa r472c09d  
    475475static void cons_write(console_t *cons, ipc_callid_t rid, ipc_call_t *request)
    476476{
    477         ipc_callid_t callid;
     477        void *buf;
    478478        size_t size;
    479         if (!async_data_write_receive(&callid, &size)) {
    480                 ipc_answer_0(callid, EINVAL);
    481                 ipc_answer_0(rid, EINVAL);
     479        int rc = async_data_receive(&buf, 0, 0, &size);
     480       
     481        if (rc != EOK) {
     482                ipc_answer_0(rid, rc);
    482483                return;
    483484        }
    484        
    485         char *buf = (char *) malloc(size);
    486         if (buf == NULL) {
    487                 ipc_answer_0(callid, ENOMEM);
    488                 ipc_answer_0(rid, ENOMEM);
    489                 return;
    490         }
    491        
    492         (void) async_data_write_finalize(callid, buf, size);
    493485       
    494486        async_serialize_start();
Note: See TracChangeset for help on using the changeset viewer.