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 619420 - Optimize the overlong sequence check in g_utf8_get_char_extended()
Optimize the overlong sequence check in g_utf8_get_char_extended()
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: general
2.25.x
Other All
: Normal trivial
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks: 614856
 
 
Reported: 2010-05-23 10:58 UTC by Mikhail Zabaluev
Modified: 2010-05-27 18:00 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Optimized the overlong sequence check in g_utf8_get_char_extended() (2.27 KB, patch)
2010-05-23 11:00 UTC, Mikhail Zabaluev
none Details | Review

Description Mikhail Zabaluev 2010-05-23 10:58:24 UTC
Moving out from bug #614856, this patch optimizes g_utf8_get_char_extended().
Performance tests from bug #619418 can be used to check the results.
Comment 1 Mikhail Zabaluev 2010-05-23 11:00:32 UTC
Created attachment 161772 [details] [review]
Optimized the overlong sequence check in g_utf8_get_char_extended()

Rather make it branch to get the due sequence length for the resulting
character code, we can as well get the minimum code value in the initial
branching.

Also documented the cases when the function returns -1.
Comment 2 Behdad Esfahbod 2010-05-27 18:00:42 UTC
Committed after adding a couple more G_UNLIKELY()'s.