| 44 #else |
44 #else |
| 45 #include <strings.h> |
45 #include <strings.h> |
| 46 #define cx_strcasecmp_impl strncasecmp |
46 #define cx_strcasecmp_impl strncasecmp |
| 47 #endif |
47 #endif |
| 48 |
48 |
| 49 cxmutstr cx_mutstr(char *cstring) { |
|
| 50 return (cxmutstr) {cstring, cstring == NULL ? 0 : strlen(cstring)}; |
|
| 51 } |
|
| 52 |
|
| 53 cxmutstr cx_mutstrn( |
|
| 54 char *cstring, |
|
| 55 size_t length |
|
| 56 ) { |
|
| 57 return (cxmutstr) {cstring, length}; |
|
| 58 } |
|
| 59 |
|
| 60 cxstring cx_str(const char *cstring) { |
|
| 61 return (cxstring) {cstring, cstring == NULL ? 0 : strlen(cstring)}; |
|
| 62 } |
|
| 63 |
|
| 64 cxstring cx_strn( |
|
| 65 const char *cstring, |
|
| 66 size_t length |
|
| 67 ) { |
|
| 68 return (cxstring) {cstring, length}; |
|
| 69 } |
|
| 70 |
|
| 71 void cx_strfree(cxmutstr *str) { |
49 void cx_strfree(cxmutstr *str) { |
| 72 if (str == NULL) return; |
50 if (str == NULL) return; |
| 73 cxFreeDefault(str->ptr); |
51 cxFreeDefault(str->ptr); |
| 74 str->ptr = NULL; |
52 str->ptr = NULL; |
| 75 str->length = 0; |
53 str->length = 0; |