Skip to content

Commit b187353

Browse files
brandb97gitster
authored andcommitted
bloom: rename function operates on bloom_key
git code style requires that functions operating on a struct S should be named in the form S_verb. However, the functions operating on struct bloom_key do not follow this convention. Therefore, fill_bloom_key() and clear_bloom_key() are renamed to bloom_key_fill() and bloom_key_clear(), respectively. Signed-off-by: Lidong Yan <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 4ca7017 commit b187353

File tree

6 files changed

+16
-19
lines changed

6 files changed

+16
-19
lines changed

blame.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1310,7 +1310,7 @@ static void add_bloom_key(struct blame_bloom_data *bd,
13101310
}
13111311

13121312
bd->keys[bd->nr] = xmalloc(sizeof(struct bloom_key));
1313-
fill_bloom_key(path, strlen(path), bd->keys[bd->nr], bd->settings);
1313+
bloom_key_fill(bd->keys[bd->nr], path, strlen(path), bd->settings);
13141314
bd->nr++;
13151315
}
13161316

bloom.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -221,9 +221,7 @@ static uint32_t murmur3_seeded_v1(uint32_t seed, const char *data, size_t len)
221221
return seed;
222222
}
223223

224-
void fill_bloom_key(const char *data,
225-
size_t len,
226-
struct bloom_key *key,
224+
void bloom_key_fill(struct bloom_key *key, const char *data, size_t len,
227225
const struct bloom_filter_settings *settings)
228226
{
229227
int i;
@@ -243,7 +241,7 @@ void fill_bloom_key(const char *data,
243241
key->hashes[i] = hash0 + i * hash1;
244242
}
245243

246-
void clear_bloom_key(struct bloom_key *key)
244+
void bloom_key_clear(struct bloom_key *key)
247245
{
248246
FREE_AND_NULL(key->hashes);
249247
}
@@ -500,9 +498,9 @@ struct bloom_filter *get_or_compute_bloom_filter(struct repository *r,
500498

501499
hashmap_for_each_entry(&pathmap, &iter, e, entry) {
502500
struct bloom_key key;
503-
fill_bloom_key(e->path, strlen(e->path), &key, settings);
501+
bloom_key_fill(&key, e->path, strlen(e->path), settings);
504502
add_key_to_filter(&key, filter, settings);
505-
clear_bloom_key(&key);
503+
bloom_key_clear(&key);
506504
}
507505

508506
cleanup:

bloom.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,9 @@ int load_bloom_filter_from_graph(struct commit_graph *g,
7878
struct bloom_filter *filter,
7979
uint32_t graph_pos);
8080

81-
void fill_bloom_key(const char *data,
82-
size_t len,
83-
struct bloom_key *key,
81+
void bloom_key_fill(struct bloom_key *key, const char *data, size_t len,
8482
const struct bloom_filter_settings *settings);
85-
void clear_bloom_key(struct bloom_key *key);
83+
void bloom_key_clear(struct bloom_key *key);
8684

8785
void add_key_to_filter(const struct bloom_key *key,
8886
struct bloom_filter *filter,

line-log.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1172,12 +1172,13 @@ static int bloom_filter_check(struct rev_info *rev,
11721172
return 0;
11731173

11741174
while (!result && range) {
1175-
fill_bloom_key(range->path, strlen(range->path), &key, rev->bloom_filter_settings);
1175+
bloom_key_fill(&key, range->path, strlen(range->path),
1176+
rev->bloom_filter_settings);
11761177

11771178
if (bloom_filter_contains(filter, &key, rev->bloom_filter_settings))
11781179
result = 1;
11791180

1180-
clear_bloom_key(&key);
1181+
bloom_key_clear(&key);
11811182
range = range->next;
11821183
}
11831184

revision.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -739,15 +739,15 @@ static void prepare_to_use_bloom_filter(struct rev_info *revs)
739739
revs->bloom_keys_nr = path_component_nr;
740740
ALLOC_ARRAY(revs->bloom_keys, revs->bloom_keys_nr);
741741

742-
fill_bloom_key(path, len, &revs->bloom_keys[0],
742+
bloom_key_fill(&revs->bloom_keys[0], path, len,
743743
revs->bloom_filter_settings);
744744
path_component_nr = 1;
745745

746746
p = path + len - 1;
747747
while (p > path) {
748748
if (*p == '/')
749-
fill_bloom_key(path, p - path,
750-
&revs->bloom_keys[path_component_nr++],
749+
bloom_key_fill(&revs->bloom_keys[path_component_nr++],
750+
path, p - path,
751751
revs->bloom_filter_settings);
752752
p--;
753753
}
@@ -3230,7 +3230,7 @@ void release_revisions(struct rev_info *revs)
32303230
oidset_clear(&revs->missing_commits);
32313231

32323232
for (int i = 0; i < revs->bloom_keys_nr; i++)
3233-
clear_bloom_key(&revs->bloom_keys[i]);
3233+
bloom_key_clear(&revs->bloom_keys[i]);
32343234
FREE_AND_NULL(revs->bloom_keys);
32353235
revs->bloom_keys_nr = 0;
32363236
}

t/helper/test-bloom.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ static struct bloom_filter_settings settings = DEFAULT_BLOOM_FILTER_SETTINGS;
1212
static void add_string_to_filter(const char *data, struct bloom_filter *filter) {
1313
struct bloom_key key;
1414

15-
fill_bloom_key(data, strlen(data), &key, &settings);
15+
bloom_key_fill(&key, data, strlen(data), &settings);
1616
printf("Hashes:");
1717
for (size_t i = 0; i < settings.num_hashes; i++)
1818
printf("0x%08x|", key.hashes[i]);
1919
printf("\n");
2020
add_key_to_filter(&key, filter, &settings);
21-
clear_bloom_key(&key);
21+
bloom_key_clear(&key);
2222
}
2323

2424
static void print_bloom_filter(struct bloom_filter *filter) {

0 commit comments

Comments
 (0)