Make minor improvements

- Work towards simplifying ape.S startup process
- Rewrote ar because it took minutes to build cosmopolitan.a
This commit is contained in:
Justine Tunney 2020-11-09 15:41:11 -08:00
parent 95bc650be8
commit aea89fe832
70 changed files with 1037 additions and 456 deletions

View file

@ -20,9 +20,20 @@
#include "libc/nexgen32e/hascharacter.h"
#include "libc/str/str.h"
#undef strcspn
#define char char16_t
#define HasCharacter HasCharacter16
#define strcspn strcspn16
#include "libc/str/strcspn.c"
/**
* Returns prefix length, consisting of chars not in reject.
* a.k.a. Return index of first byte that's in charset.
*
* @param reject is nul-terminated character set
* @see strspn(), strtok_r()
* @asyncsignalsafe
*/
size_t strcspn16(const char16_t *s, const char16_t *reject) {
size_t i;
for (i = 0; s[i]; ++i) {
if (HasCharacter16(s[i], reject)) {
break;
}
}
return i;
}