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 793300 - g_hash_table_add() return value change in 2.40 not mentioned in docs
g_hash_table_add() return value change in 2.40 not mentioned in docs
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: docs
unspecified
Other All
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2018-02-08 14:18 UTC by dx
Modified: 2018-02-15 11:27 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
docs: Mention the newly added g_hash_table_add() return value (1.03 KB, patch)
2018-02-08 14:28 UTC, Emmanuele Bassi (:ebassi)
accepted-commit_now Details | Review
docs: Mention the newly added g_hash_table_add() return value (1.83 KB, patch)
2018-02-08 14:34 UTC, Emmanuele Bassi (:ebassi)
none Details | Review
docs: Mention the newly added return values (1.87 KB, patch)
2018-02-08 14:34 UTC, Emmanuele Bassi (:ebassi)
committed Details | Review

Description dx 2018-02-08 14:18:43 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()
Comment 1 Emmanuele Bassi (:ebassi) 2018-02-08 14:28:13 UTC
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.
Comment 2 dx 2018-02-08 14:33:53 UTC
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)
Comment 3 Emmanuele Bassi (:ebassi) 2018-02-08 14:34:14 UTC
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.
Comment 4 Emmanuele Bassi (:ebassi) 2018-02-08 14:34:58 UTC
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.
Comment 5 Philip Withnall 2018-02-08 14:38:30 UTC
Review of attachment 368148 [details] [review]:

++
Comment 6 Philip Withnall 2018-02-08 14:40:09 UTC
Review of attachment 368152 [details] [review]:

++, reviewing the right commit this time
Comment 7 Philip Withnall 2018-02-08 14:41:26 UTC
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.
Comment 8 Emmanuele Bassi (:ebassi) 2018-02-15 11:27:25 UTC
Attachment 368152 [details] pushed as 77419cf - docs: Mention the newly added return values