|
From: | Paolo Bonzini |
Subject: | guarantees of u8_mbtouc/u8_strmbtouc (was Re: [PATCH v2 0/5] Speed up uNN_chr and uNN_strchr with Boyer-Moore algorithm) |
Date: | Thu, 29 Jul 2010 18:00:12 +0200 |
User-agent: | Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.10) Gecko/20100621 Fedora/3.0.5-1.fc13 Lightning/1.0b2pre Thunderbird/3.0.5 |
On 07/29/2010 05:36 PM, Bruno Haible wrote:
You should better use u8_strmbtouc in this case.
Aha, that's true. This function is a better match, but only because it supports CONFIG_UNICODE_SAFETY and is faster in that case (because it can just compare with zero).
Still, without safety u8_strmbtouc(puc, s) uses the same code as u8_mbtouc(puc, s, SIZE_MAX), which makes pretty much my point. I think it is safe and actually very useful to document u8_mbtouc/u16_mbtouc as looking only one byte (resp. one short) beyond the first complete character.
Paolo
[Prev in Thread] | Current Thread | [Next in Thread] |