libbb: trivial code shrink
authorDenys Vlasenko <vda.linux@googlemail.com>
Tue, 25 Feb 2014 14:09:01 +0000 (15:09 +0100)
committerDenys Vlasenko <vda.linux@googlemail.com>
Tue, 25 Feb 2014 14:09:01 +0000 (15:09 +0100)
function                                             old     new   delta
reset_ino_dev_hashtable                               84      74     -10

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
libbb/inode_hash.c

index 715535ef5327298c2aca030363ec523db2c8973e..2f02d074620b60b4ed045d3652bbc926ee8ceef3 100644 (file)
@@ -72,13 +72,18 @@ void FAST_FUNC add_to_ino_dev_hashtable(const struct stat *statbuf, const char *
 void FAST_FUNC reset_ino_dev_hashtable(void)
 {
        int i;
-       ino_dev_hashtable_bucket_t *bucket;
+       ino_dev_hashtable_bucket_t *bucket, *next;
+
+       if (!ino_dev_hashtable)
+               return;
+
+       for (i = 0; i < HASH_SIZE; i++) {
+               bucket = ino_dev_hashtable[i];
 
-       for (i = 0; ino_dev_hashtable && i < HASH_SIZE; i++) {
-               while (ino_dev_hashtable[i] != NULL) {
-                       bucket = ino_dev_hashtable[i]->next;
-                       free(ino_dev_hashtable[i]);
-                       ino_dev_hashtable[i] = bucket;
+               while (bucket != NULL) {
+                       next = bucket->next;
+                       free(bucket);
+                       bucket = next;
                }
        }
        free(ino_dev_hashtable);