This option specifies a merge function callback, consisting of a function pointer fp and a pointer to user data clos which will be passed as the first argument to fp. The merge function callback will be used during iteration over the mtbl_merger object to merge entries with duplicate keys in the input sources.
The remaining arguments to the merge function are:
key pointer to the key for which there exist duplicate values.
len_key length of the key.
val0 pointer to the first value.
len_val_0 length of the first value.
val1 pointer to the second value.
len_val_1 length of the second value.
merged_val pointer to where the callee should place its merged value.
len_merged_val pointer to where the callee should place the length of its merged value.
merged_val must be allocated with the system allocator, and the mtbl_merger interface takes responsibility for free()ing the value once it is no longer needed.
The callee may provide an empty value as the merged value, in which case merged_val must still contain an allocated, non-NULL value and len_merged_val must contain the value 0.
The callee may indicate an error by returning NULL in the merged_val argument, which will abort iteration over the mtbl_merger object.