Commit ac14aa5
dir: avoid -Wdiscarded-qualifiers in remove_path()
When building with glibc-2.43 there is the following warning:
dir.c:3526:15: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
3526 | slash = strrchr(name, '/');
| ^
In this case we use a non-const pointer to get the last slash of the
unwritable file name, and then use it again to write in the strdup'd
file name.
We can avoid this warning and make the code a bit more clear by using a
separate variable to access the original argument and it's strdup'd
copy.
Signed-off-by: Collin Funk <collin.funk1@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>1 parent 1ac1d4e commit ac14aa5
1 file changed
Lines changed: 4 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3516 | 3516 | | |
3517 | 3517 | | |
3518 | 3518 | | |
3519 | | - | |
| 3519 | + | |
3520 | 3520 | | |
3521 | 3521 | | |
3522 | 3522 | | |
3523 | 3523 | | |
3524 | | - | |
3525 | | - | |
| 3524 | + | |
| 3525 | + | |
3526 | 3526 | | |
3527 | | - | |
| 3527 | + | |
3528 | 3528 | | |
3529 | 3529 | | |
3530 | 3530 | | |
| |||
0 commit comments