Merged revisions 84391 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r84391 | antoine.pitrou | 2010-09-01 14:58:21 +0200 (mer., 01 sept. 2010) | 5 lines

  Issue #3101: Helper functions _add_one_to_C() and _add_one_to_F() become
  _Py_add_one_to_C() and _Py_add_one_to_F(), respectively.
........
This commit is contained in:
Antoine Pitrou 2010-09-01 13:02:50 +00:00
parent 66c981b48b
commit 1fcdba84be
4 changed files with 24 additions and 17 deletions

View File

@ -1383,6 +1383,13 @@ PyAPI_FUNC(int) _PyObject_RealIsInstance(PyObject *inst, PyObject *cls);
PyAPI_FUNC(int) _PyObject_RealIsSubclass(PyObject *derived, PyObject *cls); PyAPI_FUNC(int) _PyObject_RealIsSubclass(PyObject *derived, PyObject *cls);
/* For internal use by buffer API functions */
PyAPI_FUNC(void) _Py_add_one_to_index_F(int nd, Py_ssize_t *index,
const Py_ssize_t *shape);
PyAPI_FUNC(void) _Py_add_one_to_index_C(int nd, Py_ssize_t *index,
const Py_ssize_t *shape);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@ -260,6 +260,12 @@ Extension Modules
Build Build
----- -----
- Issue #3101: Helper functions _add_one_to_C() and _add_one_to_F() become
_Py_add_one_to_C() and _Py_add_one_to_F(), respectively.
- Issue #9700: define HAVE_BROKEN_POSIX_SEMAPHORES under AIX 6.x. Patch by
Sébastien Sablé.
- Issue #9280: Make sharedinstall depend on sharedmods. - Issue #9280: Make sharedinstall depend on sharedmods.
- Issue #9275: The OSX installer once again installs links to binaries in - Issue #9275: The OSX installer once again installs links to binaries in
@ -526,9 +532,6 @@ Tests
Build Build
----- -----
- Issue #9700: define HAVE_BROKEN_POSIX_SEMAPHORES under AIX 6.x. Patch by
Sébastien Sablé.
- Display installer warning that Windows 2000 won't be supported in future - Display installer warning that Windows 2000 won't be supported in future
releases. releases.

View File

@ -443,7 +443,7 @@ PyBuffer_GetPointer(Py_buffer *view, Py_ssize_t *indices)
void void
_add_one_to_index_F(int nd, Py_ssize_t *index, Py_ssize_t *shape) _Py_add_one_to_index_F(int nd, Py_ssize_t *index, const Py_ssize_t *shape)
{ {
int k; int k;
@ -459,7 +459,7 @@ _add_one_to_index_F(int nd, Py_ssize_t *index, Py_ssize_t *shape)
} }
void void
_add_one_to_index_C(int nd, Py_ssize_t *index, Py_ssize_t *shape) _Py_add_one_to_index_C(int nd, Py_ssize_t *index, const Py_ssize_t *shape)
{ {
int k; int k;
@ -483,7 +483,7 @@ int
PyBuffer_ToContiguous(void *buf, Py_buffer *view, Py_ssize_t len, char fort) PyBuffer_ToContiguous(void *buf, Py_buffer *view, Py_ssize_t len, char fort)
{ {
int k; int k;
void (*addone)(int, Py_ssize_t *, Py_ssize_t *); void (*addone)(int, Py_ssize_t *, const Py_ssize_t *);
Py_ssize_t *indices, elements; Py_ssize_t *indices, elements;
char *dest, *ptr; char *dest, *ptr;
@ -510,10 +510,10 @@ PyBuffer_ToContiguous(void *buf, Py_buffer *view, Py_ssize_t len, char fort)
} }
if (fort == 'F') { if (fort == 'F') {
addone = _add_one_to_index_F; addone = _Py_add_one_to_index_F;
} }
else { else {
addone = _add_one_to_index_C; addone = _Py_add_one_to_index_C;
} }
dest = buf; dest = buf;
/* XXX : This is not going to be the fastest code in the world /* XXX : This is not going to be the fastest code in the world
@ -534,7 +534,7 @@ int
PyBuffer_FromContiguous(Py_buffer *view, void *buf, Py_ssize_t len, char fort) PyBuffer_FromContiguous(Py_buffer *view, void *buf, Py_ssize_t len, char fort)
{ {
int k; int k;
void (*addone)(int, Py_ssize_t *, Py_ssize_t *); void (*addone)(int, Py_ssize_t *, const Py_ssize_t *);
Py_ssize_t *indices, elements; Py_ssize_t *indices, elements;
char *src, *ptr; char *src, *ptr;
@ -561,10 +561,10 @@ PyBuffer_FromContiguous(Py_buffer *view, void *buf, Py_ssize_t len, char fort)
} }
if (fort == 'F') { if (fort == 'F') {
addone = _add_one_to_index_F; addone = _Py_add_one_to_index_F;
} }
else { else {
addone = _add_one_to_index_C; addone = _Py_add_one_to_index_C;
} }
src = buf; src = buf;
/* XXX : This is not going to be the fastest code in the world /* XXX : This is not going to be the fastest code in the world
@ -641,7 +641,7 @@ int PyObject_CopyData(PyObject *dest, PyObject *src)
elements *= view_src.shape[k]; elements *= view_src.shape[k];
} }
while (elements--) { while (elements--) {
_add_one_to_index_C(view_src.ndim, indices, view_src.shape); _Py_add_one_to_index_C(view_src.ndim, indices, view_src.shape);
dptr = PyBuffer_GetPointer(&view_dest, indices); dptr = PyBuffer_GetPointer(&view_dest, indices);
sptr = PyBuffer_GetPointer(&view_src, indices); sptr = PyBuffer_GetPointer(&view_src, indices);
memcpy(dptr, sptr, view_src.itemsize); memcpy(dptr, sptr, view_src.itemsize);

View File

@ -172,9 +172,6 @@ _strided_copy_nd(char *dest, char *src, int nd, Py_ssize_t *shape,
return; return;
} }
void _add_one_to_index_F(int nd, Py_ssize_t *index, Py_ssize_t *shape);
void _add_one_to_index_C(int nd, Py_ssize_t *index, Py_ssize_t *shape);
static int static int
_indirect_copy_nd(char *dest, Py_buffer *view, char fort) _indirect_copy_nd(char *dest, Py_buffer *view, char fort)
{ {
@ -203,10 +200,10 @@ _indirect_copy_nd(char *dest, Py_buffer *view, char fort)
elements *= view->shape[k]; elements *= view->shape[k];
} }
if (fort == 'F') { if (fort == 'F') {
func = _add_one_to_index_F; func = _Py_add_one_to_index_F;
} }
else { else {
func = _add_one_to_index_C; func = _Py_add_one_to_index_C;
} }
while (elements--) { while (elements--) {
func(view->ndim, indices, view->shape); func(view->ndim, indices, view->shape);