Skip to content

gstrfuncs: Make g_str_has_* more robust against non-idempotent inputs

Ray Strode requested to merge sometimes-theres-extra-strings-attached into main

g_str_has_{prefix,suffix} are now implemented using a macro. The macro fails to account for the fact that accessing the input may cause side effects however.

That could break existing users of the functions and also causes compiler warnings that require strange looking workarounds.

This commit solves both issues by storing the inputs in temporaries before accesing them.

Closes: #2784 (closed)

Edited by Ray Strode

Merge request reports