Skip to content

libtracker-miners-common: Improve terminal ellipsizing helper

Carlos Garnacho requested to merge wip/carlosg/term-ellipsizing into master

This was in a sorry state for some reasons:

  • It was pretty oblivious to UTF-8, so it might cut the string mid-character.
  • It uses g_memdup(), which should be best avoided. See glib!1928 (merged)

For the former, use g_utf8_* API to count characters (which is what we want for terminal formatting purposes). For the latter, use g_strndup(), which is gchar* oriented and takes gsize, to avoid vulnerabilities and incompatibilities.

Merge request reports