Skip to content

gmarkup: Optimize g_markup_escape_text()

Mohammed Sadiq requested to merge wip/sadiq/fixes into master

The string @text is supposed to be only UTF-8. Instead of reading every unichar, parse every byte, and escape if required. If there comes a UTF-8 control char, then read the unichar and escape it.

  • In best case (All are print chars), the function is ~5 times faster.
  • When every char is an XML escape char (<, >, ', ", &) the speed is +~5%.

Fixes #1376 (closed)

Merge request reports