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)
|
void kent_put(struct kent *kent)
|
||||||
{
|
{
|
||||||
struct kent *parent = kent->parent;
|
do {
|
||||||
|
struct kent *parent = kent->parent;
|
||||||
if (atom_put(&kent->refcount) == 1) {
|
if (atom_put(&kent->refcount) != 1)
|
||||||
|
break;
|
||||||
kent->destroy(kent);
|
kent->destroy(kent);
|
||||||
|
kent = parent;
|
||||||
if (parent != NULL)
|
} while (kent != NULL);
|
||||||
kent_put(parent);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in a new issue