Commit 68dd8d27 authored by Alexander Alashkin's avatar Alexander Alashkin Committed by Cesanta Bot

Get rid of ubjson

PUBLISHED_FROM=e6f1dca95ec7ed3795adf493cca9cdcdc07381f5
parent 36a19279
...@@ -971,6 +971,11 @@ struct mg_str mg_mk_str(const char *s) { ...@@ -971,6 +971,11 @@ struct mg_str mg_mk_str(const char *s) {
return ret; return ret;
} }
struct mg_str mg_mk_str_n(const char *s, size_t len) {
struct mg_str ret = {s, len};
return ret;
}
int mg_vcmp(const struct mg_str *str1, const char *str2) { int mg_vcmp(const struct mg_str *str1, const char *str2) {
size_t n2 = strlen(str2), n1 = str1->len; size_t n2 = strlen(str2), n1 = str1->len;
int r = memcmp(str1->p, str2, (n1 < n2) ? n1 : n2); int r = memcmp(str1->p, str2, (n1 < n2) ? n1 : n2);
......
...@@ -862,10 +862,11 @@ struct mg_str { ...@@ -862,10 +862,11 @@ struct mg_str {
}; };
/* /*
* A helper function for creating mg_str struct from plain C string. * Helper functions for creating mg_str struct from plain C string.
* `NULL` is allowed and becomes `{NULL, 0}`. * `NULL` is allowed and becomes `{NULL, 0}`.
*/ */
struct mg_str mg_mk_str(const char *s); struct mg_str mg_mk_str(const char *s);
struct mg_str mg_mk_str_n(const char *s, size_t len);
/* Macro for initializing mg_str. */ /* Macro for initializing mg_str. */
#define MG_MK_STR(str_literal) \ #define MG_MK_STR(str_literal) \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment