strm_dict_compare()

Updated: April 19, 2023

Compare two dictionaries to find the added and modified entries

Synopsis:

#include <sys/strm.h>
strm_dict_t* strm_dict_compare(strm_dict_t *newdict,
                               strm_dict_t const *olddict)

Arguments:

newdict
A handle to the newer version of a dictionary.
olddict
A handle to the older version of a dictionary.

Library:

libstrm

Description:

This function compares two dictionaries to find the added and modified entries. It creates a replica of the one specified by newdict but removes all entries that have matching keys and values in olddict. In other words, if olddict is the older version of some dictionary and newdict is the newer version, the resulting dictionary contains all entries that were added or modified, but not the ones that were left alone or deleted.

Note that the function destroys the newdict handle, even on failure. If the same handle is passed in for both arguments, the function destroys it and returns a new handle to an empty dictionary. Otherwise, the olddict handle is preserved.

Returns:

On success, a handle to the dictionary containing the result of the comparison. On failure, a null pointer.