Also added a function called by the three "*_serialize_fields" to reduce code duplication.
The interface is not modified.
#### Type Of Change - [x] New feature (non-breaking change which adds new functionality)
#### Checklist: - [x] Tested changes locally
#### Description Small pull request that adds a function "xavu_serialize_fields" (with same interface as "xavp_serialize_fields" and "xavi_serialize_fields"), and an internal helper function to reduce code duplication.
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/2603
-- Commit Summary --
* core: added xavu_serialize_fields function
-- File Changes --
M src/core/xavp.c (91) M src/core/xavp.h (2)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/2603.patch https://github.com/kamailio/kamailio/pull/2603.diff
Actually the duplicate of code in this case was intentional, because the code for xavp, xavi and xavu should stay independent of each other, because they can diverge more in the future and a change in one can break the others.
There are a lot of functions that are somehow duplicate for the three types of xavps, when it becomes clear that they are going to stay very tight, then many functions may be combined, but till then I prefer to keep everything specific for one type. Also, when an eventual merging is decided, we have to balance the complexity of adding many IF conditions (to detect the type, then to figure out comparison of the names to be case sensitive or not, a.s.o.) vs some code duplication but clearer api to maintain.
You can make the pull request that just adds the independent xavu_serialize_fields() function and it will be merged.
Thanks for your feedback. I'll amend this pull request with only the xavu function then.
@nchaigne pushed 1 commit.
2cc343f20f6e98846acb9387d128d06c5cb26355 Revert refactoring
Thanks!
Merged #2603 into master.