lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:	Sun, 10 Dec 2006 19:37:23 -0800 (PST)
From:	Amit Choudhary <amit2030@...oo.com>
To:	Linux Kernel <linux-kernel@...r.kernel.org>
Subject: Re: 2.6.19: slight performance optimization for lib/string.c's strstrip()


> How about this:
> 
> char *strstrip(char *s)
> {
>         size_t less = 0;
>         char c = 0;
>         char *e = NULL;
> 
>         while ((c=*s) && isspace(c))
>                 s++;
>         if (!c)
>                 return s;
> 
>         e = s;
> 
>         while (c=*e) {
>                  less = isspace(c) ? (less + 1) : 0;
>                  e++;
>         }
> 
>         *(e-less) = 0;
> 
>         return s;
> }
> 

Well, this is not very efficient because it ends up calling isspace() function for all characters.
So, Ulrich's algo is the fastest.

-Amit


 
____________________________________________________________________________________
Yahoo! Music Unlimited
Access over 1 million songs.
http://music.yahoo.com/unlimited
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ