mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-17 10:49:47 +00:00
bring mg_strdup() back
This commit is contained in:
1 parent
a4e0225c69
commit
ab75bfa6e7
11 files changed
+46
-16
No files matched your search
@@ -50,8 +50,7 @@ static void fn(struct mg_connection *c, int ev, void *ev_data) {
|
||||
// Multithreading code path
|
||||
struct thread_data *data =
|
||||
(struct thread_data *) calloc(1, sizeof(*data)); // Worker owns it
|
||||
data->message.buf = mg_mprintf("%.*s", hm->message.len, hm->message.buf);
|
||||
data->message.len = hm->message.len; // Pass message
|
||||
data->message = mg_strdup(hm->message); // Pass message
|
||||
data->conn_id = c->id;
|
||||
data->mgr = c->mgr;
|
||||
start_thread(thread_function, data); // Start thread and pass data
|
||||
|
||||
@@ -80,8 +80,7 @@ static void fn(struct mg_connection *c, int ev, void *ev_data) {
|
||||
while ((pos = mg_mqtt_next_sub(mm, &topic, &qos, pos)) > 0) {
|
||||
struct sub *sub = calloc(1, sizeof(*sub));
|
||||
sub->c = c;
|
||||
sub->topic.buf = mg_mprintf("%.*s", topic.len, topic.buf);
|
||||
sub->topic.len = topic.len;
|
||||
sub->topic = mg_strdup(topic);
|
||||
sub->qos = qos;
|
||||
LIST_ADD_HEAD(struct sub, &s_subs, sub);
|
||||
MG_INFO(
|
||||
|
||||
Reference in new issue
Block a user