Add pd_free_node function

This commit is contained in:
Philip Minakov 2026-03-11 13:16:51 +04:00
parent 05361f271d
commit 97584bdcd1
No known key found for this signature in database
GPG key ID: 932F1B884934DB0F
2 changed files with 7 additions and 0 deletions

View file

@ -260,6 +260,12 @@ int pd_write_file(const char *file_name, const pd_node_t **nodes) {
return 0;
}
void pd_free_node(pd_node_t *node) {
if (node) {
free(node);
}
}
void pd_free_nodes(pd_node_t **nodes) {
if (nodes) {
for (int i = 0; nodes[i] != NULL; i++) {

View file

@ -27,6 +27,7 @@ pd_node_t *pd_alloc_integer_node(const char *group, const char *key, int value);
pd_node_t *pd_alloc_string_node(const char *group, const char *key, const char *value);
int pd_read_file(const char *file_name, pd_node_t ***nodes);
int pd_write_file(const char *file_name, const pd_node_t **nodes);
void pd_free_node(pd_node_t *node);
void pd_free_nodes(pd_node_t **nodes);
int pd_get_max_group_size();