Fix compiler warning with latest gcc
PATCH 1/1 Fix compiler warning with latest gcc
CC src/diff.osrc/diff.c: In function ‘diff_common_add_diff_stat’:src/diff.c:191:22: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
191 | char *pipe = strchr(data, '|');
| ^~~~~~
--- src/diff.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
src/diff.c +1 -1
@@ -188,7 +188,7 @@ diff_common_add_diff_stat(struct view *view, const char *text, size_t offset)const char *start = text + offset;const char *data = start +strspn (start," " );size_t len =strlen (data); -char *pipe =strchr (data,'|' ); +const char *pipe =strchr (data,'|' );/* Ensure that '|' is present and the file name part contains * non-space characters. */
Signature · 1 line
2.53.0
Quoted 14 lines · Marcel Holtmann
CC
src/diff.osrc/diff.c: In function ‘diff_common_add_diff_stat’:src/diff.c:191:22: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
191 | char *pipe =strchr(data, '|');
| ^~~~~~--- src/diff.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)src/diff.c +0
-0
src/diff.c diff_common_add_diff_stat(struct view *view, const char *text, size_t offset) · line 194
Quoted 8 lines
src/diff.c +1
-1@@ -188,7 +188,7 @@ diff_common_add_diff_stat(struct view *view, const char *text, size_t offset)const char *start = text + offset;const char *data = start +strspn (start," " );size_t len =strlen (data); -char *pipe =strchr (data,'|' ); +const char *pipe =strchr (data,'|' );/* Ensure that '|' is present and the file name part contains * non-space characters. */
Minor nit about the commit message, but this is due to a glibc-2.43 change. It isn't related to GCC versions.
Collin
Hi Collin,
Quoted 20 lines
Quoted 20 lines
CC
src/diff.osrc/diff.c: In function ‘diff_common_add_diff_stat’:src/diff.c:191:22: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
191 | char *pipe =strchr(data, '|');
| ^~~~~~
---src/diff.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)src/diff.c +1
-1@@ -188,7 +188,7 @@ diff_common_add_diff_stat(struct view *view, const char *text, size_t offset)const char *start = text + offset;const char *data = start +strspn (start," " );size_t len =strlen (data); -char *pipe =strchr (data,'|' ); +const char *pipe =strchr (data,'|' );
Quoted 5 lines
src/diff.c diff_common_add_diff_stat(struct view *view, const char *text, size_t offset) · line 194
Quoted 2 lines
src/diff.c +0
-0/* Ensure that '|' is present and the file name part contains * non-space characters. */ Minor nit about the commit message, but this is due to a glibc-2.43 change. It isn't related to GCC versions.
do you want me to fix it and send a v2 or do you just amend it after applying the patch?
Regards
Marcel