summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorAlexander Belopolsky <alexander.belopolsky@gmail.com>2010-08-11 17:31:17 (GMT)
committerAlexander Belopolsky <alexander.belopolsky@gmail.com>2010-08-11 17:31:17 (GMT)
commitf0f45142d52436d26ce8ed888c73496949caae90 (patch)
tree53a4f3c197b87cb8afa33b87de48b06d5859513d /Objects
parent3a879e8a277e61195f5379862ef47f3ca9c69f4b (diff)
downloadcpython-f0f45142d52436d26ce8ed888c73496949caae90.zip
cpython-f0f45142d52436d26ce8ed888c73496949caae90.tar.gz
cpython-f0f45142d52436d26ce8ed888c73496949caae90.tar.bz2
Issue #2443: Added a new macro, Py_VA_COPY, which is equivalent to C99
va_copy, but available on all python platforms. Untabified a few unrelated files.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/abstract.c10
-rw-r--r--Objects/bytearrayobject.c14
-rw-r--r--Objects/bytesobject.c10
-rw-r--r--Objects/capsule.c36
-rw-r--r--Objects/memoryobject.c8
-rw-r--r--Objects/unicodectype.c16
-rw-r--r--Objects/unicodeobject.c10
7 files changed, 40 insertions, 64 deletions
diff --git a/Objects/abstract.c b/Objects/abstract.c
index fa2611a..d5a5d3c 100644
--- a/Objects/abstract.c
+++ b/Objects/abstract.c
@@ -2311,15 +2311,7 @@ objargs_mktuple(va_list va)
va_list countva;
PyObject *result, *tmp;
-#ifdef VA_LIST_IS_ARRAY
- memcpy(countva, va, sizeof(va_list));
-#else
-#ifdef __va_copy
- __va_copy(countva, va);
-#else
- countva = va;
-#endif
-#endif
+ Py_VA_COPY(countva, va);
while (((PyObject *)va_arg(countva, PyObject *)) != NULL)
++n;
diff --git a/Objects/bytearrayobject.c b/Objects/bytearrayobject.c
index cdc860f..be19a82 100644
--- a/Objects/bytearrayobject.c
+++ b/Objects/bytearrayobject.c
@@ -936,12 +936,12 @@ bytearray_repr(PyByteArrayObject *self)
static PyObject *
bytearray_str(PyObject *op)
{
- if (Py_BytesWarningFlag) {
- if (PyErr_WarnEx(PyExc_BytesWarning,
- "str() on a bytearray instance", 1))
- return NULL;
- }
- return bytearray_repr((PyByteArrayObject*)op);
+ if (Py_BytesWarningFlag) {
+ if (PyErr_WarnEx(PyExc_BytesWarning,
+ "str() on a bytearray instance", 1))
+ return NULL;
+ }
+ return bytearray_repr((PyByteArrayObject*)op);
}
static PyObject *
@@ -1458,7 +1458,7 @@ done:
static PyObject *
bytearray_maketrans(PyObject *null, PyObject *args)
{
- return _Py_bytes_maketrans(args);
+ return _Py_bytes_maketrans(args);
}
diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c
index c0c82f7..41c86d9 100644
--- a/Objects/bytesobject.c
+++ b/Objects/bytesobject.c
@@ -173,15 +173,7 @@ PyBytes_FromFormatV(const char *format, va_list vargs)
char *s;
PyObject* string;
-#ifdef VA_LIST_IS_ARRAY
- Py_MEMCPY(count, vargs, sizeof(va_list));
-#else
-#ifdef __va_copy
- __va_copy(count, vargs);
-#else
- count = vargs;
-#endif
-#endif
+ Py_VA_COPY(count, vargs);
/* step 1: figure out how large a buffer we need */
for (f = format; *f; f++) {
if (*f == '%') {
diff --git a/Objects/capsule.c b/Objects/capsule.c
index e25af6c..acd3de6 100644
--- a/Objects/capsule.c
+++ b/Objects/capsule.c
@@ -298,27 +298,27 @@ Python import mechanism to link to one another.\n\
PyTypeObject PyCapsule_Type = {
PyVarObject_HEAD_INIT(&PyType_Type, 0)
- "PyCapsule", /*tp_name*/
- sizeof(PyCapsule), /*tp_basicsize*/
- 0, /*tp_itemsize*/
+ "PyCapsule", /*tp_name*/
+ sizeof(PyCapsule), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
/* methods */
capsule_dealloc, /*tp_dealloc*/
- 0, /*tp_print*/
- 0, /*tp_getattr*/
- 0, /*tp_setattr*/
- 0, /*tp_reserved*/
+ 0, /*tp_print*/
+ 0, /*tp_getattr*/
+ 0, /*tp_setattr*/
+ 0, /*tp_reserved*/
capsule_repr, /*tp_repr*/
- 0, /*tp_as_number*/
- 0, /*tp_as_sequence*/
- 0, /*tp_as_mapping*/
- 0, /*tp_hash*/
- 0, /*tp_call*/
- 0, /*tp_str*/
- 0, /*tp_getattro*/
- 0, /*tp_setattro*/
- 0, /*tp_as_buffer*/
- 0, /*tp_flags*/
- PyCapsule_Type__doc__ /*tp_doc*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
+ 0, /*tp_hash*/
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ 0, /*tp_getattro*/
+ 0, /*tp_setattro*/
+ 0, /*tp_as_buffer*/
+ 0, /*tp_flags*/
+ PyCapsule_Type__doc__ /*tp_doc*/
};
diff --git a/Objects/memoryobject.c b/Objects/memoryobject.c
index 5b3caf2..70ae6cc 100644
--- a/Objects/memoryobject.c
+++ b/Objects/memoryobject.c
@@ -775,10 +775,10 @@ static PyMappingMethods memory_as_mapping = {
};
static PySequenceMethods memory_as_sequence = {
- 0, /* sq_length */
- 0, /* sq_concat */
- 0, /* sq_repeat */
- (ssizeargfunc)memory_item, /* sq_item */
+ 0, /* sq_length */
+ 0, /* sq_concat */
+ 0, /* sq_repeat */
+ (ssizeargfunc)memory_item, /* sq_item */
};
/* Buffer methods */
diff --git a/Objects/unicodectype.c b/Objects/unicodectype.c
index 1849831..db4f513 100644
--- a/Objects/unicodectype.c
+++ b/Objects/unicodectype.c
@@ -63,10 +63,10 @@ Py_UNICODE _PyUnicode_ToTitlecase(register Py_UNICODE ch)
int delta = ctype->title;
if (ctype->flags & NODELTA_MASK)
- return delta;
+ return delta;
if (delta >= 32768)
- delta -= 65536;
+ delta -= 65536;
return ch + delta;
}
@@ -114,7 +114,7 @@ int _PyUnicode_ToDecimalDigit(Py_UNICODE ch)
int _PyUnicode_IsDecimalDigit(Py_UNICODE ch)
{
if (_PyUnicode_ToDecimalDigit(ch) < 0)
- return 0;
+ return 0;
return 1;
}
@@ -131,7 +131,7 @@ int _PyUnicode_ToDigit(Py_UNICODE ch)
int _PyUnicode_IsDigit(Py_UNICODE ch)
{
if (_PyUnicode_ToDigit(ch) < 0)
- return 0;
+ return 0;
return 1;
}
@@ -195,9 +195,9 @@ Py_UNICODE _PyUnicode_ToUppercase(Py_UNICODE ch)
const _PyUnicode_TypeRecord *ctype = gettyperecord(ch);
int delta = ctype->upper;
if (ctype->flags & NODELTA_MASK)
- return delta;
+ return delta;
if (delta >= 32768)
- delta -= 65536;
+ delta -= 65536;
return ch + delta;
}
@@ -209,9 +209,9 @@ Py_UNICODE _PyUnicode_ToLowercase(Py_UNICODE ch)
const _PyUnicode_TypeRecord *ctype = gettyperecord(ch);
int delta = ctype->lower;
if (ctype->flags & NODELTA_MASK)
- return delta;
+ return delta;
if (delta >= 32768)
- delta -= 65536;
+ delta -= 65536;
return ch + delta;
}
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index 478f9a9..849f33e 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -755,15 +755,7 @@ PyUnicode_FromFormatV(const char *format, va_list vargs)
char fmt[61]; /* should be enough for %0width.precisionlld */
const char *copy;
-#ifdef VA_LIST_IS_ARRAY
- Py_MEMCPY(count, vargs, sizeof(va_list));
-#else
-#ifdef __va_copy
- __va_copy(count, vargs);
-#else
- count = vargs;
-#endif
-#endif
+ Py_VA_COPY(count, vargs);
/* step 1: count the number of %S/%R/%A/%s format specifications
* (we call PyObject_Str()/PyObject_Repr()/PyObject_ASCII()/
* PyUnicode_DecodeUTF8() for these objects once during step 3 and put the