From 68dd8d277d7b5bb26daf04f08bef3030ad2d7725 Mon Sep 17 00:00:00 2001 From: Alexander Alashkin <alexander.alashkin@cesanta.com> Date: Tue, 12 Jul 2016 21:37:07 +0100 Subject: [PATCH] Get rid of ubjson PUBLISHED_FROM=e6f1dca95ec7ed3795adf493cca9cdcdc07381f5 --- mongoose.c | 5 +++++ mongoose.h | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/mongoose.c b/mongoose.c index 62cbd6f86..d47f94ea9 100644 --- a/mongoose.c +++ b/mongoose.c @@ -971,6 +971,11 @@ struct mg_str mg_mk_str(const char *s) { 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) { size_t n2 = strlen(str2), n1 = str1->len; int r = memcmp(str1->p, str2, (n1 < n2) ? n1 : n2); diff --git a/mongoose.h b/mongoose.h index c22f79d79..e095f963c 100644 --- a/mongoose.h +++ b/mongoose.h @@ -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}`. */ 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. */ #define MG_MK_STR(str_literal) \ -- GitLab