Am 20.06.2011 23:30, schrieb Magnus Holmgren:
On 2011-06-20 22:12, mai...@svn.rockbox.org wrote:
Optimize new dircache_copy_path so that the helper (strlcat) doesn't
need to
walk through the entire string repeatedly.
Is it really a performance problem? Avoiding this kind of
pointer/buffer size juggling is one of the reasons for using
strlcpy/strlcat.
I had this before, but the optimization was kind of requested by pamaury
:) I don't feel strong either way.
Also fix a off-by-one.
Not really, as strlcpy/strlcat takes the full size of the buffer as
argument. Unless it is needed because of the offset juggling? :)
Hm, the -1 was to account for the first "buf[0] = '/';" (before entering
the helper function). But it seems now wrong as the buffer including
this first slash is passed (and the helper accounts for the first slash
as well).
Best regards.