diff options
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_datetimemodule.c | 24 | ||||
-rw-r--r-- | Modules/_lsprof.c | 30 | ||||
-rw-r--r-- | Modules/_lzmamodule.c | 16 | ||||
-rw-r--r-- | Modules/_struct.c | 52 | ||||
-rw-r--r-- | Modules/_testcapimodule.c | 38 | ||||
-rw-r--r-- | Modules/addrinfo.h | 4 | ||||
-rw-r--r-- | Modules/arraymodule.c | 26 | ||||
-rw-r--r-- | Modules/md5module.c | 2 | ||||
-rw-r--r-- | Modules/mmapmodule.c | 12 | ||||
-rw-r--r-- | Modules/posixmodule.c | 22 | ||||
-rw-r--r-- | Modules/resource.c | 6 | ||||
-rw-r--r-- | Modules/sha1module.c | 2 | ||||
-rw-r--r-- | Modules/sha512module.c | 12 |
13 files changed, 118 insertions, 128 deletions
diff --git a/Modules/_datetimemodule.c b/Modules/_datetimemodule.c index b48dc2d..6597cb7 100644 --- a/Modules/_datetimemodule.c +++ b/Modules/_datetimemodule.c @@ -4198,20 +4198,20 @@ typedef struct tm *(*TM_FUNC)(const time_t *timer); /* As of version 2015f max fold in IANA database is * 23 hours at 1969-09-30 13:00:00 in Kwajalein. */ -static PY_LONG_LONG max_fold_seconds = 24 * 3600; +static long long max_fold_seconds = 24 * 3600; /* NB: date(1970,1,1).toordinal() == 719163 */ -static PY_LONG_LONG epoch = Py_LL(719163) * 24 * 60 * 60; +static long long epoch = Py_LL(719163) * 24 * 60 * 60; -static PY_LONG_LONG +static long long utc_to_seconds(int year, int month, int day, int hour, int minute, int second) { - PY_LONG_LONG ordinal = ymd_to_ord(year, month, day); + long long ordinal = ymd_to_ord(year, month, day); return ((ordinal * 24 + hour) * 60 + minute) * 60 + second; } -static PY_LONG_LONG -local(PY_LONG_LONG u) +static long long +local(long long u) { struct tm local_time; time_t t; @@ -4269,7 +4269,7 @@ datetime_from_timet_and_us(PyObject *cls, TM_FUNC f, time_t timet, int us, second = Py_MIN(59, tm->tm_sec); if (tzinfo == Py_None && f == localtime) { - PY_LONG_LONG probe_seconds, result_seconds, transition; + long long probe_seconds, result_seconds, transition; result_seconds = utc_to_seconds(year, month, day, hour, minute, second); @@ -5115,14 +5115,14 @@ local_timezone(PyDateTime_DateTime *utc_time) return local_timezone_from_timestamp(timestamp); } -static PY_LONG_LONG +static long long local_to_seconds(int year, int month, int day, int hour, int minute, int second, int fold); static PyObject * local_timezone_from_local(PyDateTime_DateTime *local_dt) { - PY_LONG_LONG seconds; + long long seconds; time_t timestamp; seconds = local_to_seconds(GET_YEAR(local_dt), GET_MONTH(local_dt), @@ -5256,11 +5256,11 @@ datetime_timetuple(PyDateTime_DateTime *self) dstflag); } -static PY_LONG_LONG +static long long local_to_seconds(int year, int month, int day, int hour, int minute, int second, int fold) { - PY_LONG_LONG t, a, b, u1, u2, t1, t2, lt; + long long t, a, b, u1, u2, t1, t2, lt; t = utc_to_seconds(year, month, day, hour, minute, second); /* Our goal is to solve t = local(u) for u. */ lt = local(t); @@ -5320,7 +5320,7 @@ datetime_timestamp(PyDateTime_DateTime *self) Py_DECREF(delta); } else { - PY_LONG_LONG seconds; + long long seconds; seconds = local_to_seconds(GET_YEAR(self), GET_MONTH(self), GET_DAY(self), diff --git a/Modules/_lsprof.c b/Modules/_lsprof.c index 788d906..dc3f8ab 100644 --- a/Modules/_lsprof.c +++ b/Modules/_lsprof.c @@ -8,7 +8,7 @@ #include <windows.h> -static PY_LONG_LONG +static long long hpTimer(void) { LARGE_INTEGER li; @@ -35,11 +35,11 @@ hpTimerUnit(void) #include <sys/resource.h> #include <sys/times.h> -static PY_LONG_LONG +static long long hpTimer(void) { struct timeval tv; - PY_LONG_LONG ret; + long long ret; #ifdef GETTIMEOFDAY_NO_TZ gettimeofday(&tv); #else @@ -66,8 +66,8 @@ struct _ProfilerEntry; /* represents a function called from another function */ typedef struct _ProfilerSubEntry { rotating_node_t header; - PY_LONG_LONG tt; - PY_LONG_LONG it; + long long tt; + long long it; long callcount; long recursivecallcount; long recursionLevel; @@ -77,8 +77,8 @@ typedef struct _ProfilerSubEntry { typedef struct _ProfilerEntry { rotating_node_t header; PyObject *userObj; /* PyCodeObject, or a descriptive str for builtins */ - PY_LONG_LONG tt; /* total time in this entry */ - PY_LONG_LONG it; /* inline time in this entry (not in subcalls) */ + long long tt; /* total time in this entry */ + long long it; /* inline time in this entry (not in subcalls) */ long callcount; /* how many times this was called */ long recursivecallcount; /* how many times called recursively */ long recursionLevel; @@ -86,8 +86,8 @@ typedef struct _ProfilerEntry { } ProfilerEntry; typedef struct _ProfilerContext { - PY_LONG_LONG t0; - PY_LONG_LONG subt; + long long t0; + long long subt; struct _ProfilerContext *previous; ProfilerEntry *ctxEntry; } ProfilerContext; @@ -117,9 +117,9 @@ static PyTypeObject PyProfiler_Type; #define DOUBLE_TIMER_PRECISION 4294967296.0 static PyObject *empty_tuple; -static PY_LONG_LONG CallExternalTimer(ProfilerObject *pObj) +static long long CallExternalTimer(ProfilerObject *pObj) { - PY_LONG_LONG result; + long long result; PyObject *o = PyObject_Call(pObj->externalTimer, empty_tuple, NULL); if (o == NULL) { PyErr_WriteUnraisable(pObj->externalTimer); @@ -132,11 +132,11 @@ static PY_LONG_LONG CallExternalTimer(ProfilerObject *pObj) } else { /* interpret the result as a double measured in seconds. - As the profiler works with PY_LONG_LONG internally + As the profiler works with long long internally we convert it to a large integer */ double val = PyFloat_AsDouble(o); /* error handling delayed to the code below */ - result = (PY_LONG_LONG) (val * DOUBLE_TIMER_PRECISION); + result = (long long) (val * DOUBLE_TIMER_PRECISION); } Py_DECREF(o); if (PyErr_Occurred()) { @@ -338,8 +338,8 @@ initContext(ProfilerObject *pObj, ProfilerContext *self, ProfilerEntry *entry) static void Stop(ProfilerObject *pObj, ProfilerContext *self, ProfilerEntry *entry) { - PY_LONG_LONG tt = CALL_TIMER(pObj) - self->t0; - PY_LONG_LONG it = tt - self->subt; + long long tt = CALL_TIMER(pObj) - self->t0; + long long it = tt - self->subt; if (self->previous) self->previous->subt += tt; pObj->currentProfilerContext = self->previous; diff --git a/Modules/_lzmamodule.c b/Modules/_lzmamodule.c index ce4e17f..5e158fd 100644 --- a/Modules/_lzmamodule.c +++ b/Modules/_lzmamodule.c @@ -18,12 +18,6 @@ #include <lzma.h> - -#ifndef PY_LONG_LONG -#error "This module requires PY_LONG_LONG to be defined" -#endif - - #ifdef WITH_THREAD #define ACQUIRE_LOCK(obj) do { \ if (!PyThread_acquire_lock((obj)->lock, 0)) { \ @@ -163,7 +157,7 @@ grow_buffer(PyObject **buf, Py_ssize_t max_length) uint32_t - the "I" (unsigned int) specifier is the right size, but silently ignores overflows on conversion. - lzma_vli - the "K" (unsigned PY_LONG_LONG) specifier is the right + lzma_vli - the "K" (unsigned long long) specifier is the right size, but like "I" it silently ignores overflows on conversion. lzma_mode and lzma_match_finder - these are enumeration types, and @@ -176,12 +170,12 @@ grow_buffer(PyObject **buf, Py_ssize_t max_length) static int \ FUNCNAME(PyObject *obj, void *ptr) \ { \ - unsigned PY_LONG_LONG val; \ + unsigned long long val; \ \ val = PyLong_AsUnsignedLongLong(obj); \ if (PyErr_Occurred()) \ return 0; \ - if ((unsigned PY_LONG_LONG)(TYPE)val != val) { \ + if ((unsigned long long)(TYPE)val != val) { \ PyErr_SetString(PyExc_OverflowError, \ "Value too large for " #TYPE " type"); \ return 0; \ @@ -398,7 +392,7 @@ parse_filter_chain_spec(lzma_filter filters[], PyObject *filterspecs) Python-level filter specifiers (represented as dicts). */ static int -spec_add_field(PyObject *spec, _Py_Identifier *key, unsigned PY_LONG_LONG value) +spec_add_field(PyObject *spec, _Py_Identifier *key, unsigned long long value) { int status; PyObject *value_object; @@ -1441,7 +1435,7 @@ static PyModuleDef _lzmamodule = { /* Some of our constants are more than 32 bits wide, so PyModule_AddIntConstant would not work correctly on platforms with 32-bit longs. */ static int -module_add_int_constant(PyObject *m, const char *name, PY_LONG_LONG value) +module_add_int_constant(PyObject *m, const char *name, long long value) { PyObject *o = PyLong_FromLongLong(value); if (o == NULL) diff --git a/Modules/_struct.c b/Modules/_struct.c index ba60ba6..a601f03 100644 --- a/Modules/_struct.c +++ b/Modules/_struct.c @@ -71,8 +71,8 @@ typedef struct { char c; size_t x; } st_size_t; /* We can't support q and Q in native mode unless the compiler does; in std mode, they're 8 bytes on all platforms. */ -typedef struct { char c; PY_LONG_LONG x; } s_long_long; -#define LONG_LONG_ALIGN (sizeof(s_long_long) - sizeof(PY_LONG_LONG)) +typedef struct { char c; long long x; } s_long_long; +#define LONG_LONG_ALIGN (sizeof(s_long_long) - sizeof(long long)) #ifdef HAVE_C99_BOOL #define BOOL_TYPE _Bool @@ -165,9 +165,9 @@ get_ulong(PyObject *v, unsigned long *p) /* Same, but handling native long long. */ static int -get_longlong(PyObject *v, PY_LONG_LONG *p) +get_longlong(PyObject *v, long long *p) { - PY_LONG_LONG x; + long long x; v = get_pylong(v); if (v == NULL) @@ -175,7 +175,7 @@ get_longlong(PyObject *v, PY_LONG_LONG *p) assert(PyLong_Check(v)); x = PyLong_AsLongLong(v); Py_DECREF(v); - if (x == (PY_LONG_LONG)-1 && PyErr_Occurred()) { + if (x == (long long)-1 && PyErr_Occurred()) { if (PyErr_ExceptionMatches(PyExc_OverflowError)) PyErr_SetString(StructError, "argument out of range"); @@ -188,9 +188,9 @@ get_longlong(PyObject *v, PY_LONG_LONG *p) /* Same, but handling native unsigned long long. */ static int -get_ulonglong(PyObject *v, unsigned PY_LONG_LONG *p) +get_ulonglong(PyObject *v, unsigned long long *p) { - unsigned PY_LONG_LONG x; + unsigned long long x; v = get_pylong(v); if (v == NULL) @@ -198,7 +198,7 @@ get_ulonglong(PyObject *v, unsigned PY_LONG_LONG *p) assert(PyLong_Check(v)); x = PyLong_AsUnsignedLongLong(v); Py_DECREF(v); - if (x == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred()) { + if (x == (unsigned long long)-1 && PyErr_Occurred()) { if (PyErr_ExceptionMatches(PyExc_OverflowError)) PyErr_SetString(StructError, "argument out of range"); @@ -460,20 +460,20 @@ nu_size_t(const char *p, const formatdef *f) static PyObject * nu_longlong(const char *p, const formatdef *f) { - PY_LONG_LONG x; + long long x; memcpy((char *)&x, p, sizeof x); if (x >= LONG_MIN && x <= LONG_MAX) - return PyLong_FromLong(Py_SAFE_DOWNCAST(x, PY_LONG_LONG, long)); + return PyLong_FromLong(Py_SAFE_DOWNCAST(x, long long, long)); return PyLong_FromLongLong(x); } static PyObject * nu_ulonglong(const char *p, const formatdef *f) { - unsigned PY_LONG_LONG x; + unsigned long long x; memcpy((char *)&x, p, sizeof x); if (x <= LONG_MAX) - return PyLong_FromLong(Py_SAFE_DOWNCAST(x, unsigned PY_LONG_LONG, long)); + return PyLong_FromLong(Py_SAFE_DOWNCAST(x, unsigned long long, long)); return PyLong_FromUnsignedLongLong(x); } @@ -673,7 +673,7 @@ np_size_t(char *p, PyObject *v, const formatdef *f) static int np_longlong(char *p, PyObject *v, const formatdef *f) { - PY_LONG_LONG x; + long long x; if (get_longlong(v, &x) < 0) return -1; memcpy(p, (char *)&x, sizeof x); @@ -683,7 +683,7 @@ np_longlong(char *p, PyObject *v, const formatdef *f) static int np_ulonglong(char *p, PyObject *v, const formatdef *f) { - unsigned PY_LONG_LONG x; + unsigned long long x; if (get_ulonglong(v, &x) < 0) return -1; memcpy(p, (char *)&x, sizeof x); @@ -772,8 +772,8 @@ static const formatdef native_table[] = { {'L', sizeof(long), LONG_ALIGN, nu_ulong, np_ulong}, {'n', sizeof(size_t), SIZE_T_ALIGN, nu_ssize_t, np_ssize_t}, {'N', sizeof(size_t), SIZE_T_ALIGN, nu_size_t, np_size_t}, - {'q', sizeof(PY_LONG_LONG), LONG_LONG_ALIGN, nu_longlong, np_longlong}, - {'Q', sizeof(PY_LONG_LONG), LONG_LONG_ALIGN, nu_ulonglong,np_ulonglong}, + {'q', sizeof(long long), LONG_LONG_ALIGN, nu_longlong, np_longlong}, + {'Q', sizeof(long long), LONG_LONG_ALIGN, nu_ulonglong,np_ulonglong}, {'?', sizeof(BOOL_TYPE), BOOL_ALIGN, nu_bool, np_bool}, {'e', sizeof(short), SHORT_ALIGN, nu_halffloat, np_halffloat}, {'f', sizeof(float), FLOAT_ALIGN, nu_float, np_float}, @@ -816,7 +816,7 @@ bu_uint(const char *p, const formatdef *f) static PyObject * bu_longlong(const char *p, const formatdef *f) { - PY_LONG_LONG x = 0; + long long x = 0; Py_ssize_t i = f->size; const unsigned char *bytes = (const unsigned char *)p; do { @@ -824,23 +824,23 @@ bu_longlong(const char *p, const formatdef *f) } while (--i > 0); /* Extend the sign bit. */ if (SIZEOF_LONG_LONG > f->size) - x |= -(x & ((PY_LONG_LONG)1 << ((8 * f->size) - 1))); + x |= -(x & ((long long)1 << ((8 * f->size) - 1))); if (x >= LONG_MIN && x <= LONG_MAX) - return PyLong_FromLong(Py_SAFE_DOWNCAST(x, PY_LONG_LONG, long)); + return PyLong_FromLong(Py_SAFE_DOWNCAST(x, long long, long)); return PyLong_FromLongLong(x); } static PyObject * bu_ulonglong(const char *p, const formatdef *f) { - unsigned PY_LONG_LONG x = 0; + unsigned long long x = 0; Py_ssize_t i = f->size; const unsigned char *bytes = (const unsigned char *)p; do { x = (x<<8) | *bytes++; } while (--i > 0); if (x <= LONG_MAX) - return PyLong_FromLong(Py_SAFE_DOWNCAST(x, unsigned PY_LONG_LONG, long)); + return PyLong_FromLong(Py_SAFE_DOWNCAST(x, unsigned long long, long)); return PyLong_FromUnsignedLongLong(x); } @@ -1043,7 +1043,7 @@ lu_uint(const char *p, const formatdef *f) static PyObject * lu_longlong(const char *p, const formatdef *f) { - PY_LONG_LONG x = 0; + long long x = 0; Py_ssize_t i = f->size; const unsigned char *bytes = (const unsigned char *)p; do { @@ -1051,23 +1051,23 @@ lu_longlong(const char *p, const formatdef *f) } while (i > 0); /* Extend the sign bit. */ if (SIZEOF_LONG_LONG > f->size) - x |= -(x & ((PY_LONG_LONG)1 << ((8 * f->size) - 1))); + x |= -(x & ((long long)1 << ((8 * f->size) - 1))); if (x >= LONG_MIN && x <= LONG_MAX) - return PyLong_FromLong(Py_SAFE_DOWNCAST(x, PY_LONG_LONG, long)); + return PyLong_FromLong(Py_SAFE_DOWNCAST(x, long long, long)); return PyLong_FromLongLong(x); } static PyObject * lu_ulonglong(const char *p, const formatdef *f) { - unsigned PY_LONG_LONG x = 0; + unsigned long long x = 0; Py_ssize_t i = f->size; const unsigned char *bytes = (const unsigned char *)p; do { x = (x<<8) | bytes[--i]; } while (i > 0); if (x <= LONG_MAX) - return PyLong_FromLong(Py_SAFE_DOWNCAST(x, unsigned PY_LONG_LONG, long)); + return PyLong_FromLong(Py_SAFE_DOWNCAST(x, unsigned long long, long)); return PyLong_FromUnsignedLongLong(x); } diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c index 2fb5a14..e9a0f12 100644 --- a/Modules/_testcapimodule.c +++ b/Modules/_testcapimodule.c @@ -60,7 +60,7 @@ test_config(PyObject *self) CHECK_SIZEOF(SIZEOF_LONG, long); CHECK_SIZEOF(SIZEOF_VOID_P, void*); CHECK_SIZEOF(SIZEOF_TIME_T, time_t); - CHECK_SIZEOF(SIZEOF_LONG_LONG, PY_LONG_LONG); + CHECK_SIZEOF(SIZEOF_LONG_LONG, long long); #undef CHECK_SIZEOF @@ -360,7 +360,7 @@ test_lazy_hash_inheritance(PyObject* self) Note that the meat of the test is contained in testcapi_long.h. This is revolting, but delicate code duplication is worse: "almost - exactly the same" code is needed to test PY_LONG_LONG, but the ubiquitous + exactly the same" code is needed to test long long, but the ubiquitous dependence on type names makes it impossible to use a parameterized function. A giant macro would be even worse than this. A C++ template would be perfect. @@ -407,7 +407,7 @@ raise_test_longlong_error(const char* msg) } #define TESTNAME test_longlong_api_inner -#define TYPENAME PY_LONG_LONG +#define TYPENAME long long #define F_S_TO_PY PyLong_FromLongLong #define F_PY_TO_S PyLong_AsLongLong #define F_U_TO_PY PyLong_FromUnsignedLongLong @@ -594,7 +594,7 @@ test_long_and_overflow(PyObject *self) } /* Test the PyLong_AsLongLongAndOverflow API. General conversion to - PY_LONG_LONG is tested by test_long_api_inner. This test will + long long is tested by test_long_api_inner. This test will concentrate on proper handling of overflow. */ @@ -602,7 +602,7 @@ static PyObject * test_long_long_and_overflow(PyObject *self) { PyObject *num, *one, *temp; - PY_LONG_LONG value; + long long value; int overflow; /* Test that overflow is set properly for a large value. */ @@ -820,7 +820,7 @@ test_long_as_double(PyObject *self) return Py_None; } -/* Test the L code for PyArg_ParseTuple. This should deliver a PY_LONG_LONG +/* Test the L code for PyArg_ParseTuple. This should deliver a long long for both long and int arguments. The test may leak a little memory if it fails. */ @@ -828,7 +828,7 @@ static PyObject * test_L_code(PyObject *self) { PyObject *tuple, *num; - PY_LONG_LONG value; + long long value; tuple = PyTuple_New(1); if (tuple == NULL) @@ -1133,7 +1133,7 @@ getargs_p(PyObject *self, PyObject *args) static PyObject * getargs_L(PyObject *self, PyObject *args) { - PY_LONG_LONG value; + long long value; if (!PyArg_ParseTuple(args, "L", &value)) return NULL; return PyLong_FromLongLong(value); @@ -1142,7 +1142,7 @@ getargs_L(PyObject *self, PyObject *args) static PyObject * getargs_K(PyObject *self, PyObject *args) { - unsigned PY_LONG_LONG value; + unsigned long long value; if (!PyArg_ParseTuple(args, "K", &value)) return NULL; return PyLong_FromUnsignedLongLong(value); @@ -2271,8 +2271,8 @@ test_string_from_format(PyObject *self, PyObject *args) CHECK_1_FORMAT("%zu", size_t); /* "%lld" and "%llu" support added in Python 2.7. */ - CHECK_1_FORMAT("%llu", unsigned PY_LONG_LONG); - CHECK_1_FORMAT("%lld", PY_LONG_LONG); + CHECK_1_FORMAT("%llu", unsigned long long); + CHECK_1_FORMAT("%lld", long long); Py_RETURN_NONE; @@ -3696,7 +3696,7 @@ test_pytime_fromsecondsobject(PyObject *self, PyObject *args) static PyObject * test_pytime_assecondsdouble(PyObject *self, PyObject *args) { - PY_LONG_LONG ns; + long long ns; _PyTime_t ts; double d; @@ -3710,7 +3710,7 @@ test_pytime_assecondsdouble(PyObject *self, PyObject *args) static PyObject * test_PyTime_AsTimeval(PyObject *self, PyObject *args) { - PY_LONG_LONG ns; + long long ns; int round; _PyTime_t t; struct timeval tv; @@ -3724,7 +3724,7 @@ test_PyTime_AsTimeval(PyObject *self, PyObject *args) if (_PyTime_AsTimeval(t, &tv, round) < 0) return NULL; - seconds = PyLong_FromLong((PY_LONG_LONG)tv.tv_sec); + seconds = PyLong_FromLong((long long)tv.tv_sec); if (seconds == NULL) return NULL; return Py_BuildValue("Nl", seconds, tv.tv_usec); @@ -3734,7 +3734,7 @@ test_PyTime_AsTimeval(PyObject *self, PyObject *args) static PyObject * test_PyTime_AsTimespec(PyObject *self, PyObject *args) { - PY_LONG_LONG ns; + long long ns; _PyTime_t t; struct timespec ts; @@ -3750,7 +3750,7 @@ test_PyTime_AsTimespec(PyObject *self, PyObject *args) static PyObject * test_PyTime_AsMilliseconds(PyObject *self, PyObject *args) { - PY_LONG_LONG ns; + long long ns; int round; _PyTime_t t, ms; @@ -3768,7 +3768,7 @@ test_PyTime_AsMilliseconds(PyObject *self, PyObject *args) static PyObject * test_PyTime_AsMicroseconds(PyObject *self, PyObject *args) { - PY_LONG_LONG ns; + long long ns; int round; _PyTime_t t, ms; @@ -4141,8 +4141,8 @@ typedef struct { float float_member; double double_member; char inplace_member[6]; - PY_LONG_LONG longlong_member; - unsigned PY_LONG_LONG ulonglong_member; + long long longlong_member; + unsigned long long ulonglong_member; } all_structmembers; typedef struct { diff --git a/Modules/addrinfo.h b/Modules/addrinfo.h index 20f7650..c3c8624 100644 --- a/Modules/addrinfo.h +++ b/Modules/addrinfo.h @@ -141,7 +141,7 @@ struct addrinfo { * RFC 2553: protocol-independent placeholder for socket addresses */ #define _SS_MAXSIZE 128 -#define _SS_ALIGNSIZE (sizeof(PY_LONG_LONG)) +#define _SS_ALIGNSIZE (sizeof(long long)) #define _SS_PAD1SIZE (_SS_ALIGNSIZE - sizeof(u_char) * 2) #define _SS_PAD2SIZE (_SS_MAXSIZE - sizeof(u_char) * 2 - \ _SS_PAD1SIZE - _SS_ALIGNSIZE) @@ -154,7 +154,7 @@ struct sockaddr_storage { unsigned short ss_family; /* address family */ #endif /* HAVE_SOCKADDR_SA_LEN */ char __ss_pad1[_SS_PAD1SIZE]; - PY_LONG_LONG __ss_align; /* force desired structure storage alignment */ + long long __ss_align; /* force desired structure storage alignment */ char __ss_pad2[_SS_PAD2SIZE]; }; #endif /* !HAVE_SOCKADDR_STORAGE */ diff --git a/Modules/arraymodule.c b/Modules/arraymodule.c index 8637cb5..86a58d9 100644 --- a/Modules/arraymodule.c +++ b/Modules/arraymodule.c @@ -421,17 +421,17 @@ LL_setitem(arrayobject *ap, Py_ssize_t i, PyObject *v) static PyObject * q_getitem(arrayobject *ap, Py_ssize_t i) { - return PyLong_FromLongLong(((PY_LONG_LONG *)ap->ob_item)[i]); + return PyLong_FromLongLong(((long long *)ap->ob_item)[i]); } static int q_setitem(arrayobject *ap, Py_ssize_t i, PyObject *v) { - PY_LONG_LONG x; + long long x; if (!PyArg_Parse(v, "L;array item must be integer", &x)) return -1; if (i >= 0) - ((PY_LONG_LONG *)ap->ob_item)[i] = x; + ((long long *)ap->ob_item)[i] = x; return 0; } @@ -439,20 +439,20 @@ static PyObject * QQ_getitem(arrayobject *ap, Py_ssize_t i) { return PyLong_FromUnsignedLongLong( - ((unsigned PY_LONG_LONG *)ap->ob_item)[i]); + ((unsigned long long *)ap->ob_item)[i]); } static int QQ_setitem(arrayobject *ap, Py_ssize_t i, PyObject *v) { - unsigned PY_LONG_LONG x; + unsigned long long x; if (PyLong_Check(v)) { x = PyLong_AsUnsignedLongLong(v); - if (x == (unsigned PY_LONG_LONG) -1 && PyErr_Occurred()) + if (x == (unsigned long long) -1 && PyErr_Occurred()) return -1; } else { - PY_LONG_LONG y; + long long y; if (!PyArg_Parse(v, "L;array item must be integer", &y)) return -1; if (y < 0) { @@ -460,11 +460,11 @@ QQ_setitem(arrayobject *ap, Py_ssize_t i, PyObject *v) "unsigned long long is less than minimum"); return -1; } - x = (unsigned PY_LONG_LONG)y; + x = (unsigned long long)y; } if (i >= 0) - ((unsigned PY_LONG_LONG *)ap->ob_item)[i] = x; + ((unsigned long long *)ap->ob_item)[i] = x; return 0; } @@ -518,8 +518,8 @@ static const struct arraydescr descriptors[] = { {'I', sizeof(int), II_getitem, II_setitem, "I", 1, 0}, {'l', sizeof(long), l_getitem, l_setitem, "l", 1, 1}, {'L', sizeof(long), LL_getitem, LL_setitem, "L", 1, 0}, - {'q', sizeof(PY_LONG_LONG), q_getitem, q_setitem, "q", 1, 1}, - {'Q', sizeof(PY_LONG_LONG), QQ_getitem, QQ_setitem, "Q", 1, 0}, + {'q', sizeof(long long), q_getitem, q_setitem, "q", 1, 1}, + {'Q', sizeof(long long), QQ_getitem, QQ_setitem, "Q", 1, 0}, {'f', sizeof(float), f_getitem, f_setitem, "f", 0, 0}, {'d', sizeof(double), d_getitem, d_setitem, "d", 0, 0}, {'\0', 0, 0, 0, 0, 0, 0} /* Sentinel */ @@ -1810,11 +1810,11 @@ typecode_to_mformat_code(char typecode) is_signed = 0; break; case 'q': - intsize = sizeof(PY_LONG_LONG); + intsize = sizeof(long long); is_signed = 1; break; case 'Q': - intsize = sizeof(PY_LONG_LONG); + intsize = sizeof(long long); is_signed = 0; break; default: diff --git a/Modules/md5module.c b/Modules/md5module.c index f94acc7..04bc06e 100644 --- a/Modules/md5module.c +++ b/Modules/md5module.c @@ -30,7 +30,7 @@ class MD5Type "MD5object *" "&PyType_Type" #if SIZEOF_INT == 4 typedef unsigned int MD5_INT32; /* 32-bit integer */ -typedef PY_LONG_LONG MD5_INT64; /* 64-bit integer */ +typedef long long MD5_INT64; /* 64-bit integer */ #else /* not defined. compilation will die. */ #endif diff --git a/Modules/mmapmodule.c b/Modules/mmapmodule.c index 50cec24..b0015a5 100644 --- a/Modules/mmapmodule.c +++ b/Modules/mmapmodule.c @@ -93,7 +93,7 @@ typedef struct { size_t size; size_t pos; /* relative to offset */ #ifdef MS_WINDOWS - PY_LONG_LONG offset; + long long offset; #else off_t offset; #endif @@ -446,7 +446,7 @@ mmap_size_method(mmap_object *self, #ifdef MS_WINDOWS if (self->file_handle != INVALID_HANDLE_VALUE) { DWORD low,high; - PY_LONG_LONG size; + long long size; low = GetFileSize(self->file_handle, &high); if (low == INVALID_FILE_SIZE) { /* It might be that the function appears to have failed, @@ -457,7 +457,7 @@ mmap_size_method(mmap_object *self, } if (!high && low < LONG_MAX) return PyLong_FromLong((long)low); - size = (((PY_LONG_LONG)high)<<32) + low; + size = (((long long)high)<<32) + low; return PyLong_FromLongLong(size); } else { return PyLong_FromSsize_t(self->size); @@ -1258,7 +1258,7 @@ new_mmap_object(PyTypeObject *type, PyObject *args, PyObject *kwdict) /* A note on sizes and offsets: while the actual map size must hold in a Py_ssize_t, both the total file size and the start offset can be longer - than a Py_ssize_t, so we use PY_LONG_LONG which is always 64-bit. + than a Py_ssize_t, so we use long long which is always 64-bit. */ static PyObject * @@ -1267,7 +1267,7 @@ new_mmap_object(PyTypeObject *type, PyObject *args, PyObject *kwdict) mmap_object *m_obj; PyObject *map_size_obj = NULL; Py_ssize_t map_size; - PY_LONG_LONG offset = 0, size; + long long offset = 0, size; DWORD off_hi; /* upper 32 bits of offset */ DWORD off_lo; /* lower 32 bits of offset */ DWORD size_hi; /* upper 32 bits of size */ @@ -1379,7 +1379,7 @@ new_mmap_object(PyTypeObject *type, PyObject *args, PyObject *kwdict) return PyErr_SetFromWindowsErr(dwErr); } - size = (((PY_LONG_LONG) high) << 32) + low; + size = (((long long) high) << 32) + low; if (size == 0) { PyErr_SetString(PyExc_ValueError, "cannot mmap an empty file"); diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index 21d91b0..df295c2 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -1108,7 +1108,7 @@ dir_fd_and_follow_symlinks_invalid(const char *function_name, int dir_fd, } #ifdef MS_WINDOWS - typedef PY_LONG_LONG Py_off_t; + typedef long long Py_off_t; #else typedef off_t Py_off_t; #endif @@ -2073,7 +2073,7 @@ _pystat_fromstructstat(STRUCT_STAT *st) PyStructSequence_SET_ITEM(v, 0, PyLong_FromLong((long)st->st_mode)); #ifdef HAVE_LARGEFILE_SUPPORT PyStructSequence_SET_ITEM(v, 1, - PyLong_FromLongLong((PY_LONG_LONG)st->st_ino)); + PyLong_FromLongLong((long long)st->st_ino)); #else PyStructSequence_SET_ITEM(v, 1, PyLong_FromLong((long)st->st_ino)); #endif @@ -2092,7 +2092,7 @@ _pystat_fromstructstat(STRUCT_STAT *st) #endif #ifdef HAVE_LARGEFILE_SUPPORT PyStructSequence_SET_ITEM(v, 6, - PyLong_FromLongLong((PY_LONG_LONG)st->st_size)); + PyLong_FromLongLong((long long)st->st_size)); #else PyStructSequence_SET_ITEM(v, 6, PyLong_FromLong(st->st_size)); #endif @@ -9420,17 +9420,17 @@ _pystatvfs_fromstructstatvfs(struct statvfs st) { PyStructSequence_SET_ITEM(v, 0, PyLong_FromLong((long) st.f_bsize)); PyStructSequence_SET_ITEM(v, 1, PyLong_FromLong((long) st.f_frsize)); PyStructSequence_SET_ITEM(v, 2, - PyLong_FromLongLong((PY_LONG_LONG) st.f_blocks)); + PyLong_FromLongLong((long long) st.f_blocks)); PyStructSequence_SET_ITEM(v, 3, - PyLong_FromLongLong((PY_LONG_LONG) st.f_bfree)); + PyLong_FromLongLong((long long) st.f_bfree)); PyStructSequence_SET_ITEM(v, 4, - PyLong_FromLongLong((PY_LONG_LONG) st.f_bavail)); + PyLong_FromLongLong((long long) st.f_bavail)); PyStructSequence_SET_ITEM(v, 5, - PyLong_FromLongLong((PY_LONG_LONG) st.f_files)); + PyLong_FromLongLong((long long) st.f_files)); PyStructSequence_SET_ITEM(v, 6, - PyLong_FromLongLong((PY_LONG_LONG) st.f_ffree)); + PyLong_FromLongLong((long long) st.f_ffree)); PyStructSequence_SET_ITEM(v, 7, - PyLong_FromLongLong((PY_LONG_LONG) st.f_favail)); + PyLong_FromLongLong((long long) st.f_favail)); PyStructSequence_SET_ITEM(v, 8, PyLong_FromLong((long) st.f_flag)); PyStructSequence_SET_ITEM(v, 9, PyLong_FromLong((long) st.f_namemax)); #endif @@ -11763,10 +11763,10 @@ DirEntry_inode(DirEntry *self) self->win32_file_index = stat.st_ino; self->got_file_index = 1; } - return PyLong_FromLongLong((PY_LONG_LONG)self->win32_file_index); + return PyLong_FromLongLong((long long)self->win32_file_index); #else /* POSIX */ #ifdef HAVE_LARGEFILE_SUPPORT - return PyLong_FromLongLong((PY_LONG_LONG)self->d_ino); + return PyLong_FromLongLong((long long)self->d_ino); #else return PyLong_FromLong((long)self->d_ino); #endif diff --git a/Modules/resource.c b/Modules/resource.c index bbe8aef..6702b7a 100644 --- a/Modules/resource.c +++ b/Modules/resource.c @@ -137,8 +137,8 @@ rlimit2py(struct rlimit rl) { if (sizeof(rl.rlim_cur) > sizeof(long)) { return Py_BuildValue("LL", - (PY_LONG_LONG) rl.rlim_cur, - (PY_LONG_LONG) rl.rlim_max); + (long long) rl.rlim_cur, + (long long) rl.rlim_max); } return Py_BuildValue("ll", (long) rl.rlim_cur, (long) rl.rlim_max); } @@ -437,7 +437,7 @@ PyInit_resource(void) #endif if (sizeof(RLIM_INFINITY) > sizeof(long)) { - v = PyLong_FromLongLong((PY_LONG_LONG) RLIM_INFINITY); + v = PyLong_FromLongLong((long long) RLIM_INFINITY); } else { v = PyLong_FromLong((long) RLIM_INFINITY); diff --git a/Modules/sha1module.c b/Modules/sha1module.c index 6cb32ed..d5065ce 100644 --- a/Modules/sha1module.c +++ b/Modules/sha1module.c @@ -30,7 +30,7 @@ class SHA1Type "SHA1object *" "&PyType_Type" #if SIZEOF_INT == 4 typedef unsigned int SHA1_INT32; /* 32-bit integer */ -typedef PY_LONG_LONG SHA1_INT64; /* 64-bit integer */ +typedef long long SHA1_INT64; /* 64-bit integer */ #else /* not defined. compilation will die. */ #endif diff --git a/Modules/sha512module.c b/Modules/sha512module.c index f9ff0ea..f5f9e18 100644 --- a/Modules/sha512module.c +++ b/Modules/sha512module.c @@ -27,15 +27,13 @@ class SHA512Type "SHAobject *" "&PyType_Type" [clinic start generated code]*/ /*[clinic end generated code: output=da39a3ee5e6b4b0d input=81a3ccde92bcfe8d]*/ -#ifdef PY_LONG_LONG /* If no PY_LONG_LONG, don't compile anything! */ - /* Some useful types */ typedef unsigned char SHA_BYTE; #if SIZEOF_INT == 4 typedef unsigned int SHA_INT32; /* 32-bit integer */ -typedef unsigned PY_LONG_LONG SHA_INT64; /* 64-bit integer */ +typedef unsigned long long SHA_INT64; /* 64-bit integer */ #else /* not defined. compilation will die. */ #endif @@ -121,12 +119,12 @@ static void SHAcopy(SHAobject *src, SHAobject *dest) /* Various logical functions */ #define ROR64(x, y) \ - ( ((((x) & Py_ULL(0xFFFFFFFFFFFFFFFF))>>((unsigned PY_LONG_LONG)(y) & 63)) | \ - ((x)<<((unsigned PY_LONG_LONG)(64-((y) & 63))))) & Py_ULL(0xFFFFFFFFFFFFFFFF)) + ( ((((x) & Py_ULL(0xFFFFFFFFFFFFFFFF))>>((unsigned long long)(y) & 63)) | \ + ((x)<<((unsigned long long)(64-((y) & 63))))) & Py_ULL(0xFFFFFFFFFFFFFFFF)) #define Ch(x,y,z) (z ^ (x & (y ^ z))) #define Maj(x,y,z) (((x | y) & z) | (x & y)) #define S(x, n) ROR64((x),(n)) -#define R(x, n) (((x) & Py_ULL(0xFFFFFFFFFFFFFFFF)) >> ((unsigned PY_LONG_LONG)n)) +#define R(x, n) (((x) & Py_ULL(0xFFFFFFFFFFFFFFFF)) >> ((unsigned long long)n)) #define Sigma0(x) (S(x, 28) ^ S(x, 34) ^ S(x, 39)) #define Sigma1(x) (S(x, 14) ^ S(x, 18) ^ S(x, 41)) #define Gamma0(x) (S(x, 1) ^ S(x, 8) ^ R(x, 7)) @@ -803,5 +801,3 @@ PyInit__sha512(void) PyModule_AddObject(m, "SHA512Type", (PyObject *)&SHA512type); return m; } - -#endif |