FileSystem functions
| 593 | // For StringBuilder, join is not typical, but perhaps split by sep and join |
| 594 | // Actually, looking at usage, it might not be needed, but implement as simple copy |
| 595 | char* result = (char*)malloc(sb->length + 1); |
| 596 | if (result) { |
| 597 | memcpy(result, sb->buffer, sb->length + 1); |
| 598 | } |
| 599 | return result; |
| 600 | } |
| 601 | |
| 602 | char* String_duplicate(const char* str) { |
| 603 | if (!str) return NULL; |
| 604 | char* result = (char*)malloc(strlen(str) + 1); |
| 605 | if (result) strcpy(result, str); |
| 606 | return result; |
| 607 | } |
| 608 | |
| 609 | char* String_concat3(const char* a, const char* b, const char* c) { |
| 610 | size_t lenA = strlen(a); |
| 611 | size_t lenB = strlen(b); |
| 612 | size_t lenC = strlen(c); |
| 613 | char* result = (char*)malloc(lenA + lenB + lenC + 1); |
| 614 | if (!result) return NULL; |
| 615 | memcpy(result, a, lenA); |
no test coverage detected