Skip to content

Commit 651847f

Browse files
committed
Merge branch 'cf/constness-fixes'
Small code clean-up around the constness area. * cf/constness-fixes: dir: avoid -Wdiscarded-qualifiers in remove_path() bloom: remove a misleading const qualifier
2 parents 6e8d538 + 02cbae6 commit 651847f

2 files changed

Lines changed: 6 additions & 6 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);

dir.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3518,15 +3518,15 @@ int get_sparse_checkout_patterns(struct pattern_list *pl)
35183518

35193519
int remove_path(const char *name)
35203520
{
3521-
char *slash;
3521+
const char *last;
35223522

35233523
if (unlink(name) && !is_missing_file_error(errno))
35243524
return -1;
35253525

3526-
slash = strrchr(name, '/');
3527-
if (slash) {
3526+
last = strrchr(name, '/');
3527+
if (last) {
35283528
char *dirs = xstrdup(name);
3529-
slash = dirs + (slash - name);
3529+
char *slash = dirs + (last - name);
35303530
do {
35313531
*slash = '\0';
35323532
if (startup_info->original_cwd &&

0 commit comments

Comments
 (0)