Changeset 3090715 in mainline for uspace/lib/c/generic/adt/measured_strings.c
- Timestamp:
- 2010-11-07T21:16:56Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 1d0d06a
- Parents:
- 9ce7eb5 (diff), 9ee9d5d (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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/adt/measured_strings.c
r9ce7eb5 r3090715 41 41 #include <unistd.h> 42 42 #include <errno.h> 43 #include <err.h>44 43 #include <async.h> 45 44 … … 135 134 size_t count) 136 135 { 137 ERROR_DECLARE;138 139 136 size_t *lengths; 140 137 size_t index; … … 142 139 char *next; 143 140 ipc_callid_t callid; 141 int rc; 144 142 145 143 if ((!strings) || (!data) || (count <= 0)) … … 155 153 return EINVAL; 156 154 } 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; 161 159 } 162 160 … … 187 185 return EINVAL; 188 186 } 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) { 191 190 free(*data); 192 191 free(*strings); 193 192 free(lengths); 194 return ERROR_CODE;193 return rc; 195 194 } 196 195 (*strings)[index].value = next; … … 251 250 int measured_strings_reply(const measured_string_ref strings, size_t count) 252 251 { 253 ERROR_DECLARE;254 255 252 size_t *lengths; 256 253 size_t index; 257 254 size_t length; 258 255 ipc_callid_t callid; 256 int rc; 259 257 260 258 if ((!strings) || (count <= 0)) … … 270 268 return EINVAL; 271 269 } 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; 275 274 } 276 275 free(lengths); … … 282 281 return EINVAL; 283 282 } 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; 286 287 } 287 288 } … … 313 314 size_t count) 314 315 { 315 ERROR_DECLARE;316 317 316 size_t *lengths; 318 317 size_t index; 319 318 char *next; 319 int rc; 320 320 321 321 if ((phone < 0) || (!strings) || (!data) || (count <= 0)) … … 326 326 return ENOMEM; 327 327 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; 332 333 } 333 334 … … 350 351 (*strings)[index].length = lengths[index]; 351 352 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) { 354 355 free(lengths); 355 356 free(data); 356 357 free(strings); 357 return ERROR_CODE;358 return rc; 358 359 } 359 360 (*strings)[index].value = next; … … 387 388 size_t count) 388 389 { 389 ERROR_DECLARE;390 391 390 size_t *lengths; 392 391 size_t index; 392 int rc; 393 393 394 394 if ((phone < 0) || (!strings) || (count <= 0)) … … 399 399 return ENOMEM; 400 400 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; 405 406 } 406 407 … … 409 410 for (index = 0; index < count; index++) { 410 411 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; 413 416 } 414 417 }
Note:
See TracChangeset
for help on using the changeset viewer.