C-API: New no-copy xmldb_get_cache function for performance
Added SKIP flag to XML for skipping nodes in xml_diff
This commit is contained in:
parent
2a6bbac712
commit
ead9e8d666
11 changed files with 195 additions and 98 deletions
|
|
@ -441,9 +441,8 @@ startup_validate(clixon_handle h,
|
|||
}
|
||||
retval = 1;
|
||||
done:
|
||||
if (td){
|
||||
transaction_free(td);
|
||||
}
|
||||
if (td)
|
||||
transaction_free1(td, 1);
|
||||
return retval;
|
||||
fail: /* cbret should be set */
|
||||
retval = 0;
|
||||
|
|
@ -662,7 +661,7 @@ candidate_validate(clixon_handle h,
|
|||
if (td){
|
||||
if (retval < 1)
|
||||
plugin_transaction_abort_all(h, td);
|
||||
transaction_free(td);
|
||||
transaction_free1(td, 1);
|
||||
}
|
||||
return retval;
|
||||
fail:
|
||||
|
|
@ -772,7 +771,7 @@ candidate_commit(clixon_handle h,
|
|||
if (td){
|
||||
if (retval < 1)
|
||||
plugin_transaction_abort_all(h, td);
|
||||
transaction_free(td);
|
||||
transaction_free1(td, 1);
|
||||
}
|
||||
if (xret)
|
||||
xml_free(xret);
|
||||
|
|
@ -1081,9 +1080,8 @@ from_client_restart_one(clixon_handle h,
|
|||
goto fail;
|
||||
retval = 1;
|
||||
done:
|
||||
if (td){
|
||||
transaction_free(td);
|
||||
}
|
||||
if (td)
|
||||
transaction_free1(td, 1);
|
||||
return retval;
|
||||
fail:
|
||||
retval = 0;
|
||||
|
|
|
|||
|
|
@ -555,10 +555,32 @@ transaction_new(void)
|
|||
int
|
||||
transaction_free(transaction_data_t *td)
|
||||
{
|
||||
if (td->td_src)
|
||||
xml_free(td->td_src);
|
||||
if (td->td_target)
|
||||
xml_free(td->td_target);
|
||||
return transaction_free1(td, 1);
|
||||
}
|
||||
|
||||
/*! Free transaction structure
|
||||
*
|
||||
* @param[in] td Transaction data will be deallocated after the call
|
||||
* @param[in] copy 0: XML trees are no-copy, clear and dont free, 1: free XML trees
|
||||
*/
|
||||
int
|
||||
transaction_free1(transaction_data_t *td,
|
||||
int copy)
|
||||
{
|
||||
if (td->td_src){
|
||||
if (copy)
|
||||
xml_free(td->td_src);
|
||||
else
|
||||
xml_apply(td->td_src, CX_ELMNT, (xml_applyfn_t*)xml_flag_reset,
|
||||
(void*)(XML_FLAG_NONE|XML_FLAG_ADD|XML_FLAG_DEL|XML_FLAG_CHANGE|XML_FLAG_SKIP|XML_FLAG_MARK));
|
||||
}
|
||||
if (td->td_target){
|
||||
if (copy)
|
||||
xml_free(td->td_target);
|
||||
else
|
||||
xml_apply(td->td_target, CX_ELMNT, (xml_applyfn_t*)xml_flag_reset,
|
||||
(void*)(XML_FLAG_NONE|XML_FLAG_ADD|XML_FLAG_DEL|XML_FLAG_CHANGE|XML_FLAG_SKIP|XML_FLAG_MARK));
|
||||
}
|
||||
if (td->td_dvec)
|
||||
free(td->td_dvec);
|
||||
if (td->td_avec)
|
||||
|
|
|
|||
|
|
@ -111,6 +111,7 @@ int clixon_pagination_free(clixon_handle h);
|
|||
|
||||
transaction_data_t * transaction_new(void);
|
||||
int transaction_free(transaction_data_t *);
|
||||
int transaction_free1(transaction_data_t *, int copy);
|
||||
|
||||
int plugin_transaction_begin_one(clixon_plugin_t *cp, clixon_handle h, transaction_data_t *td);
|
||||
int plugin_transaction_begin_all(clixon_handle h, transaction_data_t *td);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue