mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-04 02:08:30 +00:00
Remove old stack code and improve dirstream
This commit is contained in:
parent
74caabb823
commit
dc6c67256f
61 changed files with 463 additions and 595 deletions
|
@ -25,15 +25,9 @@
|
|||
* Inserts 𝑢 into 𝑡.
|
||||
* @param t tree
|
||||
* @param u NUL-terminated string
|
||||
* @return true if 𝑡 was mutated, or -1 w/ errno
|
||||
* @return 1 if 𝑡 was mutated, 0 if present, or -1 w/ errno
|
||||
* @note h/t djb and agl
|
||||
*/
|
||||
int critbit0_insert(struct critbit0 *t, const char *u) {
|
||||
char *p;
|
||||
size_t n;
|
||||
if ((p = malloc((n = strlen(u)) + 1))) {
|
||||
return critbit0_emplace(t, memcpy(p, u, n + 1), n);
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
return critbit0_emplace(t, u, strlen(u));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue