Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I started the Psi with Valgrind (
valgrind --track-origins=yes psi) and on receiving MUC messages I got a lot of such warnings:I have no idea how to fix this but I checked the
TextUtil::resolveEntitiesand it looks like it just tries to unescape XML sequences i.e.&to&.The same class has the method
unescape()that does the same:If my guess is correct then the
resolveEntities()has a bug: it won't work when the&doesn't mean an escape sequence e.g.hello & bye, it will returnhello. So in the PR I fixed the bug and slightly improved its performance.But instead we can just call that
unescape()method:In fact it may work even faster but needs to be benchmarked. This is a critical for performance place (especially memory usage). So here is another branch with a simpler change https://github.com/stokito/psi/tree/resolveEntities_replace
Please select any variant.
But the Valgrind warning remains even with the change so the problem is probably somewhere in the
RTParse::next()orTextUtil::emoticonify().