
On 16.08.2016 13:40, Andrea Bolognani wrote:
The first argument should be const char ** instead of char **, because this is a search function and as such it doesn't, and shouldn't, alter the haystack in any way.
This change means we no longer have to cast arrays of immutable strings to arrays of mutable strings; we still have to do the opposite, though, but that's reasonable.
Is it? I mean, we are restricting ourselves and compiler fails to see that. To me 'const char **' is more restrictive than 'char **' therefore there should be no typecast required. But this is the discussion I should have with gcc devels. For some reason, gcc does automatic typecasting to const just for the fist level pointers and not the second one. That's why compilers errors out.
--- src/lxc/lxc_native.c | 5 +++-- src/qemu/qemu_capabilities.c | 4 ++-- src/qemu/qemu_monitor_json.c | 2 +- src/qemu/qemu_process.c | 4 +++- src/util/virstring.c | 3 ++- src/util/virstring.h | 2 +- tests/qemumonitorjsontest.c | 10 +++++----- 7 files changed, 17 insertions(+), 13 deletions(-)
ACK Michal