save works
This commit is contained in:
parent
f4b1ba4cd7
commit
acfbec875b
51 changed files with 622 additions and 1175 deletions
|
|
@ -48,9 +48,32 @@ static typeinfo_t xconfig_type = {
|
|||
.destroy = (obj_destroy_fn_t)xconfig_destroy,
|
||||
};
|
||||
|
||||
xce_config_t* makeConfig(xce_config_t* c)
|
||||
xce_config_t* makeConfig(var configmgr, xce_config_t* c)
|
||||
{
|
||||
xce_config_t* c1 = makeInstance(&xconfig_type, c);
|
||||
xce_config_t* c1 = NULL;
|
||||
int rc = 0;
|
||||
|
||||
rc = key_find(configmgr, (void*)c->name, (void**)&c1);
|
||||
if ((rc < 0) && (rc != -ENOENT)) {
|
||||
errno = -rc;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (rc > 0) {
|
||||
errno = EEXIST;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
c1 = makeInstance(&xconfig_type, c);
|
||||
if (c1 != NULL) {
|
||||
rc = key_add(configmgr, (void*)c1->name, (void*)c1);
|
||||
if (rc < 0) {
|
||||
destroy(c1);
|
||||
|
||||
errno = -rc;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return c1;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue