78 cxFree(alloc, str->ptr); |
78 cxFree(alloc, str->ptr); |
79 str->ptr = NULL; |
79 str->ptr = NULL; |
80 str->length = 0; |
80 str->length = 0; |
81 } |
81 } |
82 |
82 |
|
83 int cx_strcpy_a( |
|
84 const CxAllocator *alloc, |
|
85 cxmutstr *dest, |
|
86 cxstring src |
|
87 ) { |
|
88 if (cxReallocate(alloc, &dest->ptr, src.length + 1)) { |
|
89 return 1; |
|
90 } |
|
91 |
|
92 memcpy(dest->ptr, src.ptr, src.length); |
|
93 dest->length = src.length; |
|
94 dest->ptr[dest->length] = '\0'; |
|
95 |
|
96 return 0; |
|
97 } |
|
98 |
83 size_t cx_strlen( |
99 size_t cx_strlen( |
84 size_t count, |
100 size_t count, |
85 ... |
101 ... |
86 ) { |
102 ) { |
87 if (count == 0) return 0; |
103 if (count == 0) return 0; |