Changes in uspace/lib/c/generic/adt/measured_strings.c [1bfd3d3:278b97b1] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/adt/measured_strings.c
r1bfd3d3 r278b97b1 55 55 * appended with the terminating zero ('\0') character 56 56 * otherwise. 57 * @return The new bundled character string with measured length.58 * @return NULL if there is not enough memory left.59 */ 60 measured_string_ t *57 * @returns The new bundled character string with measured length. 58 * @returns NULL if there is not enough memory left. 59 */ 60 measured_string_ref 61 61 measured_string_create_bulk(const char *string, size_t length) 62 62 { 63 measured_string_ t *new;63 measured_string_ref new; 64 64 65 65 if (length == 0) { … … 67 67 length++; 68 68 } 69 new = (measured_string_ t *) malloc(sizeof(measured_string_t) +69 new = (measured_string_ref) 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 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;86 * @returns The copy of the given measured string. 87 * @returns NULL if the source parameter is NULL. 88 * @returns NULL if there is not enough memory left. 89 */ 90 measured_string_ref measured_string_copy(measured_string_ref source) 91 { 92 measured_string_ref new; 93 93 94 94 if (!source) 95 95 return NULL; 96 96 97 new = (measured_string_ t *) malloc(sizeof(measured_string_t));97 new = (measured_string_ref) 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 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 measured122 * @returns EOK on success. 123 * @returns EINVAL if the strings or data parameter is NULL. 124 * @returns EINVAL if the count parameter is zero (0). 125 * @returns EINVAL if the sent array differs in size. 126 * @returns EINVAL if there is inconsistency in sent measured 127 127 * strings' lengths (should not occur). 128 * @return ENOMEM if there is not enough memory left.129 * @return Other error codes as defined for the128 * @returns ENOMEM if there is not enough memory left. 129 * @returns 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_ t **strings, char **data,133 measured_strings_receive(measured_string_ref *strings, char **data, 134 134 size_t count) 135 135 { … … 166 166 (*data)[lengths[count] - 1] = '\0'; 167 167 168 *strings = (measured_string_ t *) malloc(sizeof(measured_string_t) *168 *strings = (measured_string_ref) 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 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)211 * @returns The computed sizes array. 212 * @returns NULL if there is not enough memory left. 213 */ 214 static size_t *prepare_lengths(const measured_string_ref 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 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 given240 * @returns EOK on success. 241 * @returns EINVAL if the strings parameter is NULL. 242 * @returns EINVAL if the count parameter is zero (0). 243 * @returns EINVAL if the calling module does not accept the given 244 244 * array size. 245 * @return EINVAL if there is inconsistency in sent measured245 * @returns EINVAL if there is inconsistency in sent measured 246 246 * strings' lengths (should not occur). 247 * @return Other error codes as defined for the247 * @returns Other error codes as defined for the 248 248 * async_data_read_finalize() function. 249 249 */ 250 int measured_strings_reply(const measured_string_ t *strings, size_t count)250 int measured_strings_reply(const measured_string_ref 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 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 the304 * @returns EOK on success. 305 * @returns EINVAL if the strings or data parameter is NULL. 306 * @returns EINVAL if the phone or count parameter is not positive. 307 * @returns EINVAL if the sent array differs in size. 308 * @returns ENOMEM if there is not enough memory left. 309 * @returns 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_ t **strings, char **data,313 measured_strings_return(int phone, measured_string_ref *strings, char **data, 314 314 size_t count) 315 315 { … … 339 339 } 340 340 341 *strings = (measured_string_ t *) malloc(sizeof(measured_string_t) *341 *strings = (measured_string_ref) 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 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 the380 * @returns EOK on success. 381 * @returns EINVAL if the strings parameter is NULL. 382 * @returns EINVAL if the phone or count parameter is not positive. 383 * @returns 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_ t *strings,387 measured_strings_send(int phone, const measured_string_ref strings, 388 388 size_t count) 389 389 {
Note:
See TracChangeset
for help on using the changeset viewer.