You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
786 B

#include "webfuse/core/message.h"
#include <stdlib.h>
#include <libwebsockets.h>
extern struct wf_message * wf_message_create(json_t const * value)
{
struct wf_message * message = NULL;
size_t const length = json_dumpb(value, NULL, 0, JSON_COMPACT);
if (0 < length)
{
char * data = malloc(sizeof(struct wf_message) + LWS_PRE + length);
message = (struct wf_message *) data;
if (NULL != message)
{
message->data = &data[sizeof(struct wf_message) + LWS_PRE];
message->length = length;
message->next = NULL;
json_dumpb(value, message->data, length, JSON_COMPACT);
}
}
return message;
}
void wf_message_dispose(
struct wf_message * message)
{
free(message);
}