This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients azsorkin, pitrou, serhiy.storchaka, vstinner
Date 2015-11-14.12:51:43
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1447505504.07.0.102766107699.issue24821@psf.upfronthosting.co.za>
In-reply-to
Content
> The patch also makes a little refactoring. STRINGLIB(fastsearch_memchr_1char) now is renamed and split on two functions STRINGLIB(find_char) and STRINGLIB(rfind_char) with simpler interface.

Could you please push this part of the change? It looks good to me.

--

The C library provides a wmemchr() function which can be used to search for a wchar_t character inside a wchar_t* string.

* for 16-bit wchar_t (ex: Windows, AIX), it can be used for Python UCS2 strings
* for 32-bit wchar_t (ex: Linux, Mac OS X), it can be used for Python UCS4 strings

I don't know if the type is signed or not. If the type is signed, we have to ensure that wmemchr() works as expected.

--

I didn't review carefully your new heuristic to search for a character.

Did you try to not use memchr() but a simple C loop for UCS-2 and UCS-4?
History
Date User Action Args
2015-11-14 12:51:44vstinnersetrecipients: + vstinner, pitrou, serhiy.storchaka, azsorkin
2015-11-14 12:51:44vstinnersetmessageid: <1447505504.07.0.102766107699.issue24821@psf.upfronthosting.co.za>
2015-11-14 12:51:44vstinnerlinkissue24821 messages
2015-11-14 12:51:43vstinnercreate