Skip to content

g_str_equal: Provide macro for optimization

Xavier Claessens requested to merge xclaesse/glib:str-equal-only into main

g_str_equal() is a nicer API than strcmp()==0, and less error prone. However, forcing a function call prevents compiler from doing optimizations. In the case it is not used as callback to GHashTable, provide a macro that calls strcmp directly. This also has the side effect that it forces arguments to be const char * instead of gconstpointer in the case it is not used as callback, which adds type safety.

Fixes: #2775 (closed)

Merge request reports