| 409 | } |
| 410 | |
| 411 | size_t SIValue_StringJoinLen(SIValue *strings, unsigned int string_count, const char *delimiter) { |
| 412 | size_t length = 0; |
| 413 | size_t elem_len; |
| 414 | size_t delimiter_len = strlen(delimiter); |
| 415 | /* Compute length. */ |
| 416 | for(int i = 0; i < string_count; i ++) { |
| 417 | /* String elements representing bytes size strings, |
| 418 | * for all other SIValue types 64 bytes should be enough. */ |
| 419 | elem_len = (strings[i].type == T_STRING) ? strlen(strings[i].stringval) + delimiter_len : 64; |
| 420 | length += elem_len; |
| 421 | } |
| 422 | |
| 423 | /* Account for NULL terminating byte. */ |
| 424 | length++; |
| 425 | return length; |
| 426 | } |
| 427 | |
| 428 | void SIValue_StringJoin(SIValue *strings, unsigned int string_count, const char *delimiter, |
| 429 | char **buf, size_t *buf_len, size_t *bytesWritten) { |
no outgoing calls
no test coverage detected