mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-02-14 18:27:54 +00:00
- Remove most __ASSEMBLER__ __LINKER__ ifdefs - Rename libc/intrin/bits.h to libc/serialize.h - Block pthread cancelation in fchmodat() polyfill - Remove `clang-format off` statements in third_party
26 lines
581 B
C
26 lines
581 B
C
#ifndef IO_H
|
|
#define IO_H
|
|
#include "third_party/python/Modules/_decimal/libmpdec/mpdecimal.h"
|
|
|
|
#if SIZE_MAX == MPD_SIZE_MAX
|
|
#define mpd_strtossize _mpd_strtossize
|
|
#else
|
|
static inline mpd_ssize_t
|
|
mpd_strtossize(const char *s, char **end, int base)
|
|
{
|
|
int64_t retval;
|
|
|
|
errno = 0;
|
|
retval = _mpd_strtossize(s, end, base);
|
|
if (errno == 0 && (retval > MPD_SSIZE_MAX || retval < MPD_SSIZE_MIN)) {
|
|
errno = ERANGE;
|
|
}
|
|
if (errno == ERANGE) {
|
|
return (retval < 0) ? MPD_SSIZE_MIN : MPD_SSIZE_MAX;
|
|
}
|
|
|
|
return (mpd_ssize_t)retval;
|
|
}
|
|
#endif
|
|
|
|
#endif
|