gmessages: Avoid strings duplication if there's nothing to format

Marco Trevisan requested to merge 3v1n0/glib:print-avoid-allocations into main

g_print(), g_printerr() and all the g_log() functions used to always duplicating a string when printing even if there's nothing to format.

This can be avoided in many cases though, so if a string has no formatting directive, we can just write it as it is without duplicating and free'ing it.

From my tests the potential strchr overhead is minimal.

Merge request reports