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 774311 - Provide replacement function for memrchr()
Provide replacement function for memrchr()
Status: RESOLVED FIXED
Product: gcr
Classification: Core
Component: General
git master
Other Mac OS
: Normal normal
: ---
Assigned To: GNOME keyring maintainer(s)
GNOME keyring maintainer(s)
Depends on:
Blocks: 774453
 
 
Reported: 2016-11-12 08:11 UTC by Philip Chimento
Modified: 2019-02-22 11:57 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
egg-armor: Provide replacement for memrchr() (1.44 KB, patch)
2016-11-12 08:11 UTC, Philip Chimento
none Details | Review
egg-armor: Use g_strrstr_len() instead of memrchr() (937 bytes, patch)
2016-11-15 04:41 UTC, Philip Chimento
none Details | Review

Description Philip Chimento 2016-11-12 08:11:31 UTC
On macOS there is no memchr(). Instead of providing a hand-rolled implementation we can instead use a GLib function (which will probably be slightly slower though, so I didn't change it unconditionally.)
Comment 1 Philip Chimento 2016-11-12 08:11:58 UTC
Created attachment 339679 [details] [review]
egg-armor: Provide replacement for memrchr()

On a system that doesn't have memrchr(), use g_strrstr_len() instead;
which will probably be slower because it searches for a whole string
instead of a character.
Comment 2 Stef Walter 2016-11-14 10:21:16 UTC
Review of attachment 339679 [details] [review]:

Could we just use g_strstr_len() for all cases? I would prefer not to have the #ifdef here.
Comment 3 Philip Chimento 2016-11-15 04:41:17 UTC
(In reply to Stef Walter from comment #2)
> Review of attachment 339679 [details] [review] [review]:
> 
> Could we just use g_strstr_len() for all cases? I would prefer not to have
> the #ifdef here.

Sure, will do.
Comment 4 Philip Chimento 2016-11-15 04:41:36 UTC
Created attachment 339879 [details] [review]
egg-armor: Use g_strrstr_len() instead of memrchr()

Not all systems have memrchr(), so g_strrstr_len() is more portable,
though probably slower.
Comment 5 Stef Walter 2016-11-15 12:46:22 UTC
Attachment 339879 [details] pushed as 80b5b29 - egg-armor: Use g_strrstr_len() instead of memrchr()
Comment 6 Stef Walter 2016-11-15 12:46:39 UTC
Attachment 339879 [details] pushed as 097089b - egg-armor: Use g_strrstr_len() instead of memrchr()