Changeset fdbc3ff in mainline for uspace/lib/c/generic/adt/measured_strings.c
- Timestamp:
- 2010-11-19T23:50:06Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 46d4d9f
- Parents:
- b4c9c61 (diff), a9c6b966 (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
rb4c9c61 rfdbc3ff 55 55 * appended with the terminating zero ('\0') character 56 56 * otherwise. 57 * @return sThe new bundled character string with measured length.58 * @return sNULL if there is not enough memory left.59 */ 60 measured_string_ ref57 * @return The new bundled character string with measured length. 58 * @return NULL if there is not enough memory left. 59 */ 60 measured_string_t * 61 61 measured_string_create_bulk(const char *string, size_t length) 62 62 { 63 measured_string_ refnew;63 measured_string_t *new; 64 64 65 65 if (length == 0) { … … 67 67 length++; 68 68 } 69 new = (measured_string_ ref) malloc(sizeof(measured_string_t) +69 new = (measured_string_t *) malloc(sizeof(measured_string_t) + 70 70 (sizeof(char) * (length + 1))); 71 71 if (!new) … … 84 84 * 85 85 * @param[in] source The source measured string to be copied. 86 * @return sThe copy of the given measured string.87 * @return sNULL if the source parameter is NULL.88 * @return sNULL if there is not enough memory left.89 */ 90 measured_string_ ref measured_string_copy(measured_string_refsource)91 { 92 measured_string_ refnew;86 * @return The copy of the given measured string. 87 * @return NULL if the source parameter is NULL. 88 * @return NULL if there is not enough memory left. 89 */ 90 measured_string_t *measured_string_copy(measured_string_t *source) 91 { 92 measured_string_t *new; 93 93 94 94 if (!source) 95 95 return NULL; 96 96 97 new = (measured_string_ ref) malloc(sizeof(measured_string_t));97 new = (measured_string_t *) malloc(sizeof(measured_string_t)); 98 98 if (new) { 99 99 new->value = (char *) malloc(source->length + 1); … … 120 120 * actual character strings. 121 121 * @param[in] count The size of the measured strings array. 122 * @return sEOK on success.123 * @return sEINVAL if the strings or data parameter is NULL.124 * @return sEINVAL if the count parameter is zero (0).125 * @return sEINVAL if the sent array differs in size.126 * @return sEINVAL if there is inconsistency in sent measured122 * @return EOK on success. 123 * @return EINVAL if the strings or data parameter is NULL. 124 * @return EINVAL if the count parameter is zero (0). 125 * @return EINVAL if the sent array differs in size. 126 * @return EINVAL if there is inconsistency in sent measured 127 127 * strings' lengths (should not occur). 128 * @return sENOMEM if there is not enough memory left.129 * @return sOther error codes as defined for the128 * @return ENOMEM if there is not enough memory left. 129 * @return Other error codes as defined for the 130 130 * async_data_write_finalize() function. 131 131 */ 132 132 int 133 measured_strings_receive(measured_string_ ref*strings, char **data,133 measured_strings_receive(measured_string_t **strings, char **data, 134 134 size_t count) 135 135 { … … 166 166 (*data)[lengths[count] - 1] = '\0'; 167 167 168 *strings = (measured_string_ ref) malloc(sizeof(measured_string_t) *168 *strings = (measured_string_t *) malloc(sizeof(measured_string_t) * 169 169 count); 170 170 if (!*strings) { … … 209 209 * @param[in] strings The measured strings array to be processed. 210 210 * @param[in] count The measured strings array size. 211 * @return sThe computed sizes array.212 * @return sNULL if there is not enough memory left.213 */ 214 static size_t *prepare_lengths(const measured_string_ refstrings, size_t count)211 * @return The computed sizes array. 212 * @return NULL if there is not enough memory left. 213 */ 214 static size_t *prepare_lengths(const measured_string_t *strings, size_t count) 215 215 { 216 216 size_t *lengths; … … 238 238 * @param[in] strings The measured strings array to be transferred. 239 239 * @param[in] count The measured strings array size. 240 * @return sEOK on success.241 * @return sEINVAL if the strings parameter is NULL.242 * @return sEINVAL if the count parameter is zero (0).243 * @return sEINVAL if the calling module does not accept the given240 * @return EOK on success. 241 * @return EINVAL if the strings parameter is NULL. 242 * @return EINVAL if the count parameter is zero (0). 243 * @return EINVAL if the calling module does not accept the given 244 244 * array size. 245 * @return sEINVAL if there is inconsistency in sent measured245 * @return EINVAL if there is inconsistency in sent measured 246 246 * strings' lengths (should not occur). 247 * @return sOther error codes as defined for the247 * @return Other error codes as defined for the 248 248 * async_data_read_finalize() function. 249 249 */ 250 int measured_strings_reply(const measured_string_ refstrings, size_t count)250 int measured_strings_reply(const measured_string_t *strings, size_t count) 251 251 { 252 252 size_t *lengths; … … 302 302 * actual character strings. 303 303 * @param[in] count The size of the measured strings array. 304 * @return sEOK on success.305 * @return sEINVAL if the strings or data parameter is NULL.306 * @return sEINVAL if the phone or count parameter is not positive.307 * @return sEINVAL if the sent array differs in size.308 * @return sENOMEM if there is not enough memory left.309 * @return sOther error codes as defined for the304 * @return EOK on success. 305 * @return EINVAL if the strings or data parameter is NULL. 306 * @return EINVAL if the phone or count parameter is not positive. 307 * @return EINVAL if the sent array differs in size. 308 * @return ENOMEM if there is not enough memory left. 309 * @return Other error codes as defined for the 310 310 * async_data_read_start() function. 311 311 */ 312 312 int 313 measured_strings_return(int phone, measured_string_ ref*strings, char **data,313 measured_strings_return(int phone, measured_string_t **strings, char **data, 314 314 size_t count) 315 315 { … … 339 339 } 340 340 341 *strings = (measured_string_ ref) malloc(sizeof(measured_string_t) *341 *strings = (measured_string_t *) malloc(sizeof(measured_string_t) * 342 342 count); 343 343 if (!*strings) { … … 378 378 * @param[in] strings The measured strings array to be transferred. 379 379 * @param[in] count The measured strings array size. 380 * @return sEOK on success.381 * @return sEINVAL if the strings parameter is NULL.382 * @return sEINVAL if the phone or count parameter is not positive.383 * @return sOther error codes as defined for the380 * @return EOK on success. 381 * @return EINVAL if the strings parameter is NULL. 382 * @return EINVAL if the phone or count parameter is not positive. 383 * @return Other error codes as defined for the 384 384 * async_data_write_start() function. 385 385 */ 386 386 int 387 measured_strings_send(int phone, const measured_string_ refstrings,387 measured_strings_send(int phone, const measured_string_t *strings, 388 388 size_t count) 389 389 {
Note:
See TracChangeset
for help on using the changeset viewer.