[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 0/5] Speed up uNN_chr and uNN_strchr with Boyer-Moore algo
From: |
Bruno Haible |
Subject: |
Re: [PATCH v2 0/5] Speed up uNN_chr and uNN_strchr with Boyer-Moore algorithm |
Date: |
Wed, 28 Jul 2010 23:32:29 +0200 |
User-agent: |
KMail/1.9.9 |
Pádraig Brady wrote:
> I would suggest a new function due to the
> way I see this function called most often.
>
> /* definitely not sure of this name */
> uint8_t *
> u8_str_u8_chr (const uint8_t *s, const uint8_t *c, size_t size)
> {
> switch (size):
> {
> case 1:
> return (uint8_t *) strchr ((const char *) s, *c);
> case 2:
> //use logic from current u8_strchr()
> case 3:
> ...
> case 4:
> ...
> }
> }
> ...
> while ((f=u8_str_u8_chr (s, "–", 3));
Such an API does not appear very robust to me: it is quite easy to
mistakenly pass a string consisting of more or less than 1 character as
second argument. If the argument to be searched for is given as an
UTF-8 string rather than as an ucs4_t, I would better recommend to use
the u8_strstr function.
Bruno
- [PATCH v2 3/5] unistr/u*-chr: test multibyte sequences more, (continued)
- [PATCH v2 3/5] unistr/u*-chr: test multibyte sequences more, bonzini, 2010/07/23
- [PATCH v2 4/5] unistr/u*-strchr: add tests, bonzini, 2010/07/23
- [PATCH v2 5/5] unistr/u8-chr, unistr/u8-strchr: use Boyer-Moore like algorithm., bonzini, 2010/07/23
- Re: [PATCH v2 0/5] Speed up uNN_chr and uNN_strchr with Boyer-Moore algorithm, Bruno Haible, 2010/07/23
- Re: [PATCH v2 0/5] Speed up uNN_chr and uNN_strchr with Boyer-Moore algorithm, Paolo Bonzini, 2010/07/23
- Re: [PATCH v2 0/5] Speed up uNN_chr and uNN_strchr with Boyer-Moore algorithm, Pádraig Brady, 2010/07/27
- Re: [PATCH v2 0/5] Speed up uNN_chr and uNN_strchr with Boyer-Moore algorithm, Paolo Bonzini, 2010/07/27
- Re: [PATCH v2 0/5] Speed up uNN_chr and uNN_strchr with Boyer-Moore algorithm, Pádraig Brady, 2010/07/27
- Re: [PATCH v2 0/5] Speed up uNN_chr and uNN_strchr with Boyer-Moore algorithm, Paolo Bonzini, 2010/07/27
- Re: ucs4_t type, Bruno Haible, 2010/07/28
- Re: [PATCH v2 0/5] Speed up uNN_chr and uNN_strchr with Boyer-Moore algorithm,
Bruno Haible <=
- Re: [PATCH v2 0/5] Speed up uNN_chr and uNN_strchr with Boyer-Moore algorithm, Pádraig Brady, 2010/07/29
- Re: [PATCH v2 0/5] Speed up uNN_chr and uNN_strchr with Boyer-Moore algorithm, Paolo Bonzini, 2010/07/29
- Re: [PATCH v2 0/5] Speed up uNN_chr and uNN_strchr with Boyer-Moore algorithm, Pádraig Brady, 2010/07/29
- Re: [PATCH v2 0/5] Speed up uNN_chr and uNN_strchr with Boyer-Moore algorithm, Paolo Bonzini, 2010/07/29
- Message not available
- Message not available
- Re: [PATCH v2 0/5] Speed up uNN_chr and uNN_strchr with Boyer-Moore algorithm, Paolo Bonzini, 2010/07/29
- Re: [PATCH v2 0/5] Speed up uNN_chr and uNN_strchr with Boyer-Moore algorithm, Bruno Haible, 2010/07/29
- Re: [PATCH v2 0/5] Speed up uNN_chr and uNN_strchr with Boyer-Moore algorithm, Paolo Bonzini, 2010/07/29
- Re: [PATCH v2 0/5] Speed up uNN_chr and uNN_strchr with Boyer-Moore algorithm, Bruno Haible, 2010/07/31
- guarantees of u8_mbtouc/u8_strmbtouc (was Re: [PATCH v2 0/5] Speed up uNN_chr and uNN_strchr with Boyer-Moore algorithm), Paolo Bonzini, 2010/07/29
- Re: guarantees of u8_mbtouc/u8_strmbtouc, Bruno Haible, 2010/07/31