diff options
Diffstat (limited to 'libcnary/node.c')
| -rw-r--r-- | libcnary/node.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/libcnary/node.c b/libcnary/node.c index 264c78e..0a8f414 100644 --- a/libcnary/node.c +++ b/libcnary/node.c | |||
| @@ -95,11 +95,12 @@ int node_attach(node_t* parent, node_t* child) { | |||
| 95 | } | 95 | } |
| 96 | 96 | ||
| 97 | int node_detach(node_t* parent, node_t* child) { | 97 | int node_detach(node_t* parent, node_t* child) { |
| 98 | if (!parent || !child) return 0; | 98 | if (!parent || !child) return -1; |
| 99 | if (node_list_remove(parent->children, child) == 0) { | 99 | int index = node_list_remove(parent->children, child); |
| 100 | if (index >= 0) { | ||
| 100 | parent->count--; | 101 | parent->count--; |
| 101 | } | 102 | } |
| 102 | return 0; | 103 | return index; |
| 103 | } | 104 | } |
| 104 | 105 | ||
| 105 | int node_insert(node_t* parent, unsigned int index, node_t* child) | 106 | int node_insert(node_t* parent, unsigned int index, node_t* child) |
