Restore xmldb_get() to original (but removed one parameter
Moved all zero-copy xmldb_get functions to xmldb_get0. Clarified CHANGELOG for xmldb_get changes
This commit is contained in:
parent
2aeb925521
commit
3dba0b5370
11 changed files with 93 additions and 66 deletions
|
|
@ -342,7 +342,7 @@ from_client_get_config(clicon_handle h,
|
|||
/* Note xret can be pruned by nacm below (and change name),
|
||||
* so zero-copy cant be used
|
||||
*/
|
||||
if (xmldb_get(h, db, xpath, 1, &xret, NULL) < 0){
|
||||
if (xmldb_get(h, db, xpath, &xret) < 0){
|
||||
if (netconf_operation_failed(cbret, "application", "read registry")< 0)
|
||||
goto done;
|
||||
goto ok;
|
||||
|
|
@ -810,7 +810,7 @@ from_client_get(clicon_handle h,
|
|||
* Note xret can be pruned by nacm below and change name and
|
||||
* metrged with state data, so zero-copy cant be used
|
||||
*/
|
||||
if (xmldb_get(h, "running", xpath, 1, &xret, NULL) < 0){
|
||||
if (xmldb_get(h, "running", xpath, &xret) < 0){
|
||||
if (netconf_operation_failed(cbret, "application", "read registry")< 0)
|
||||
goto done;
|
||||
goto ok;
|
||||
|
|
|
|||
|
|
@ -183,7 +183,7 @@ startup_common(clicon_handle h,
|
|||
if ((msd = modstate_diff_new()) == NULL)
|
||||
goto done;
|
||||
clicon_debug(1, "Reading startup config from %s", db);
|
||||
if (xmldb_get(h, db, "/", 0, &xt, msd) < 0)
|
||||
if (xmldb_get0(h, db, "/", 0, &xt, msd) < 0)
|
||||
goto done;
|
||||
/* Clear flags xpath for get */
|
||||
xml_apply0(xt, CX_ELMNT, (xml_applyfn_t*)xml_flag_reset,
|
||||
|
|
@ -283,7 +283,7 @@ startup_validate(clicon_handle h,
|
|||
}
|
||||
plugin_transaction_end(h, td);
|
||||
/* Clear cached trees from default values and marking */
|
||||
if (xmldb_get_clear(h, td->td_target) < 0)
|
||||
if (xmldb_get0_clear(h, td->td_target) < 0)
|
||||
goto done;
|
||||
if (xtr){
|
||||
*xtr = td->td_target;
|
||||
|
|
@ -292,7 +292,7 @@ startup_validate(clicon_handle h,
|
|||
retval = 1;
|
||||
done:
|
||||
if (td){
|
||||
xmldb_get_free(h, &td->td_target);
|
||||
xmldb_get0_free(h, &td->td_target);
|
||||
transaction_free(td);
|
||||
}
|
||||
return retval;
|
||||
|
|
@ -335,7 +335,7 @@ startup_commit(clicon_handle h,
|
|||
if (plugin_transaction_commit(h, td) < 0)
|
||||
goto done;
|
||||
/* Clear cached trees from default values and marking */
|
||||
if (xmldb_get_clear(h, td->td_target) < 0)
|
||||
if (xmldb_get0_clear(h, td->td_target) < 0)
|
||||
goto done;
|
||||
|
||||
/* [Delete and] create running db */
|
||||
|
|
@ -360,7 +360,7 @@ startup_commit(clicon_handle h,
|
|||
if (td){
|
||||
if (retval < 1)
|
||||
plugin_transaction_abort(h, td);
|
||||
xmldb_get_free(h, &td->td_target);
|
||||
xmldb_get0_free(h, &td->td_target);
|
||||
transaction_free(td);
|
||||
}
|
||||
return retval;
|
||||
|
|
@ -398,7 +398,7 @@ from_validate_common(clicon_handle h,
|
|||
goto done;
|
||||
}
|
||||
/* This is the state we are going to */
|
||||
if (xmldb_get(h, candidate, "/", 0, &td->td_target, NULL) < 0)
|
||||
if (xmldb_get0(h, candidate, "/", 0, &td->td_target, NULL) < 0)
|
||||
goto done;
|
||||
|
||||
/* Clear flags xpath for get */
|
||||
|
|
@ -416,7 +416,7 @@ from_validate_common(clicon_handle h,
|
|||
|
||||
/* 2. Parse xml trees
|
||||
* This is the state we are going from */
|
||||
if (xmldb_get(h, "running", "/", 0, &td->td_src, NULL) < 0)
|
||||
if (xmldb_get0(h, "running", "/", 0, &td->td_src, NULL) < 0)
|
||||
goto done;
|
||||
/* Clear flags xpath for get */
|
||||
xml_apply0(td->td_src, CX_ELMNT, (xml_applyfn_t*)xml_flag_reset,
|
||||
|
|
@ -521,9 +521,9 @@ candidate_commit(clicon_handle h,
|
|||
goto done;
|
||||
|
||||
/* Clear cached trees from default values and marking */
|
||||
if (xmldb_get_clear(h, td->td_target) < 0)
|
||||
if (xmldb_get0_clear(h, td->td_target) < 0)
|
||||
goto done;
|
||||
if (xmldb_get_clear(h, td->td_src) < 0)
|
||||
if (xmldb_get0_clear(h, td->td_src) < 0)
|
||||
goto done;
|
||||
|
||||
/* Optionally write (potentially modified) tree back to candidate
|
||||
|
|
@ -559,8 +559,8 @@ candidate_commit(clicon_handle h,
|
|||
if (td){
|
||||
if (retval < 1)
|
||||
plugin_transaction_abort(h, td);
|
||||
xmldb_get_free(h, &td->td_target);
|
||||
xmldb_get_free(h, &td->td_src);
|
||||
xmldb_get0_free(h, &td->td_target);
|
||||
xmldb_get0_free(h, &td->td_src);
|
||||
transaction_free(td);
|
||||
}
|
||||
return retval;
|
||||
|
|
@ -744,10 +744,10 @@ from_client_validate(clicon_handle h,
|
|||
goto ok;
|
||||
}
|
||||
/* Clear cached trees from default values and marking */
|
||||
if (xmldb_get_clear(h, td->td_target) < 0)
|
||||
if (xmldb_get0_clear(h, td->td_target) < 0)
|
||||
goto done;
|
||||
if (xmldb_get_clear(h, td->td_src) < 0 ||
|
||||
xmldb_get_clear(h, td->td_target) < 0){
|
||||
if (xmldb_get0_clear(h, td->td_src) < 0 ||
|
||||
xmldb_get0_clear(h, td->td_target) < 0){
|
||||
plugin_transaction_abort(h, td);
|
||||
goto done;
|
||||
}
|
||||
|
|
@ -769,8 +769,8 @@ from_client_validate(clicon_handle h,
|
|||
if (td){
|
||||
if (retval < 0)
|
||||
plugin_transaction_abort(h, td);
|
||||
xmldb_get_free(h, &td->td_target);
|
||||
xmldb_get_free(h, &td->td_src);
|
||||
xmldb_get0_free(h, &td->td_target);
|
||||
xmldb_get0_free(h, &td->td_src);
|
||||
transaction_free(td);
|
||||
}
|
||||
return retval;
|
||||
|
|
|
|||
|
|
@ -102,12 +102,12 @@ db_merge(clicon_handle h,
|
|||
cxobj *xt = NULL;
|
||||
|
||||
/* Get data as xml from db1 */
|
||||
if (xmldb_get(h, (char*)db1, NULL, 0, &xt, NULL) < 0)
|
||||
if (xmldb_get0(h, (char*)db1, NULL, 0, &xt, NULL) < 0)
|
||||
goto done;
|
||||
/* Merge xml into db2. Without commit */
|
||||
retval = xmldb_put(h, (char*)db2, OP_MERGE, xt, clicon_username_get(h), cbret);
|
||||
done:
|
||||
xmldb_get_free(h, &xt);
|
||||
xmldb_get0_free(h, &xt);
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
|
@ -269,7 +269,7 @@ startup_extraxml(clicon_handle h,
|
|||
ok:
|
||||
retval = 1;
|
||||
done:
|
||||
xmldb_get_free(h, &xt);
|
||||
xmldb_get0_free(h, &xt);
|
||||
if (xmldb_delete(h, db) != 0 && errno != ENOENT)
|
||||
return -1;
|
||||
return retval;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue