save works
This commit is contained in:
parent
b1faeb94b6
commit
b748e30d20
35 changed files with 1247 additions and 2149 deletions
|
|
@ -4,8 +4,53 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "configobj.h"
|
||||
#include "mylock.h"
|
||||
#include "qobj.h"
|
||||
#include "utils.h"
|
||||
#include "xce/types.h"
|
||||
#include "xstring.h"
|
||||
|
||||
static size_t xconfig_datasize(va_list ap)
|
||||
{
|
||||
size_t sz = sizeof(xce_config_t);
|
||||
|
||||
return sz;
|
||||
}
|
||||
|
||||
static int xconfig_init(meta_obj_t* obj, va_list ap)
|
||||
{
|
||||
xce_config_t* dst = RTTI_OBJ_TO_DATA(xce_config_t, obj);
|
||||
xce_config_t* src = va_arg(ap, xce_config_t*);
|
||||
|
||||
if (src == NULL) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
dst->name = makeString(src->name);
|
||||
dst->value = makeString(src->value);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void xconfig_destroy(meta_obj_t* obj)
|
||||
{
|
||||
xce_config_t* c = RTTI_OBJ_TO_DATA(xce_config_t, obj);
|
||||
|
||||
dereference(c->name);
|
||||
dereference(c->value);
|
||||
}
|
||||
|
||||
static typeinfo_t xconfig_type = {
|
||||
.name = "xce config item",
|
||||
.privateSize = 0,
|
||||
.dataSize = (datasize_fn_t)xconfig_datasize,
|
||||
.init = (obj_init_fn_t)xconfig_init,
|
||||
.destroy = (obj_destroy_fn_t)xconfig_destroy,
|
||||
};
|
||||
|
||||
xce_config_t* makeConfig(xce_config_t* c)
|
||||
{
|
||||
xce_config_t* c1 = makeInstance(&xconfig_type, c);
|
||||
|
||||
return c1;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue