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 583036 - g_strchomp and g_strchug are not declared const
g_strchomp and g_strchug are not declared const
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: general
2.20.x
Other All
: Normal minor
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2009-05-18 12:42 UTC by Jonathan Yu
Modified: 2014-01-20 09:54 UTC
See Also:
GNOME target: ---
GNOME version: Unversioned Enhancement


Attachments
Bug 583036 — g_strchomp and g_strchug are not declared const (1.56 KB, patch)
2010-03-31 18:50 UTC, Philip Withnall
none Details | Review

Description Jonathan Yu 2009-05-18 12:42:59 UTC
I suggest that those two named functions have parameters which are declared as const, since the documents seem to indicate that they are not actually changed - it looks like the copy of the pointer passed as arguments is simply shifted up by the amount of whitespace (in the case of strchug) and returned.

If that is the case, then I'd like to see the parameters marked const. If the stuff is actually changed, though, then I'd like some change in the documentation to indicate that data you pass to those commands should be strdup'd before passing.

Other information:
Comment 1 Philip Withnall 2010-03-31 18:50:43 UTC
Created attachment 157629 [details] [review]
Bug 583036 — g_strchomp and g_strchug are not declared const

Clarify in the documentation for g_strchomp() and g_strchug() that they
modify the strings they're passed, and shouldn't be used on statically
allocated memory. Closes: bgo#583036
Comment 2 Philip Withnall 2014-01-20 09:54:44 UTC
Fixed by commit 2efc2ef77526fb902f1d603875eaca833b47f0b5.