Fix small matters and improve sysconf()

- Fix mkdeps.com out of memory error
- Remove static memory from __get_cpu_count()
- Add support for passing hyphen to cat in cocmd
- Change more ZipOS errors from ENOTSUP to EROFS
- Specify mem_unit in sysinfo() output on BSD OSes
This commit is contained in:
Justine Tunney 2023-08-17 00:25:01 -07:00
parent eebc24b9cd
commit 3a9cac4892
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
55 changed files with 411 additions and 262 deletions

View file

@ -17,11 +17,14 @@
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/mem/critbit0.h"
#include "libc/fmt/itoa.h"
#include "libc/intrin/bits.h"
#include "libc/mem/critbit0.h"
#include "libc/mem/mem.h"
#include "libc/runtime/runtime.h"
#include "libc/stdio/rand.h"
#include "libc/str/str.h"
#include "libc/testlib/ezbench.h"
#include "libc/testlib/testlib.h"
struct Bog {
@ -143,3 +146,26 @@ TEST(critbit0, manual_clear) {
ASSERT_TRUE(critbit0_delete(&tree, "hi"));
ASSERT_EQ(NULL, tree.root);
}
#define N 500
char words[N][16];
void GenerateWords(void) {
for (int i = 0; i < N; ++i) {
FormatInt32(words[i], rand());
}
}
void BuildTree(void) {
struct critbit0 tree = {0};
for (int i = 0; i < N; ++i) {
critbit0_insert(&tree, words[i]);
}
critbit0_clear(&tree);
}
BENCH(critbit0, bench) {
GenerateWords();
EZBENCH2("critbit0", donothing, BuildTree());
}