cstr_copy
This commit is contained in:
@@ -1,5 +1,15 @@
|
||||
#include "tlibc/string/cstr.h"
|
||||
|
||||
char* cstr_copy(cstr self){
|
||||
if(self == NULL)
|
||||
return NULL;
|
||||
|
||||
u64 len_with_zero = strlen(self) + 1;
|
||||
char* copy = (char*)malloc(len_with_zero);
|
||||
memcpy(copy, self, len_with_zero);
|
||||
return copy;
|
||||
}
|
||||
|
||||
char* _strcat_malloc(u64 n, cstr str0, ...){
|
||||
va_list args;
|
||||
va_start(args, str0);
|
||||
|
||||
Reference in New Issue
Block a user