src/string.c

changeset 1050
3df63e95921a
parent 1048
12f38affefd5
child 1052
e997862a57d8
equal deleted inserted replaced
1049:415bf2ce6bab 1050:3df63e95921a
61 size_t length 61 size_t length
62 ) { 62 ) {
63 return (cxstring) {cstring, length}; 63 return (cxstring) {cstring, length};
64 } 64 }
65 65
66 cxstring cx_strcast(cxmutstr str) {
67 return (cxstring) {str.ptr, str.length};
68 }
69
70 void cx_strfree(cxmutstr *str) { 66 void cx_strfree(cxmutstr *str) {
71 if (str == NULL) return; 67 if (str == NULL) return;
72 free(str->ptr); 68 free(str->ptr);
73 str->ptr = NULL; 69 str->ptr = NULL;
74 str->length = 0; 70 str->length = 0;

mercurial