mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-27 04:50:28 +00:00
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:
parent
9b7c8db846
commit
d5910e2673
115 changed files with 510 additions and 290 deletions
|
@ -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);
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue