gobj_write_attr()

gobj_write_attr()#

The gobj_write_attr function writes a new value to a specified attribute of a given hgobj.

Prototype

int gobj_write_attr(
    hgobj gobj,
    const char *path,
    json_t *value,
    hgobj src
);

Parameters

Key

Type

Description

gobj

hgobj

The target hgobj whose attribute will be modified.

path

const char *

The attribute path to be modified. If it contains ‘' characters, segments represent [hgobj`](#hgobj) instances, and the leaf is the attribute.

value

json_t *

The new value to be assigned to the attribute. This parameter is owned and will be decremented.

src

hgobj

The source hgobj initiating the attribute modification.


Return Value

Returns 0 on success, or -1 if the attribute is not found or an error occurs.

Notes

If the attribute does not exist, an error is logged. The function ensures that the provided value is decremented after use.

Prototype

// Not applicable in JS

Prototype

# Not applicable in Python
Examples
// TODO C examples
// TODO JS examples
# TODO Python examples