diff options
author | H. Peter Anvin <hpa@zytor.com> | 2010-06-26 18:46:33 -0700 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2010-06-26 18:46:33 -0700 |
commit | 17a32fe2e902d7d65b2f6aa3f501456662d53fc4 (patch) | |
tree | af211658cc86c12374004718dad59b0801c626b0 /core/fs | |
parent | 6d3918a893e83267342ebd6b7d5c03cad4f27635 (diff) | |
download | syslinux-17a32fe2e902d7d65b2f6aa3f501456662d53fc4.tar.gz |
core, fs: eliminate recursion in put_inode()
We don't actually need recursion in put_inode(), so replace recursion
with a loop.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'core/fs')
-rw-r--r-- | core/fs/fs.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/core/fs/fs.c b/core/fs/fs.c index a101dfda..48856c9e 100644 --- a/core/fs/fs.c +++ b/core/fs/fs.c @@ -34,11 +34,10 @@ struct inode *alloc_inode(struct fs_info *fs, uint32_t ino, size_t data) */ void put_inode(struct inode *inode) { - if (inode) { - if (! --inode->refcnt) { - put_inode(inode->parent); - free(inode); - } + while (inode && --inode->refcnt == 0) { + struct inode *dead = inode; + inode = inode->parent; + free(dead); } } |