floating_humanizer([1000-1024], true) with base 8 returns "2K", whereas it should return
"1.0K" to align with other formats. The conversion is also broken for
all other units(e.g. 1023M is also broken and returns "2G")
Using std::string_view instead of std::string& silences a new warning
from GCC 13, -Wdangling-reference
Also switch return type of `getI` from int& to int, trivial types are
cheaper to copy by value
See https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2431.pdf
TLDR: NULL is of type int and relies on proper implicit pointer
conversion which may lead to issues when using overloaded functions
It is also considered a 'best practise' for modern C++ and
conveys the programmers intention more precisly.
Get the load average from libc and adjust the internal API. This has
less overhead than opening /proc/loadavg.
Favor emplace_back over push_back, in general it has the chance to not
create a temporary object.
Correct data types in calls to std::accumulate(). The "bandwidth" deques
have type "long long", so the initial value of the accumulator (0) must
also be "long long" (i.e., "0ll") to prevent integer overflows. Also,
since since the bandwidth deques are (signed) "long long", the avg_speed
should presumably be a signed "long long" instead of an unsigned
"uint64_t". The previous behavior was for large bandwidth values to
overflow the accumulator, resulting in a negative total, which then was
cast to be a huge "uint64_t" value. As a consequence, the network graph
autoscaling was broken for large bandwidths.
Clang 16.0.0 or later can now be used to compile btop. Simply call
`CXX=clang++` make.
If the CXX variable contains an incompatible Clang version try to
fallback to GCC.
Returning from the thread this way prevents local variables to be
destructed correctly since pthread_exit is marked noreturn.
This fixes a segmentation fault with glibc and llvm-libunwind on exit.
check.
Clang cannot handle <semaphore> being included in a namespace, which is
also unadvised see:
https://softwareengineering.stackexchange.com/a/335261.
Using the fallback <semaphore.h> is only meant for GCC 10, but Clang
defines `__GNUC__ = 4` so exclude Clang.