strm_dict_set_index_rstr()

Updated: April 19, 2023

Modify a dictionary entry by index, using a shareable string

Synopsis:

#include <sys/strm.h>
strm_dict_t* strm_dict_set_index_rstr(strm_dict_t *dict,
                                      size_t index,
                                      strm_string_t *value)

Arguments:

dict
A dictionary handle.
index
The index of the dictionary entry to 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 value of the entry specified by index is replaced with value.

The handle in the value argument is consumed by the call, meaning you should not destroy it 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_index(), except that it may be more efficient, especially if you use clones of the same 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).