After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 677064 - GString: Tweak documentation, add g_string_free_to_bytes()
GString: Tweak documentation, add g_string_free_to_bytes()
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2012-05-29 22:09 UTC by Colin Walters
Modified: 2012-07-06 14:20 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
GString: Tweak documentation, add g_string_free_to_bytes() (4.95 KB, patch)
2012-05-29 22:09 UTC, Colin Walters
committed Details | Review

Description Colin Walters 2012-05-29 22:09:13 UTC
The docs for GString should really mention GByteArray, and what makes
it different.  Drop the comparison to Java which is dated and actually
inaccurate (because StringBuffer operates on Unicode).

While we're here, add g_string_free_to_bytes(), which further
complements the spread of GBytes-based API.  For example, one can
create a buffer using GString, then send it off via
g_output_stream_write_bytes().
Comment 1 Colin Walters 2012-05-29 22:09:15 UTC
Created attachment 215223 [details] [review]
GString: Tweak documentation, add g_string_free_to_bytes()
Comment 2 Matthias Clasen 2012-07-06 03:00:24 UTC
Review of attachment 215223 [details] [review]:

no complaints about the api itself; fine with me

::: glib/gstring.c
@@ +53,3 @@
+ * A #GString is an object that handles the memory management of a C
+ * string for you.  The emphasis of #GString is on text, typically
+ * UTF-8.  Crucially, a the "str" member of a #GString is guaranteed

typo: a the

@@ +54,3 @@
+ * string for you.  The emphasis of #GString is on text, typically
+ * UTF-8.  Crucially, a the "str" member of a #GString is guaranteed
+ * to have a trailing NUL character, and it is therefore always safe

I believe we generally don't uppercase nul in the docs. If you want to change that, it should be a separate patch that fixes it everywhere. But
it increases the risk of confusing terms like nul-terminated and NULL-terminated.

@@ +249,3 @@
+ */
+GBytes*
+g_string_free_to_bytes (GString         *string)

Unnecessarily wide gap between GString and *string. One space would suffice
Comment 3 Colin Walters 2012-07-06 14:20:34 UTC
Attachment 215223 [details] pushed as 4ac0d78 - GString: Tweak documentation, add g_string_free_to_bytes()