[sr-dev] [PATCH 1/1] websocket: remove libunistring dependency

Timo Teras timo.teras at iki.fi
Fri Dec 20 15:09:41 CET 2013


On Fri, 20 Dec 2013 13:56:08 +0000
Peter Dunkley <peter.dunkley at crocodile-rcs.com> wrote:

> One of the reasons I used libunistring for this detection is that for
> pretty much all of the code fragments I found online for doing this
> in a "simple" way I saw people pointing out flaws in those
> algorithms.  Can you confirm that this code doesn't have any of those
> flaws and is guaranteed to work in all cases (has this implementation
> been stubbed out and tested fully by someone here)?

Did you read the document on the URL it refers to? It is quite thorough
explanation of what it does, it's correctness and speed. It also
explains that the motivation for implementing it was because all those
snippets in the internet are seriously flawed.

> What new systems does libunistring not work on?  I have only ever had
> problems with it on older OS versions which didn't contain it at all.

It embeds an ancient gnulib version, and is not updateable easily. This
makes it fail on systems using musl c-library. gnulib started to
support it properly only few years ago. gnulib also at various places
wants to touch libc internals so it can be considered a problem if
porting to new systems.

Also the autoconfigury is not cannot be regenerated with new autotools.

> Does this really improve performance?  Only a tiny, tiny, subset of
> libunistring is used.  As a result it doesn't really matter if
> libunistring in general is slow, just whether or not the one function
> used from libunistring is slow.

I'm referring specifically to the function you use. Please check the
URL for performance comparison. While libunistring is not benchmarked
separately, one can see with 0.1 second look at libunistring's
implementation that it will be slower in performance and is likely
something close to iconv()'s implementation.

> It also looks like the code style (particularly indentation) of that
> patch doesn't really match the style from that file.  If that really
> is the case it is probably worth aligning the patch to the style in
> that file before applying and committing it.

Sure. Indentation is easy to fix.

Thanks,
 Timo



More information about the sr-dev mailing list