result is only used as a comparison. For ISO C23, the function strchr
that return pointers into their input arrays now have definitions as
macros that return a pointer to a const-qualified type when the input
argument is a pointer to a const-qualified type.
fixes:
../../tilde.c: In function 'tilde_expand':
../../tilde.c:188:14: warning: assignment discards 'const' qualifier from
pointer target type [-Wdiscarded-qualifiers]
188 | if (result = strchr (string, '~'))
| ^
Signed-off-by: Rudi Heitbaum <[email protected]>
---
tilde.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tilde.c b/tilde.c
index 0e82acfc59..8198b39d91 100644
--- a/tilde.c
+++ b/tilde.c
@@ -185,7 +185,7 @@ tilde_expand (const char *string)
size_t result_size, result_index;
result_index = result_size = 0;
- if (result = strchr (string, '~'))
+ if (strchr (string, '~'))
result = (char *)xmalloc (result_size = (strlen (string) + 16));
else
result = (char *)xmalloc (result_size = (strlen (string) + 1));
--
2.51.0