Skip to main content

lydict_insert

Function lydict_insert 

Source
pub unsafe extern "C" fn lydict_insert(
    ctx: *const ly_ctx,
    value: *const c_char,
    len: usize,
    str_p: *mut *const c_char,
) -> Type
Expand description

@brief Insert string into dictionary. If the string is already present, only a reference counter is incremented and no memory allocation is performed.

@param[in] ctx libyang context handler @param[in] value String to be stored in the dictionary. If NULL, function does nothing. @param[in] len Number of bytes to store. The value is not required to be NULL terminated string, the len parameter says number of bytes stored in dictionary. The specified number of bytes is duplicated and terminating NULL byte is added automatically. If \p len is 0, it is count automatically using strlen(). @param[out] str_p Optional parameter to get pointer to the string corresponding to the @p value and stored in dictionary. @return LY_SUCCESS in case of successful insertion into dictionary, note that the function does not return LY_EEXIST. @return LY_EINVAL in case of invalid input parameters. @return LY_EMEM in case of memory allocation failure.