Am Donnerstag, 16. Oktober 2014, 21:50:50 schrieb Pär Karlsson: > Hi, I fould a potential gotcha when playing with clang's code analysis tool. > > The concat_strings function silently stopped counting string lengths when > given more than 5 arguments. clang warned about potential garbage values in > the saved_lengths array, so I redid it with this approach. > > All tests working ok with this patch.
Hi Pär,
good catch.
Though it is a false positive from clang (the programmer wanted the function
to be like it is ;-)), I strongly appreciate your patch, transforming
concat_strings() into a generalized function.
Maybe you can use preallocation mechanism to to avoid realloc() on each loop
iteration !?. E.g. allocate 5*sizeof(int) with the first malloc and only call
realloc when the space is depleted...
(Introducing strlcpy() would even allow to avoid 'saved_lengths' - but maybe
that is too much right now.)
Just my thoughts.
Tim
> This is my first patch to this list, by the way. I'd be happy to help out
> more in the future.
Welcome to Wget !
We appreciate any help. I want to start cleaning up the bug list - if you are
looking for appropriate jobs, have a look into
http://savannah.gnu.org/bugs/?group=wget
Feel free to ask questions. We'll try to answer them and like to support your
work.
Tim
signature.asc
Description: This is a digitally signed message part.
