Skip to content

Commit 1ac1d4e

Browse files
collinfunkgitster
authored andcommitted
bloom: remove a misleading const qualifier
When building with glibc-2.43 there is the following warning: bloom.c: In function ‘get_or_compute_bloom_filter’: bloom.c:515:52: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] 515 | char *last_slash = strrchr(path, '/'); | ^~~~~~~ In this case, we always write through "path" through the "last_slash" pointer. Therefore, the const qualifier on "path" is misleading and we can just remove it. Signed-off-by: Collin Funk <collin.funk1@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 9a2fb14 commit 1ac1d4e

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

bloom.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ struct bloom_filter *get_or_compute_bloom_filter(struct repository *r,
501501
struct hashmap_iter iter;
502502

503503
for (i = 0; i < diff_queued_diff.nr; i++) {
504-
const char *path = diff_queued_diff.queue[i]->two->path;
504+
char *path = diff_queued_diff.queue[i]->two->path;
505505

506506
/*
507507
* Add each leading directory of the changed file, i.e. for
@@ -523,7 +523,7 @@ struct bloom_filter *get_or_compute_bloom_filter(struct repository *r,
523523
free(e);
524524

525525
if (!last_slash)
526-
last_slash = (char*)path;
526+
last_slash = path;
527527
*last_slash = '\0';
528528

529529
} while (*path);

0 commit comments

Comments
 (0)