[glib: 1/3] Fix some documentation issue in glib/gstrfuncs.c
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib: 1/3] Fix some documentation issue in glib/gstrfuncs.c
- Date: Tue, 30 Apr 2019 10:53:03 +0000 (UTC)
commit 95a5f63775c8bd680688b0c8c19f609837aee962
Author: Emmanuel Fleury <emmanuel fleury u-bordeaux fr>
Date: Wed Apr 17 09:49:05 2019 +0200
Fix some documentation issue in glib/gstrfuncs.c
Apparently, the documentation of g_strcanon() was not really cristal
clear, so this new code sample try to make it clear the fact that we
are working on the given string and not a copy. Moreover, it provides
a way to keep the original string at once.
Fix #29
glib/gstrfuncs.c | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
---
diff --git a/glib/gstrfuncs.c b/glib/gstrfuncs.c
index 78eb71d3e..99ceb15c7 100644
--- a/glib/gstrfuncs.c
+++ b/glib/gstrfuncs.c
@@ -1988,10 +1988,17 @@ g_strncasecmp (const gchar *s1,
* changed to the @new_delimiter character. Modifies @string in place,
* and returns @string itself, not a copy. The return value is to
* allow nesting such as
- * |[<!-- language="C" -->
+ * |[<!-- language="C" -->
* g_ascii_strup (g_strdelimit (str, "abc", '?'))
* ]|
*
+ * In order to modify a copy, you may use `g_strdup()`:
+ * |[<!-- language="C" -->
+ * reformatted = g_strdelimit (g_strdup (const_str), "abc", '?');
+ * ...
+ * g_free (reformatted);
+ * ]|
+ *
* Returns: @string
*/
gchar *
@@ -2025,10 +2032,17 @@ g_strdelimit (gchar *string,
* replaces the character with @substitutor. Modifies @string in place,
* and return @string itself, not a copy. The return value is to allow
* nesting such as
- * |[<!-- language="C" -->
+ * |[<!-- language="C" -->
* g_ascii_strup (g_strcanon (str, "abc", '?'))
* ]|
*
+ * In order to modify a copy, you may use `g_strdup()`:
+ * |[<!-- language="C" -->
+ * reformatted = g_strcanon (g_strdup (const_str), "abc", '?');
+ * ...
+ * g_free (reformatted);
+ * ]|
+ *
* Returns: @string
*/
gchar *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]