Ignore:
Timestamp:
2010-11-13T19:12:37Z (13 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c7137738
Parents:
63a1e60 (diff), 71e3289 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/adt/measured_strings.c

    r63a1e60 r7494fb4  
    4141#include <unistd.h>
    4242#include <errno.h>
    43 #include <err.h>
    4443#include <async.h>
    4544
     
    135134    size_t count)
    136135{
    137         ERROR_DECLARE;
    138 
    139136        size_t *lengths;
    140137        size_t index;
     
    142139        char *next;
    143140        ipc_callid_t callid;
     141        int rc;
    144142
    145143        if ((!strings) || (!data) || (count <= 0))
     
    155153                return EINVAL;
    156154        }
    157         if (ERROR_OCCURRED(async_data_write_finalize(callid, lengths,
    158             length))) {
    159                 free(lengths);
    160                 return ERROR_CODE;
     155        rc = async_data_write_finalize(callid, lengths, length);
     156        if (rc != EOK) {
     157                free(lengths);
     158                return rc;
    161159        }
    162160
     
    187185                                return EINVAL;
    188186                        }
    189                         if (ERROR_OCCURRED(async_data_write_finalize(callid,
    190                             next, lengths[index]))) {
     187                        rc = async_data_write_finalize(callid, next,
     188                            lengths[index]);
     189                        if (rc != EOK) {
    191190                                free(*data);
    192191                                free(*strings);
    193192                                free(lengths);
    194                                 return ERROR_CODE;
     193                                return rc;
    195194                        }
    196195                        (*strings)[index].value = next;
     
    251250int measured_strings_reply(const measured_string_ref strings, size_t count)
    252251{
    253         ERROR_DECLARE;
    254 
    255252        size_t *lengths;
    256253        size_t index;
    257254        size_t length;
    258255        ipc_callid_t callid;
     256        int rc;
    259257
    260258        if ((!strings) || (count <= 0))
     
    270268                return EINVAL;
    271269        }
    272         if (ERROR_OCCURRED(async_data_read_finalize(callid, lengths, length))) {
    273                 free(lengths);
    274                 return ERROR_CODE;
     270        rc = async_data_read_finalize(callid, lengths, length);
     271        if (rc != EOK) {
     272                free(lengths);
     273                return rc;
    275274        }
    276275        free(lengths);
     
    282281                                return EINVAL;
    283282                        }
    284                         ERROR_PROPAGATE(async_data_read_finalize(callid,
    285                             strings[index].value, strings[index].length));
     283                        rc = async_data_read_finalize(callid,
     284                            strings[index].value, strings[index].length);
     285                        if (rc != EOK)
     286                                return rc;
    286287                }
    287288        }
     
    313314    size_t count)
    314315{
    315         ERROR_DECLARE;
    316 
    317316        size_t *lengths;
    318317        size_t index;
    319318        char *next;
     319        int rc;
    320320
    321321        if ((phone < 0) || (!strings) || (!data) || (count <= 0))
     
    326326                return ENOMEM;
    327327
    328         if (ERROR_OCCURRED(async_data_read_start(phone, lengths,
    329             sizeof(size_t) * (count + 1)))) {
    330                 free(lengths);
    331                 return ERROR_CODE;
     328        rc = async_data_read_start(phone, lengths,
     329            sizeof(size_t) * (count + 1));
     330        if (rc != EOK) {
     331                free(lengths);
     332                return rc;
    332333        }
    333334
     
    350351                (*strings)[index].length = lengths[index];
    351352                if (lengths[index] > 0) {
    352                         if (ERROR_OCCURRED(async_data_read_start(phone, next,
    353                             lengths[index]))) {
     353                        rc = async_data_read_start(phone, next, lengths[index]);
     354                        if (rc != EOK) {
    354355                                free(lengths);
    355356                                free(data);
    356357                                free(strings);
    357                                 return ERROR_CODE;
     358                                return rc;
    358359                        }
    359360                        (*strings)[index].value = next;
     
    387388    size_t count)
    388389{
    389         ERROR_DECLARE;
    390 
    391390        size_t *lengths;
    392391        size_t index;
     392        int rc;
    393393
    394394        if ((phone < 0) || (!strings) || (count <= 0))
     
    399399                return ENOMEM;
    400400
    401         if (ERROR_OCCURRED(async_data_write_start(phone, lengths,
    402             sizeof(size_t) * (count + 1)))) {
    403                 free(lengths);
    404                 return ERROR_CODE;
     401        rc = async_data_write_start(phone, lengths,
     402            sizeof(size_t) * (count + 1));
     403        if (rc != EOK) {
     404                free(lengths);
     405                return rc;
    405406        }
    406407
     
    409410        for (index = 0; index < count; index++) {
    410411                if (strings[index].length > 0) {
    411                         ERROR_PROPAGATE(async_data_write_start(phone,
    412                             strings[index].value, strings[index].length));
     412                        rc = async_data_write_start(phone, strings[index].value,
     413                            strings[index].length);
     414                        if (rc != EOK)
     415                                return rc;
    413416                }
    414417        }
Note: See TracChangeset for help on using the changeset viewer.