GNOME Bugzilla – Bug 793300
g_hash_table_add() return value change in 2.40 not mentioned in docs
Last modified: 2018-02-15 11:27:35 UTC
glib 2.40 changed the return value of g_hash_table_add() from void to boolean. This isn't mentioned in the documentation, other than the fact that the 2.38 version of the docs has void and the 2.40 version has boolean as the return value. I don't see any mentions of it in the NEWS file either. This change was done in commit 910191597a6c2e5d5d460e9ce9efb4f47d9cc63c which references bug 697828 The last comment in that bug says: >In my patch the doc is more complete, I think it is important to at least tell since which version there is a return value. I agree. I'm not sure why that patch wasn't applied, but it would need changing the mentioned version from 2.38 since it appears to have landed in 2.40. We just got hit by this in https://github.com/irssi/irssi/pull/843 - a RHEL 6 user complained the build broke because we unknowingly relied on the return value of g_hash_table_add()
Created attachment 368148 [details] [review] docs: Mention the newly added g_hash_table_add() return value The return value of the g_hash_table_add() function was changed from void to gboolean in GLib 2.40, but it was not mentioned in the API reference or the release notes.
That was quick! Don't forget g_hash_table_insert() and g_hash_table_replace() (right after submitting the bug i realized our issue was with _insert, not _add, but close enough)
Created attachment 368151 [details] [review] docs: Mention the newly added g_hash_table_add() return value The return value of the g_hash_table_add() function was changed from void to gboolean in GLib 2.40, but it was not mentioned in the API reference or the release notes.
Created attachment 368152 [details] [review] docs: Mention the newly added return values The return value of the g_hash_table_add(), g_hash_table_insert(), and g_hash_table_replace() functions was changed from void to gboolean in GLib 2.40, but it was not mentioned in the API reference or the release notes.
Review of attachment 368148 [details] [review]: ++
Review of attachment 368152 [details] [review]: ++, reviewing the right commit this time
I think it would be nice to get the examples from https://bugzilla.gnome.org/review?bug=697828&attachment=241571 into the documentation, since those patterns are not immediately obvious to people who are new to the GHashTable API. That can be done as a separate patch.
Attachment 368152 [details] pushed as 77419cf - docs: Mention the newly added return values