mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-02-12 17:27:56 +00:00
Building o//third_party/python now takes 5 seconds on my PC This change works towards modifying Python to use runtime dispatching when appropriate. For example, when loading the magnums in the socket module, it's a good idea to check if the magnum is zero, because that means the local system platform doesn't support it.
27 lines
559 B
C
27 lines
559 B
C
#ifndef IO_H
|
|
#define IO_H
|
|
#include "mpdecimal.h"
|
|
/* clang-format off */
|
|
|
|
#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
|