svn commit: samba r2578 - in branches/SAMBA_3_0/source/lib: .

Guenther Deschner gd at samba.org
Fri Sep 24 09:52:19 GMT 2004


Hi Jeremy,

just noticed that this crashes (segfault) smbd immediatly upon startup.

Guenther

On Fri, Sep 24, 2004 at 01:32:19AM +0000, jra at samba.org wrote:
> Author: jra
> Date: 2004-09-24 01:32:19 +0000 (Fri, 24 Sep 2004)
> New Revision: 2578
> 
> WebSVN: http://websvn.samba.org/websvn/changeset.php?rep=samba&path=/branches/SAMBA_3_0/source/lib&rev=2578&nolog=1
> 
> Log:
> Pick up optimisation from Samba4 - thanks tridge !
> - I recently found out that charaters below 0x3F are guaranteed not to
>   occur as secondary bytes in any multi-byte character set. This
>   allows for a very simple optimisation in strchr_m() and
>   strrchr_m(). It might be a good idea to pick this up for Samba3.
> Jeremy.
> 
> Modified:
>    branches/SAMBA_3_0/source/lib/util_str.c
> 
> 
> Changeset:
> Modified: branches/SAMBA_3_0/source/lib/util_str.c
> ===================================================================
> --- branches/SAMBA_3_0/source/lib/util_str.c	2004-09-24 01:21:21 UTC (rev 2577)
> +++ branches/SAMBA_3_0/source/lib/util_str.c	2004-09-24 01:32:19 UTC (rev 2578)
> @@ -1208,6 +1208,12 @@
>  	smb_ucs2_t *p;
>  	const char *s;
>  
> +	/* characters below 0x3F are guaranteed to not appear in
> +	   non-initial position in multi-byte charsets */
> +	if ((c & 0xC0) == 0) {
> +		return strchr(s, c);
> +	}
> +
>  	/* this is quite a common operation, so we want it to be
>  	   fast. We optimise for the ascii case, knowing that all our
>  	   supported multi-byte character sets are ascii-compatible
> @@ -1237,6 +1243,12 @@
>  
>  char *strrchr_m(const char *s, char c)
>  {
> +	/* characters below 0x3F are guaranteed to not appear in
> +	   non-initial position in multi-byte charsets */
> +	if ((c & 0xC0) == 0) {
> +		return strrchr(s, c);
> +	}
> +
>  	/* this is quite a common operation, so we want it to be
>  	   fast. We optimise for the ascii case, knowing that all our
>  	   supported multi-byte character sets are ascii-compatible
> 

-- 
Guenther Deschner                                               Samba Team
SerNet GmbH - Goettingen                                      gd at samba,org
gd at sernet.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.samba.org/archive/samba-cvs/attachments/20040924/2eb88de1/attachment-0001.bin


More information about the samba-cvs mailing list