strfuncs: add g_set_str()

This is like our other suite of g_set_*() based APIs to simplify and
improve correctness of setters for fields, properties, and more.

This implementation specifically handles setting string values that may
point to an offset within the current string by copying before free.

strcmp() is used directly (as opposed to g_strcmp0() due to it being in
gtestutils.h as well as to increase the chance that the compiler will
hoist the implementation.

Fixes #2747
This commit is contained in:
Christian Hergert
2022-09-29 11:57:53 -07:00
committed by Philip Withnall
parent 96d623843f
commit 49ae9b490d
3 changed files with 76 additions and 0 deletions

View File

@@ -1464,6 +1464,7 @@ utimbuf
<TITLE>String Utility Functions</TITLE>
<FILE>string_utils</FILE>
<INCLUDE>glib.h,glib/gprintf.h</INCLUDE>
g_set_str
g_strdup
g_strndup
g_strdupv