Mac OS X - compilation experiences and issues

Benjamin Riefenstahl Benjamin.Riefenstahl at
Fri Sep 12 19:27:35 GMT 2003

Hi Jeremy,

Jeremy Allison <jra at> writes:
> Just a quick comment on this section, I'll go over the rest of the
> mail later.


> On Fri, Sep 12, 2003 at 03:25:26PM +0200, Benjamin Riefenstahl wrote:
>> Probable bugs that I have seen:
>> - convert_string() doesn't fixup srclen in the generic part (below the
>>   fast-path).  Doing this as a first thing before the fast-path code
>>   also means you don't have to check for srclen==-1 at every step in
>>   that code.

Jeremy Allison <jra at> writes:
> This is intentional. Doing the scan over the string in strlen()
> there means the data is read twice. This is expensive over millions
> of calls. Not doing the strlen there, as it is only needed when
> convert_string_internal is called is a definate performace win.

If you leave the fixup in the fast-path code, you need to add an
additional fixup for the general case at the end of the function.
Missing that was the bug that I meant.

But OTOH it seems that this "general case" code is never reached
anyway, unless both "to" and "from" are CH_UCS2, which is probably
never the case.  If that is so, you could probably just end the
function with an assert ;-).

Another thought: If the fixup is only needed for
convert_string_internal(), why not move it into that function?


More information about the samba-technical mailing list