icinga2
icinga2 copied to clipboard
Utility::ValidateUTF8(): move a string instead of copying a vector
less malloc() = more speed
Especially as JsonEncode() validates every single input string.
fixes #9506
Unit tests ftw!
The change is fine but there's more room for optimization. Typically, the function should do nothing as the string should usually only contain valid UTF-8. So in this case, no copy would be needed at all. But achieving this isn't really possible with the current signature, and would likely require touching all callers.
So in this case, no copy would be needed at all. But achieving this isn't really possible with the current signature, and would likely require touching all callers.
I'm currently trying to achieve this!