Introduce ctl::set and ctl::map

We now have a C++ red-black tree implementation that implements standard
template library compatible APIs while compiling 10x faster than libcxx.
It's not as beautiful as the red-black tree implementation in Plinko but
this will get the job done and the test proves it upholds all invariants

This change also restores CheckForMemoryLeaks() support and fixes a real
actual bug I discovered with Doug Lea's dlmalloc_inspect_all() function.
This commit is contained in:
Justine Tunney 2024-06-23 10:08:48 -07:00
parent 388e236360
commit c4c812c154
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
45 changed files with 2358 additions and 135 deletions

View file

@ -17,10 +17,10 @@
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/intrin/getenv.internal.h"
#include "libc/intrin/leaky.internal.h"
#include "libc/intrin/strace.internal.h"
#include "libc/macros.internal.h"
#include "libc/mem/internal.h"
#include "libc/mem/leaks.h"
#include "libc/mem/mem.h"
#include "libc/runtime/runtime.h"
#include "libc/sysv/errfuns.h"
@ -42,7 +42,7 @@ static char **__growenv(char **a) {
a = environ;
n = a ? __lenenv(a) : 0;
c = MAX(8ul, n) << 1;
if ((b = malloc(c * sizeof(char *)))) {
if ((b = may_leak(malloc(c * sizeof(char *))))) {
if (a) {
for (p = b; *a;) {
*p++ = *a++;
@ -59,8 +59,6 @@ static char **__growenv(char **a) {
}
}
IGNORE_LEAKS(__growenv)
int __putenv(char *s, bool overwrite) {
char **p;
struct Env e;