GNOME Bugzilla – Bug 774311
Provide replacement function for memrchr()
Last modified: 2019-02-22 11:57:52 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.)
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.
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.
(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.
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.
Attachment 339879 [details] pushed as 80b5b29 - egg-armor: Use g_strrstr_len() instead of memrchr()
Attachment 339879 [details] pushed as 097089b - egg-armor: Use g_strrstr_len() instead of memrchr()