🦄 refactor(stellar api): split exdata and mq
This commit is contained in:
@@ -57,7 +57,7 @@ static void stellar_exdata_met_dtor(void *_elt)
|
||||
|
||||
UT_icd stellar_exdata_meta_icd = {sizeof(struct exdata_meta), NULL, stellar_exdata_met_copy, stellar_exdata_met_dtor};
|
||||
|
||||
int exdata_new_index(struct exdata_schema *s, const char *name, exdata_free *free_func,void *free_arg)
|
||||
int exdata_schema_new_index(struct exdata_schema *s, const char *name, exdata_free *free_func,void *free_arg)
|
||||
{
|
||||
if(s==NULL || name==NULL)return -1;
|
||||
if(s->exdata_meta_array == NULL)
|
||||
@@ -90,7 +90,7 @@ int exdata_new_index(struct exdata_schema *s, const char *name, exdata_free *fre
|
||||
/*******************************
|
||||
* STELLAR EXDATA HANDLE API *
|
||||
*******************************/
|
||||
struct exdata_runtime *exdata_handle_new(struct exdata_schema *s)
|
||||
struct exdata_runtime *exdata_runtime_new(struct exdata_schema *s)
|
||||
{
|
||||
if(s==NULL || s->exdata_meta_array==NULL)return NULL;
|
||||
struct exdata_runtime *h = CALLOC(struct exdata_runtime, 1);
|
||||
@@ -103,7 +103,7 @@ struct exdata_runtime *exdata_handle_new(struct exdata_schema *s)
|
||||
return h;
|
||||
}
|
||||
|
||||
void exdata_handle_reset(struct exdata_runtime *h)
|
||||
void exdata_runtime_reset(struct exdata_runtime *h)
|
||||
{
|
||||
if(h==NULL||h->schema==NULL||h->exdata_array==NULL)return;
|
||||
unsigned int len=utarray_len(h->schema->exdata_meta_array);
|
||||
@@ -125,10 +125,10 @@ void exdata_handle_reset(struct exdata_runtime *h)
|
||||
return;
|
||||
}
|
||||
|
||||
void exdata_handle_free(struct exdata_runtime *h)
|
||||
void exdata_runtime_free(struct exdata_runtime *h)
|
||||
{
|
||||
if(h==NULL)return;
|
||||
exdata_handle_reset(h);
|
||||
exdata_runtime_reset(h);
|
||||
if(h->exdata_array)FREE(h->exdata_array);
|
||||
FREE(h);
|
||||
}
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
typedef void exdata_free(int idx, void *ex_ptr, void *arg);
|
||||
|
||||
struct exdata_schema;
|
||||
|
||||
struct exdata_schema *exdata_schema_new();
|
||||
void exdata_schema_free(struct exdata_schema *s);
|
||||
|
||||
int exdata_new_index(struct exdata_schema *schema, const char *name, exdata_free *free_func,void *free_arg);
|
||||
|
||||
int exdata_schema_get_idx_by_name(struct exdata_schema *schema, const char *name);
|
||||
|
||||
struct exdata_runtime;
|
||||
|
||||
struct exdata_runtime *exdata_handle_new(struct exdata_schema *h);
|
||||
void exdata_handle_free(struct exdata_runtime *h);
|
||||
void exdata_handle_reset(struct exdata_runtime *h);
|
||||
|
||||
int exdata_set(struct exdata_runtime *h, int idx, void *ex_ptr);
|
||||
void *exdata_get(struct exdata_runtime *h, int idx);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#include "uthash/utarray.h"
|
||||
|
||||
#include "exdata.h"
|
||||
#include "stellar/exdata.h"
|
||||
|
||||
struct exdata_schema
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user