2019-03-24 00:15:29 +00:00
|
|
|
#include "wsfs/adapter/impl/jsonrpc/method_intern.h"
|
2019-02-09 02:08:02 +00:00
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
2019-03-24 02:25:29 +00:00
|
|
|
struct jsonrpc_method * jsonrpc_method_create(
|
2019-02-09 02:08:02 +00:00
|
|
|
char const * name,
|
2019-03-24 02:25:29 +00:00
|
|
|
jsonrpc_method_invoke_fn * invoke,
|
2019-02-09 02:08:02 +00:00
|
|
|
void * user_data)
|
|
|
|
{
|
2019-03-24 02:25:29 +00:00
|
|
|
struct jsonrpc_method * method = malloc(sizeof(struct jsonrpc_method));
|
2019-02-09 02:08:02 +00:00
|
|
|
if (NULL != method)
|
|
|
|
{
|
|
|
|
method->next = NULL;
|
|
|
|
method->name = strdup(name);
|
|
|
|
method->invoke = invoke;
|
|
|
|
method->user_data = user_data;
|
|
|
|
}
|
|
|
|
|
|
|
|
return method;
|
|
|
|
}
|
|
|
|
|
2019-03-24 02:25:29 +00:00
|
|
|
void jsonrpc_method_dispose(
|
|
|
|
struct jsonrpc_method * method)
|
2019-02-09 02:08:02 +00:00
|
|
|
{
|
|
|
|
free(method->name);
|
|
|
|
free(method);
|
|
|
|
}
|