strm_dict_set_rstr()

Updated: May 06, 2022

Add or modify a dictionary entry using shareable strings

Synopsis:

#include <sys/strm.h>
strm_dict_t* strm_dict_set_rstr(strm_dict_t *dict,
                                strm_string_t *key,
                                strm_string_t *value)

Arguments:

dict
A dictionary handle.
key
The key of the dictionary entry to add or modify.
value
The new value for the dictionary entry.

Library:

libstrm

Description:

This function creates a new dictionary that is an exact replica of the one specified by dict, except that the entry specified by key is added or modified. The entry's value is set to value.

The shareable string handles in the key and value arguments are consumed by the call, meaning you should not destroy them later because the dictionary will do so at the appropriate time. The original dictionary handle is destroyed on success but preserved on failure.

This function is equivalent to strm_dict_set(), except that it may be more efficient, especially if you use clones of the same key or value repeatedly.

Returns:

On success, a handle to the new dictionary. On failure, a null pointer (if you provided an out-of-range index, errno is set to ESRCH).