rrthomas / enchant

enchant spellchecking library
http://rrthomas.github.io/enchant/
GNU Lesser General Public License v2.1
347 stars 60 forks source link

hspell: Correct usage of g_return_val_if_fail and g_warning #396

Closed yoseforb closed 3 months ago

yoseforb commented 3 months ago

Epiphany's commit #70f8362e treats critical warnings as fatal, causing epiphany to crash when hspell_convert_to_iso8859_8 fails instead of just logging a warning.

The g_return_val_if_fail macro is intended to validate parameters passed to a function, meaning it should only be used to indicate programmer errors.

This commit adds g_return_val_if_fail to check only the function’s parameters, and replaces g_return_if_fail with g_warning for checking the result of hspell_convert_to_iso8859_8.

Fix #394

yoseforb commented 3 months ago

Sorry for the reopening, I didn't see how to update the old PR.

rrthomas commented 3 months ago

Thanks for this; please just remove the extra calls to g_return_val_if_fail, as per comments.

yoseforb commented 3 months ago

Thanks for this; please just remove the extra calls to g_return_val_if_fail, as per comments.

To remove all the calls to g_return_val_if_fail? I don't understand what calls is extra there.

rrthomas commented 3 months ago

I did mean all the calls. I just meant "extra" in the sense of "not previously present"!

rrthomas commented 3 months ago

Thanks! This unlocks a minor simplification (and sorry for my slightly inept use of the review mechanism).

rrthomas commented 3 months ago

Many thanks for this, I'll make a point release soon.