summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2012-04-15 22:28:22 -0600
committerCharles Harris <charlesr.harris@gmail.com>2012-04-21 12:20:04 -0600
commite96ed36909c495b6000e6f664b24ff69ce2e02d9 (patch)
treea2df452438018582628b24686e70ed1e772ec0e1
parent1dba433756be0139d0b9ec591678c456fd54bdc2 (diff)
downloadnumpy-e96ed36909c495b6000e6f664b24ff69ce2e02d9.tar.gz
WRN: Fixed some unused variable compiler warnings in arraytypes.c.src.
Also break templated @from@_to_@to@ functions into two templates to simplify the code a bit.
-rw-r--r--numpy/core/src/multiarray/arraytypes.c.src31
1 files changed, 29 insertions, 2 deletions
diff --git a/numpy/core/src/multiarray/arraytypes.c.src b/numpy/core/src/multiarray/arraytypes.c.src
index 0270675ef..9dbcb8439 100644
--- a/numpy/core/src/multiarray/arraytypes.c.src
+++ b/numpy/core/src/multiarray/arraytypes.c.src
@@ -1283,6 +1283,8 @@ OBJECT_to_@TOTYPE@(PyObject **ip, @totype@ *op, npy_intp n,
* #convstr = (Int*9, Long*2, Float*4, Complex*3, Tuple*3, Long*2)*3#
*/
+#if @convert@
+
#define IS_@from@
static void
@@ -1299,7 +1301,6 @@ static void
if (temp == NULL) {
return;
}
-#if @convert@
#if defined(NPY_PY3K) && defined(IS_STRING)
/* Work around some Python 3K */
@@ -1329,7 +1330,7 @@ static void
return;
}
}
-#endif /* @convert@ */
+
if (@to@_setitem(temp,(char *)op, aop)) {
Py_DECREF(temp);
return;
@@ -1340,6 +1341,32 @@ static void
#undef IS_@from@
+#else
+
+static void
+@from@_to_@to@(@fromtyp@ *ip, @totyp@ *op, npy_intp n, PyArrayObject *aip,
+ PyArrayObject *aop)
+{
+ npy_intp i;
+ PyObject *temp = NULL;
+ int skip = PyArray_DESCR(aip)->elsize;
+ int oskip = @oskip@;
+
+ for (i = 0; i < n; i++, ip+=skip, op+=oskip) {
+ temp = @from@_getitem((char *)ip, aip);
+ if (temp == NULL) {
+ return;
+ }
+ if (@to@_setitem(temp,(char *)op, aop)) {
+ Py_DECREF(temp);
+ return;
+ }
+ Py_DECREF(temp);
+ }
+}
+
+#endif
+
/**end repeat**/