pub unsafe extern "C" fn lydict_insert_zc(
ctx: *const ly_ctx,
value: *mut c_char,
str_p: *mut *const c_char,
) -> TypeExpand description
@brief Insert string into dictionary - zerocopy version. If the string is already present, only a reference counter is incremented and no memory allocation is performed. This insert function variant avoids duplication of specified value - it is inserted into the dictionary directly.
@param[in] ctx libyang context handler @param[in] value NULL-terminated string to be stored in the dictionary. If the string is not present in dictionary, the pointer is directly used by the dictionary. Otherwise, the reference counter is incremented and the value is freed. So, after calling the function, caller is supposed to not use the value address anymore. If NULL, function does nothing. @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.