Rename bloom_test_and_insert() to bloom_insert().
authorAndre Noll <maan@systemlinux.org>
Wed, 24 Dec 2008 13:02:50 +0000 (14:02 +0100)
committerAndre Noll <maan@systemlinux.org>
Wed, 24 Dec 2008 13:02:50 +0000 (14:02 +0100)
In order to keep statistics up to date, we always need to do the test.

bloom.c
bloom.h
create.c

diff --git a/bloom.c b/bloom.c
index 2aff535e833f75ba178bfcbf0524e0bf19d0cca7..b072ad163e23e409bb4dd2cf8139e93c95059113 100644 (file)
--- a/bloom.c
+++ b/bloom.c
@@ -96,7 +96,7 @@ static int test_and_set_bit(uint64_t bitnum, struct bloom *b)
        return ret;
 }
 
        return ret;
 }
 
-int bloom_test_and_insert(const uint8_t *data, size_t len, struct bloom *b)
+int bloom_insert(const uint8_t *data, size_t len, struct bloom *b)
 {
        int i, ret = 0;
        uint32_t h = 0xb11924e1; /* some arbitrary value */
 {
        int i, ret = 0;
        uint32_t h = 0xb11924e1; /* some arbitrary value */
@@ -153,11 +153,11 @@ struct bloom *bloom_new(unsigned order, unsigned num_hash_functions)
 
 #ifdef TEST_BLOOM
 
 
 #ifdef TEST_BLOOM
 
-int bloom_test_and_insert_string(const char *str, struct bloom *b)
+int bloom_insert_string(const char *str, struct bloom *b)
 {
        uint32_t len = strlen(str);
 
 {
        uint32_t len = strlen(str);
 
-       return bloom_test_and_insert((const uint8_t *)str, len, b);
+       return bloom_insert((const uint8_t *)str, len, b);
 }
 
 void add_stdin(struct bloom *b)
 }
 
 void add_stdin(struct bloom *b)
@@ -171,7 +171,7 @@ void add_stdin(struct bloom *b)
                        continue;
                if (buf[len - 1] == '\n')
                        buf[len - 1] = '\0';
                        continue;
                if (buf[len - 1] == '\n')
                        buf[len - 1] = '\0';
-               if (bloom_test_and_insert_string(buf, b))
+               if (bloom_insert_string(buf, b))
                        false_positives++;
        }
        INFO_LOG("filter contains %llu entries\n", b->num_entries);
                        false_positives++;
        }
        INFO_LOG("filter contains %llu entries\n", b->num_entries);
diff --git a/bloom.h b/bloom.h
index 5121606a404cb1e5bf69c585b1f933216e3e33b3..9e71c6c370b9239ba4e890b1c811d61d2e0e7e2c 100644 (file)
--- a/bloom.h
+++ b/bloom.h
@@ -22,4 +22,4 @@ struct bloom {
 
 struct bloom *bloom_new(unsigned order, unsigned num_hash_functions);
 void bloom_free(struct bloom *b);
 
 struct bloom *bloom_new(unsigned order, unsigned num_hash_functions);
 void bloom_free(struct bloom *b);
-int bloom_test_and_insert(const uint8_t *data, size_t len, struct bloom *b);
+int bloom_insert(const uint8_t *data, size_t len, struct bloom *b);
index e3f09d4b61726fdac46edef85c458b157ef6431a..cd000c2bb2225f0e8be72962ac96454942618765 100644 (file)
--- a/create.c
+++ b/create.c
@@ -56,8 +56,7 @@ static int insert_global_bloom(struct stat64 *s,
 {
        if (!consider_bloom(s))
                return 0;
 {
        if (!consider_bloom(s))
                return 0;
-       return bloom_test_and_insert(buf, GLOBAL_BLOOM_BUF_SIZE,
-               global_bloom_filter);
+       return bloom_insert(buf, GLOBAL_BLOOM_BUF_SIZE, global_bloom_filter);
 }
 
 static int insert_user_bloom(struct stat64 *s,
 }
 
 static int insert_user_bloom(struct stat64 *s,
@@ -65,8 +64,7 @@ static int insert_user_bloom(struct stat64 *s,
 {
        if (!consider_bloom(s))
                return 0;
 {
        if (!consider_bloom(s))
                return 0;
-       return bloom_test_and_insert(buf, USER_BLOOM_BUF_SIZE,
-               user_bloom_filter);
+       return bloom_insert(buf, USER_BLOOM_BUF_SIZE, user_bloom_filter);
 }
 
 static int add_directory(char *dirname, uint64_t *dir_num, uint64_t *parent_dir_num,
 }
 
 static int add_directory(char *dirname, uint64_t *dir_num, uint64_t *parent_dir_num,