fixed cptr_copy

This commit is contained in:
Timerix22 2022-07-17 13:31:08 +03:00
parent 378277450b
commit bee08e4754

View File

@ -9,9 +9,9 @@ uint32 cptr_length(char* str){
// allocates new char[] and copies src there
char* cptr_copy(char* src){
uint32 len=cptr_length(src);
char* dst=malloc(len+1);
while(len-->0)
uint32 len=cptr_length(src)+1;
char* dst=malloc(len);
while(len--!=0)
dst[len]=src[len];
return dst;
}
@ -30,7 +30,7 @@ bool cptr_compare(char* key0, char* key1){
char* char_multiply(char c, uint32 n){
char* rez=malloc(n+1);
rez[n]=0;
while(n-->0)
while(n--!=0)
rez[n]=c;
return rez;
}