kent: avoid recursion
This commit is contained in:
parent
3e35afcfa9
commit
5d2539fc4a
1 changed files with 6 additions and 7 deletions
|
@ -40,14 +40,13 @@ void kent_get(struct kent *kent)
|
|||
|
||||
void kent_put(struct kent *kent)
|
||||
{
|
||||
struct kent *parent = kent->parent;
|
||||
|
||||
if (atom_put(&kent->refcount) == 1) {
|
||||
do {
|
||||
struct kent *parent = kent->parent;
|
||||
if (atom_put(&kent->refcount) != 1)
|
||||
break;
|
||||
kent->destroy(kent);
|
||||
|
||||
if (parent != NULL)
|
||||
kent_put(parent);
|
||||
}
|
||||
kent = parent;
|
||||
} while (kent != NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue