A function to make a NUL-terminated copy of mg_str

PUBLISHED_FROM=c1310b7d62f3ad6e2f24fea9f5229588c56b0bbe
This commit is contained in:
Deomid Ryabkov authored and Cesanta Bot committed 2017-04-25 10:47:30 +00:00
1 parent 83fe5a17f3
commit a35e5bd966
2 files changed
+25 -5

No files matched your search

+8
View File
@@ -1789,7 +1789,15 @@ int mg_vcmp(const struct mg_str *str2, const char *str1);
*/
int mg_vcasecmp(const struct mg_str *str2, const char *str1);
/* Creates a copy of s (heap-allocated). */
struct mg_str mg_strdup(const struct mg_str s);
/*
* Creates a copy of s (heap-allocated).
* Resulting string is NUL-terminated (but NUL is not included in len).
*/
struct mg_str mg_strdup_nul(const struct mg_str s);
int mg_strcmp(const struct mg_str str1, const struct mg_str str2);
int mg_strncmp(const struct mg_str str1, const struct mg_str str2, size_t n);