Add minor improvements and cleanup

This commit is contained in:
Justine Tunney 2020-10-27 03:39:46 -07:00
parent 9e3e985ae5
commit feed0d2b0e
163 changed files with 2286 additions and 2245 deletions

View file

@ -19,11 +19,14 @@
*/
#include "libc/str/str.h"
const char *indexdoublenulstring(const char *p, unsigned i) {
const char *IndexDoubleNulString(const char *s, unsigned i) {
size_t n;
while (i--) {
const char *p2 = rawmemchr(p, '\0');
if (p2 == p) return NULL;
p = p2 + 1;
if ((n = strlen(s))) {
s += n + 1;
} else {
return NULL;
}
}
return p;
return s;
}