summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorEric Wieser <wieser.eric@gmail.com>2020-01-07 20:51:58 +0000
committerEric Wieser <wieser.eric@gmail.com>2020-01-07 20:51:58 +0000
commitac44095f8f8aca2574091bb32d6328d0b6bbf29a (patch)
tree9c799e6283bb80837c9f4d3c9ab716de3f99d9ad /numpy
parent3a42d5b3b329f013c8248a18820f9a5dd5cb8d5d (diff)
downloadnumpy-ac44095f8f8aca2574091bb32d6328d0b6bbf29a.tar.gz
MAINT: Move declarations next to their use
Diffstat (limited to 'numpy')
-rw-r--r--numpy/core/src/multiarray/descriptor.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/numpy/core/src/multiarray/descriptor.c b/numpy/core/src/multiarray/descriptor.c
index 68a7a7f42..8f3225dba 100644
--- a/numpy/core/src/multiarray/descriptor.c
+++ b/numpy/core/src/multiarray/descriptor.c
@@ -1574,13 +1574,9 @@ PyArray_DescrConverter(PyObject *obj, PyArray_Descr **at)
static int
_convert_from_bytes(PyObject *obj, PyArray_Descr **at)
{
- int check_num = NPY_NOTYPE + 10;
- int elsize = 0;
- char endian = '=';
+ /* Check for a string typecode. */
char *type = NULL;
Py_ssize_t len = 0;
-
- /* Check for a string typecode. */
if (PyBytes_AsStringAndSize(obj, &type, &len) < 0) {
goto error;
}
@@ -1597,6 +1593,7 @@ _convert_from_bytes(PyObject *obj, PyArray_Descr **at)
}
/* Process the endian character. '|' is replaced by '='*/
+ char endian = '=';
switch (type[0]) {
case '>':
case '<':
@@ -1631,6 +1628,8 @@ _convert_from_bytes(PyObject *obj, PyArray_Descr **at)
return NPY_SUCCEED;
}
+ int check_num = NPY_NOTYPE + 10;
+ int elsize = 0;
/* A typecode like 'd' */
if (len == 1) {
/* Python byte string characters are unsigned */
@@ -1716,8 +1715,7 @@ _convert_from_bytes(PyObject *obj, PyArray_Descr **at)
"Object0", "String0", "Timedelta64",
"Unicode0", "UInt", "Void0"};
int ndep_tps = sizeof(dep_tps) / sizeof(dep_tps[0]);
- int i;
- for (i = 0; i < ndep_tps; ++i) {
+ for (int i = 0; i < ndep_tps; ++i) {
char *dep_tp = dep_tps[i];
if (strncmp(type, dep_tp, strlen(dep_tp)) == 0) {