[PATCH] Optimise trim_string() front-trimming

Martin Schwenke martin at meltin.net
Sun Jun 19 10:20:03 UTC 2016


On Fri, 26 Jun 2015 16:13:51 -0700, Herb Lewis <hlewis at panasas.com>
wrote:

> We really should fix trim_string as well. The front trimming calls
> memmove for each character/string found instead of finding
> the first non-match and then calling memmove once.

Like this?  Sometimes it is worth saving easy suggestions and
attacking them when fighting a cold...  :-)

Attached patches:

1. Add some tests for trim_string()
2. Optimise trim_string()'s front trimming to call memmove(3) just once

Please review and maybe push...

peace & happiness,
martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: samba.patch
Type: text/x-patch
Size: 10201 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20160619/78bdf97e/samba.bin>


More information about the samba-technical mailing list