Skip to main content

set

Function set 

Source
pub unsafe extern "C" fn set(
    ls: *mut custom_labels_labelset_t,
    key: custom_labels_string_t,
    value: custom_labels_string_t,
    old_value_out: *mut custom_labels_string_t,
) -> c_int
Expand description

Set a new custom label, or reset an existing one, on the given label set.

Optionally, if old_value_out is non-NULL, write the old value into it (writing old_value_out->buf = NULL if there was no old value). If a non-NULL value is written into old_value_out->buf, the caller is responsible for freeing it.

This function forwards to custom_labels_careful_set if ls is the current set.

This function copies in the given strings and thus does not take ownership of the memory they point to.

SAFETY: The caller must not pass a NULL value for key.buf

Returns 0 on success, errno otherwise.