Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b83df8f

Browse files
committed
Merged revisions 84391 via svnmerge from
svn+ssh://[email protected]/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. ........
1 parent 996b46a commit b83df8f

4 files changed

Lines changed: 21 additions & 14 deletions

File tree

Include/abstract.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1233,6 +1233,13 @@ PyAPI_FUNC(int) _PyObject_RealIsInstance(PyObject *inst, PyObject *cls);
12331233
PyAPI_FUNC(int) _PyObject_RealIsSubclass(PyObject *derived, PyObject *cls);
12341234

12351235

1236+
/* For internal use by buffer API functions */
1237+
PyAPI_FUNC(void) _Py_add_one_to_index_F(int nd, Py_ssize_t *index,
1238+
const Py_ssize_t *shape);
1239+
PyAPI_FUNC(void) _Py_add_one_to_index_C(int nd, Py_ssize_t *index,
1240+
const Py_ssize_t *shape);
1241+
1242+
12361243
#ifdef __cplusplus
12371244
}
12381245
#endif

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,9 @@ Extension Modules
514514
Build
515515
-----
516516

517+
- Issue #3101: Helper functions _add_one_to_C() and _add_one_to_F() become
518+
_Py_add_one_to_C() and _Py_add_one_to_F(), respectively.
519+
517520
- Issue #9700: define HAVE_BROKEN_POSIX_SEMAPHORES under AIX 6.x. Patch by
518521
Sébastien Sablé.
519522

Objects/abstract.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ PyBuffer_GetPointer(Py_buffer *view, Py_ssize_t *indices)
413413

414414

415415
void
416-
_add_one_to_index_F(int nd, Py_ssize_t *index, Py_ssize_t *shape)
416+
_Py_add_one_to_index_F(int nd, Py_ssize_t *index, const Py_ssize_t *shape)
417417
{
418418
int k;
419419

@@ -429,7 +429,7 @@ _add_one_to_index_F(int nd, Py_ssize_t *index, Py_ssize_t *shape)
429429
}
430430

431431
void
432-
_add_one_to_index_C(int nd, Py_ssize_t *index, Py_ssize_t *shape)
432+
_Py_add_one_to_index_C(int nd, Py_ssize_t *index, const Py_ssize_t *shape)
433433
{
434434
int k;
435435

@@ -453,7 +453,7 @@ int
453453
PyBuffer_ToContiguous(void *buf, Py_buffer *view, Py_ssize_t len, char fort)
454454
{
455455
int k;
456-
void (*addone)(int, Py_ssize_t *, Py_ssize_t *);
456+
void (*addone)(int, Py_ssize_t *, const Py_ssize_t *);
457457
Py_ssize_t *indices, elements;
458458
char *dest, *ptr;
459459

@@ -480,10 +480,10 @@ PyBuffer_ToContiguous(void *buf, Py_buffer *view, Py_ssize_t len, char fort)
480480
}
481481

482482
if (fort == 'F') {
483-
addone = _add_one_to_index_F;
483+
addone = _Py_add_one_to_index_F;
484484
}
485485
else {
486-
addone = _add_one_to_index_C;
486+
addone = _Py_add_one_to_index_C;
487487
}
488488
dest = buf;
489489
/* XXX : This is not going to be the fastest code in the world
@@ -504,7 +504,7 @@ int
504504
PyBuffer_FromContiguous(Py_buffer *view, void *buf, Py_ssize_t len, char fort)
505505
{
506506
int k;
507-
void (*addone)(int, Py_ssize_t *, Py_ssize_t *);
507+
void (*addone)(int, Py_ssize_t *, const Py_ssize_t *);
508508
Py_ssize_t *indices, elements;
509509
char *src, *ptr;
510510

@@ -531,10 +531,10 @@ PyBuffer_FromContiguous(Py_buffer *view, void *buf, Py_ssize_t len, char fort)
531531
}
532532

533533
if (fort == 'F') {
534-
addone = _add_one_to_index_F;
534+
addone = _Py_add_one_to_index_F;
535535
}
536536
else {
537-
addone = _add_one_to_index_C;
537+
addone = _Py_add_one_to_index_C;
538538
}
539539
src = buf;
540540
/* XXX : This is not going to be the fastest code in the world
@@ -611,7 +611,7 @@ int PyObject_CopyData(PyObject *dest, PyObject *src)
611611
elements *= view_src.shape[k];
612612
}
613613
while (elements--) {
614-
_add_one_to_index_C(view_src.ndim, indices, view_src.shape);
614+
_Py_add_one_to_index_C(view_src.ndim, indices, view_src.shape);
615615
dptr = PyBuffer_GetPointer(&view_dest, indices);
616616
sptr = PyBuffer_GetPointer(&view_src, indices);
617617
memcpy(dptr, sptr, view_src.itemsize);

Objects/memoryobject.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,6 @@ _strided_copy_nd(char *dest, char *src, int nd, Py_ssize_t *shape,
172172
return;
173173
}
174174

175-
void _add_one_to_index_F(int nd, Py_ssize_t *index, Py_ssize_t *shape);
176-
void _add_one_to_index_C(int nd, Py_ssize_t *index, Py_ssize_t *shape);
177-
178175
static int
179176
_indirect_copy_nd(char *dest, Py_buffer *view, char fort)
180177
{
@@ -203,10 +200,10 @@ _indirect_copy_nd(char *dest, Py_buffer *view, char fort)
203200
elements *= view->shape[k];
204201
}
205202
if (fort == 'F') {
206-
func = _add_one_to_index_F;
203+
func = _Py_add_one_to_index_F;
207204
}
208205
else {
209-
func = _add_one_to_index_C;
206+
func = _Py_add_one_to_index_C;
210207
}
211208
while (elements--) {
212209
func(view->ndim, indices, view->shape);

0 commit comments

Comments
 (0)