summaryrefslogtreecommitdiff
path: root/numpy/core
diff options
context:
space:
mode:
authormattip <matti.picus@gmail.com>2018-09-15 23:27:12 +0300
committermattip <matti.picus@gmail.com>2018-09-15 23:27:12 +0300
commitce854a89a5192c68b8c718ae0d48e1eee78b531a (patch)
tree616a46956acc901d9b9cdaa4ce673bb9379dc330 /numpy/core
parent466e532e9d9f3c219d6f74a5d29fbe0b057b7346 (diff)
downloadnumpy-ce854a89a5192c68b8c718ae0d48e1eee78b531a.tar.gz
MAINT: move functions to numpyos.c, adjust accordingly
Diffstat (limited to 'numpy/core')
-rw-r--r--numpy/core/setup.py6
-rw-r--r--numpy/core/src/common/numpyos.c (renamed from numpy/core/src/multiarray/numpyos.c)28
-rw-r--r--numpy/core/src/common/numpyos.h (renamed from numpy/core/src/multiarray/numpyos.h)7
-rw-r--r--numpy/core/src/common/wrapper.c33
-rw-r--r--numpy/core/src/common/wrapper.h13
-rw-r--r--numpy/core/src/multiarray/arraytypes.c.src5
-rw-r--r--numpy/core/src/umath/ufunc_object.c4
7 files changed, 41 insertions, 55 deletions
diff --git a/numpy/core/setup.py b/numpy/core/setup.py
index 986e40007..c15dee5b9 100644
--- a/numpy/core/setup.py
+++ b/numpy/core/setup.py
@@ -737,7 +737,7 @@ def configuration(parent_package='',top_path=None):
join('src', 'common', 'ucsnarrow.h'),
join('src', 'common', 'ufunc_override.h'),
join('src', 'common', 'umathmodule.h'),
- join('src', 'common', 'wrapper.h'),
+ join('src', 'common', 'numpyos.h'),
]
common_src = [
@@ -747,7 +747,7 @@ def configuration(parent_package='',top_path=None):
join('src', 'common', 'templ_common.h.src'),
join('src', 'common', 'ucsnarrow.c'),
join('src', 'common', 'ufunc_override.c'),
- join('src', 'common', 'wrapper.c'),
+ join('src', 'common', 'numpyos.c'),
]
blas_info = get_info('blas_opt', 0)
@@ -787,7 +787,6 @@ def configuration(parent_package='',top_path=None):
join('src', 'multiarray', 'multiarraymodule.h'),
join('src', 'multiarray', 'nditer_impl.h'),
join('src', 'multiarray', 'number.h'),
- join('src', 'multiarray', 'numpyos.h'),
join('src', 'multiarray', 'refcount.h'),
join('src', 'multiarray', 'scalartypes.h'),
join('src', 'multiarray', 'sequence.h'),
@@ -853,7 +852,6 @@ def configuration(parent_package='',top_path=None):
join('src', 'multiarray', 'nditer_constr.c'),
join('src', 'multiarray', 'nditer_pywrap.c'),
join('src', 'multiarray', 'number.c'),
- join('src', 'multiarray', 'numpyos.c'),
join('src', 'multiarray', 'refcount.c'),
join('src', 'multiarray', 'sequence.c'),
join('src', 'multiarray', 'shape.c'),
diff --git a/numpy/core/src/multiarray/numpyos.c b/numpy/core/src/common/numpyos.c
index 52dcbf3c8..d60b1ca17 100644
--- a/numpy/core/src/multiarray/numpyos.c
+++ b/numpy/core/src/common/numpyos.c
@@ -769,3 +769,31 @@ NumPyOS_ascii_ftoLf(FILE *fp, long double *value)
}
return r;
}
+
+NPY_NO_EXPORT npy_longlong
+NumPyOS_strtoll(const char *str, char **endptr, int base)
+{
+#if defined HAVE_STRTOLL
+ return strtoll(str, endptr, base);
+#elif defined _MSC_VER
+ return _strtoi64(str, endptr, base);
+#else
+ /* ok on 64 bit posix */
+ return PyOS_strtol(str, endptr, base);
+#endif
+}
+
+NPY_NO_EXPORT npy_ulonglong
+NumPyOS_strtoull(const char *str, char **endptr, int base)
+{
+#if defined HAVE_STRTOULL
+ return strtoull(str, endptr, base);
+#elif defined _MSC_VER
+ return _strtoui64(str, endptr, base);
+#else
+ /* ok on 64 bit posix */
+ return PyOS_strtoul(str, endptr, base);
+#endif
+}
+
+
diff --git a/numpy/core/src/multiarray/numpyos.h b/numpy/core/src/common/numpyos.h
index 7ca795a6f..4deed8400 100644
--- a/numpy/core/src/multiarray/numpyos.h
+++ b/numpy/core/src/common/numpyos.h
@@ -31,4 +31,11 @@ NumPyOS_ascii_ftoLf(FILE *fp, long double *value);
NPY_NO_EXPORT int
NumPyOS_ascii_isspace(int c);
+/* Convert a string to an int in an arbitrary base */
+NPY_NO_EXPORT npy_longlong
+NumPyOS_strtoll(const char *str, char **endptr, int base);
+
+/* Convert a string to an int in an arbitrary base */
+NPY_NO_EXPORT npy_ulonglong
+NumPyOS_strtoull(const char *str, char **endptr, int base);
#endif
diff --git a/numpy/core/src/common/wrapper.c b/numpy/core/src/common/wrapper.c
deleted file mode 100644
index 43b7064fc..000000000
--- a/numpy/core/src/common/wrapper.c
+++ /dev/null
@@ -1,33 +0,0 @@
-#define NPY_NO_DEPRECATED_API NPY_API_VERSION
-#define _MULTIARRAYMODULE
-#include <Python.h>
-#include <numpy/arrayobject.h>
-#include "wrapper.h"
-
-NPY_NO_EXPORT npy_longlong
-npy_strtoll(const char *str, char **endptr, int base)
-{
-#if defined HAVE_STRTOLL
- return strtoll(str, endptr, base);
-#elif defined _MSC_VER
- return _strtoi64(str, endptr, base);
-#else
- /* ok on 64 bit posix */
- return PyOS_strtol(str, endptr, base);
-#endif
-}
-
-NPY_NO_EXPORT npy_ulonglong
-npy_strtoull(const char *str, char **endptr, int base)
-{
-#if defined HAVE_STRTOULL
- return strtoull(str, endptr, base);
-#elif defined _MSC_VER
- return _strtoui64(str, endptr, base);
-#else
- /* ok on 64 bit posix */
- return PyOS_strtoul(str, endptr, base);
-#endif
-}
-
-
diff --git a/numpy/core/src/common/wrapper.h b/numpy/core/src/common/wrapper.h
deleted file mode 100644
index 3c0686d92..000000000
--- a/numpy/core/src/common/wrapper.h
+++ /dev/null
@@ -1,13 +0,0 @@
-#ifndef _COMMON_WRAPPER_H
-#define _COMMON_WRAPPER_H
-
-
-/* Convert a string to an int in an arbitrary base */
-NPY_NO_EXPORT npy_longlong
-npy_strtoll(const char *str, char **endptr, int base);
-
-/* Convert a string to an int in an arbitrary base */
-NPY_NO_EXPORT npy_ulonglong
-npy_strtoull(const char *str, char **endptr, int base);
-
-#endif
diff --git a/numpy/core/src/multiarray/arraytypes.c.src b/numpy/core/src/multiarray/arraytypes.c.src
index 31d69b5f5..db5fa2586 100644
--- a/numpy/core/src/multiarray/arraytypes.c.src
+++ b/numpy/core/src/multiarray/arraytypes.c.src
@@ -34,7 +34,6 @@
#include "cblasfuncs.h"
#include "npy_cblas.h"
-#include "wrapper.h"
#include <limits.h>
#include <assert.h>
@@ -1767,8 +1766,8 @@ BOOL_scan(FILE *fp, npy_bool *ip, void *NPY_UNUSED(ignore),
* #type = npy_byte, npy_ubyte, npy_short, npy_ushort, npy_int, npy_uint,
* npy_long, npy_ulong, npy_longlong, npy_ulonglong,
* npy_datetime, npy_timedelta#
- * #func = (PyOS_strtol, PyOS_strtoul)*4, npy_strtoll, npy_strtoull,
- * npy_strtoll*2#
+ * #func = (PyOS_strtol, PyOS_strtoul)*4, NumPyOS_strtoll, NumPyOS_strtoull,
+ * NumPyOS_strtoll*2#
* #btype = (npy_long, npy_ulong)*4, npy_longlong, npy_ulonglong,
* npy_longlong*2#
*/
diff --git a/numpy/core/src/umath/ufunc_object.c b/numpy/core/src/umath/ufunc_object.c
index 8f792ef31..09344f602 100644
--- a/numpy/core/src/umath/ufunc_object.c
+++ b/numpy/core/src/umath/ufunc_object.c
@@ -46,7 +46,7 @@
#include "npy_import.h"
#include "extobj.h"
#include "common.h"
-#include "wrapper.h"
+#include "numpyos.h"
/********** PRINTF DEBUG TRACING **************/
#define NPY_UF_DBG_TRACING 0
@@ -487,7 +487,7 @@ static npy_int
_get_size(const char* str)
{
char *stop;
- npy_longlong size = npy_strtoll(str, &stop, 10);
+ npy_longlong size = NumPyOS_strtoll(str, &stop, 10);
if (stop == str || _is_alpha_underscore(*stop)) {
/* not a well formed number */