yrutschle / sslh

Applicative Protocol Multiplexer (e.g. share SSH and HTTPS on the same port)
https://www.rutschle.net/tech/sslh/README.html
GNU General Public License v2.0
4.58k stars 367 forks source link

Fix lint problems #434

Closed stokito closed 7 months ago

stokito commented 7 months ago

The CLion IDE has built-in CLang-Tidy linter and it marked a lot of warnings. I checked and they all looks safe but just to at least reduce the visual noise here I fied some of them.

The last commit is an optimization and simplification. You are using realloc in many places but the function is often allocates a new chunk of memorh and copy from old. So it may work longer. Instead we can pre-allocate the array but fill with only needed elements. So we have one alloc instead of N. We may use slightly more memory but that's fine.

https://stackoverflow.com/questions/6727136/performance-impact-of-realloc

yrutschle commented 7 months ago

Yes, I am not sure where the realloc() comes from, probably from earlier times before I had conf2struct.

I accidently posted an "accept" review (it doesn't work the way I guessed), but I want to reject the changes to Argtables: they are external files, which ideally I'd want to let up to the distribution (but Debian does not have Argtables3), and patching them means diverging from upstreams which will garantee problems down the line.

I think everything else is fine.

stokito commented 7 months ago

I dropped commits to the argtable

yrutschle commented 7 months ago

Thanks!