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 630284 - g_hash_table_get_keys docs
g_hash_table_get_keys docs
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: general
unspecified
Other All
: Normal trivial
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2010-09-21 18:40 UTC by Morten Welinder
Modified: 2013-03-18 03:30 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Be more explicit about g_hash_table_get_keys semantics (926 bytes, patch)
2010-09-24 12:11 UTC, Christian Dywan
none Details | Review

Description Morten Welinder 2010-09-21 18:40:04 UTC
The docs for g_hash_table_get_keys say "The returned data is valid
until @hash_table is modified."  That's true, but far more restrictive
that it needs to be.

This is closer: "The returned data is valid until changes to the hash
release those keys."

In particular, if the hash has no key destructor (directly or by way of
a value destructor) then the keys are valid even after the entire hash
is destroyed.  The hash table simply does not own the keys in that case.
Comment 1 Christian Dywan 2010-09-24 12:11:49 UTC
Created attachment 171025 [details] [review]
Be more explicit about g_hash_table_get_keys semantics

I think it is good to use conservative wording in principle, but maybe it is helpful to elaborate these semantics in a separate sentence.
Comment 2 Matthias Clasen 2011-04-28 03:07:44 UTC
Looks ok to me
Comment 3 Christian Persch 2011-04-29 12:10:09 UTC
IHMO using "may" just makes it _less_ clear. If it's guaranteed, you should say "will" instead.