Fix bugs and make code tinier

- Fixed bug where stdio eof wasn't being sticky
- Fixed bug where fseeko() wasn't clearing eof state
- Removed assert() usage from libc favoring _unassert() / _npassert()
This commit is contained in:
Justine Tunney 2022-10-09 22:38:28 -07:00
parent 9b7c8db846
commit d5910e2673
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
115 changed files with 510 additions and 290 deletions

View file

@ -38,7 +38,7 @@ static int rmrfdir(const char *dirpath) {
while ((e = readdir(d))) {
if (!strcmp(e->d_name, ".")) continue;
if (!strcmp(e->d_name, "..")) continue;
assert(!strchr(e->d_name, '/'));
_npassert(!strchr(e->d_name, '/'));
path = xjoinpaths(dirpath, e->d_name);
if (e->d_type == DT_DIR) {
rc = rmrfdir(path);

View file

@ -47,7 +47,7 @@ void *xloadzd(bool *o, void **t, const void *p, size_t n, size_t m, size_t c,
z_stream zs;
char *q, *b;
int64_t x, y;
assert(z == 2 || z == 4);
_unassert(z == 2 || z == 4);
b = q = malloc(m);
__inflate(q, m, p, n);
r = memalign(z, c * z);
@ -61,7 +61,7 @@ void *xloadzd(bool *o, void **t, const void *p, size_t n, size_t m, size_t c,
}
}
free(q);
assert(crc32_z(0, r, c * z) == s);
_npassert(crc32_z(0, r, c * z) == s);
if (_lockcmpxchg(t, 0, r)) {
__cxa_atexit(free, r, 0);
} else {