aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2014-02-25 15:09:01 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2014-02-25 15:09:01 +0100
commit12916b922065f452a5b6c043200ac0863853c7a3 (patch)
treea8b2a0f8bbd01fe84bb97421028b61949599532b
parent6554d03735e394c613ebacfe6b8d7b239e164310 (diff)
downloadbusybox-w32-12916b922065f452a5b6c043200ac0863853c7a3.tar.gz
busybox-w32-12916b922065f452a5b6c043200ac0863853c7a3.tar.bz2
busybox-w32-12916b922065f452a5b6c043200ac0863853c7a3.zip
libbb: trivial code shrink
function old new delta reset_ino_dev_hashtable 84 74 -10 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--libbb/inode_hash.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/libbb/inode_hash.c b/libbb/inode_hash.c
index 715535ef5..2f02d0746 100644
--- a/libbb/inode_hash.c
+++ b/libbb/inode_hash.c
@@ -72,13 +72,18 @@ void FAST_FUNC add_to_ino_dev_hashtable(const struct stat *statbuf, const char *
72void FAST_FUNC reset_ino_dev_hashtable(void) 72void FAST_FUNC reset_ino_dev_hashtable(void)
73{ 73{
74 int i; 74 int i;
75 ino_dev_hashtable_bucket_t *bucket; 75 ino_dev_hashtable_bucket_t *bucket, *next;
76
77 if (!ino_dev_hashtable)
78 return;
79
80 for (i = 0; i < HASH_SIZE; i++) {
81 bucket = ino_dev_hashtable[i];
76 82
77 for (i = 0; ino_dev_hashtable && i < HASH_SIZE; i++) { 83 while (bucket != NULL) {
78 while (ino_dev_hashtable[i] != NULL) { 84 next = bucket->next;
79 bucket = ino_dev_hashtable[i]->next; 85 free(bucket);
80 free(ino_dev_hashtable[i]); 86 bucket = next;
81 ino_dev_hashtable[i] = bucket;
82 } 87 }
83 } 88 }
84 free(ino_dev_hashtable); 89 free(ino_dev_hashtable);