tree-wide: drop de-constifying casts for strv iteration
When the the iterator variable is declared automatically, it "inherits" the const/non-const status from the argument. We don't need to cast a const table to non-const. If we had a programming error and tried to modify the string, the compiler could now catch this.
This commit is contained in:
@@ -712,7 +712,7 @@ TEST(rename_noreplace) {
|
||||
j = strjoina(z, table[4]);
|
||||
(void) symlink("foobar", j);
|
||||
|
||||
STRV_FOREACH(a, (char**) table) {
|
||||
STRV_FOREACH(a, table) {
|
||||
_cleanup_free_ char *x = NULL, *y = NULL;
|
||||
|
||||
x = strjoin(z, *a);
|
||||
@@ -723,7 +723,7 @@ TEST(rename_noreplace) {
|
||||
continue;
|
||||
}
|
||||
|
||||
STRV_FOREACH(b, (char**) table) {
|
||||
STRV_FOREACH(b, table) {
|
||||
_cleanup_free_ char *w = NULL;
|
||||
|
||||
w = strjoin(z, *b);
|
||||
|
||||
@@ -27,7 +27,7 @@ static const char* const cases[] = {
|
||||
};
|
||||
|
||||
TEST(sysctl_normalize) {
|
||||
STRV_FOREACH_PAIR(s, expected, (const char**) cases) {
|
||||
STRV_FOREACH_PAIR(s, expected, cases) {
|
||||
_cleanup_free_ char *t;
|
||||
|
||||
assert_se(t = strdup(*s));
|
||||
|
||||
Reference in New Issue
Block a user