EC_NODE_CLONE(3)
π EC_NODE_CLONE β okay bestie, let's clone a node π
Libecoli Programmer's Manual Β· ec_node_clone(3) Β· come sit with me, this one's short and it's iconic π¦
β¨ NAME β¨
ec_node_clone β clone a grammar node. that's it. that's the whole job. π
β¨ SYNOPSIS β¨
#include <ecoli/node.h>
struct ec_node * ec_node_clone(
struct ec_node *node /* The node to clone. */
);
look at that signature. clean. no notes. π
β¨ DESCRIPTION β¨
okay so real talk, this is not the deep-copy situation you might be picturing. ec_node_clone just takes a reference to the node. that's the move. that's the whole move. β¨
the way that works is: if you later call ec_node_free() on this node, it only decreases the reference. the actual free doesn't happen until the reference count hits 0. and the reference counter? it's initialized to 1 at node creation. π«Ά
so like, refcounting. it's giving shared ownership. slay.
β¨ RETURN VALUE β¨
- the pointer to the cloned node β and no cap, it's always equal to the parameter π
- it returns
NULLif the parameter wasNULLβ and in that case, nothing is done π
β¨ SEE ALSO β¨
the whole squad, fr fr π β go read these too:
ec_node_check_type(3)ec_node_iter(3)ec_node_attrs(3)ec_node_find(3)ec_node_type_name(3)ec_node_free(3)ec_node_id(3)ec_node_type_dump(3)ec_node_get_config(3)ec_node_schema_dump(3)ec_node_priv(3)ec_node_type_lookup(3)ec_node_dump(3)ec_node_desc(3)ec_node_iter_free(3)ec_node_iter_get_parent(3)ec_node_from_type(3)ec_node_type(3)ec_node_iter_next(3)ec_node_type_schema(3)ec_node(3)ec_node_get_children_count(3)ec_node_get_type_name(3)ec_node_type_register(3)ec_node_set_config(3)ec_node_iter_get_node(3)ec_node_get_child(3)
β¨ COPYRIGHT β¨
Copyright (C) 2010-2026 Olivier Matz, Robin Jarry. π
and that's the page!! this was libecoli, dated 2026-06-11, filed under EC_NODE_CLONE(3) β tysm for reading, bestie, go refcount responsibly π§ππΈ
π¦ where this page comes from
- fedora 44: libecoli-devel 0.11.7-1.fc44 Β· BSD-3-Clause AND LicenseRef-Fedora-Public-Domain
- fedora 44: libecoli-devel 0.11.7-1.fc44 Β· BSD-3-Clause AND LicenseRef-Fedora-Public-Domain
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms