Kaydet (Commit) 82cce4c5 authored tarafından Benjamin Peterson's avatar Benjamin Peterson

use static inline instead of Py_LOCAL_INLINE

üst 9ae3fb5a
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
} }
Py_LOCAL_INLINE(_PyManagedBufferObject *) static inline _PyManagedBufferObject *
mbuf_alloc(void) mbuf_alloc(void)
{ {
_PyManagedBufferObject *mbuf; _PyManagedBufferObject *mbuf;
...@@ -243,7 +243,7 @@ Create a new memoryview object which references the given object."); ...@@ -243,7 +243,7 @@ Create a new memoryview object which references the given object.");
#define HAVE_SUBOFFSETS_IN_LAST_DIM(view) \ #define HAVE_SUBOFFSETS_IN_LAST_DIM(view) \
(view->suboffsets && view->suboffsets[dest->ndim-1] >= 0) (view->suboffsets && view->suboffsets[dest->ndim-1] >= 0)
Py_LOCAL_INLINE(int) static inline int
last_dim_is_contiguous(const Py_buffer *dest, const Py_buffer *src) last_dim_is_contiguous(const Py_buffer *dest, const Py_buffer *src)
{ {
assert(dest->ndim > 0 && src->ndim > 0); assert(dest->ndim > 0 && src->ndim > 0);
...@@ -259,7 +259,7 @@ last_dim_is_contiguous(const Py_buffer *dest, const Py_buffer *src) ...@@ -259,7 +259,7 @@ last_dim_is_contiguous(const Py_buffer *dest, const Py_buffer *src)
assignments, where the lvalue is already known to have a single character assignments, where the lvalue is already known to have a single character
format. This is a performance hack that could be rewritten (if properly format. This is a performance hack that could be rewritten (if properly
benchmarked). */ benchmarked). */
Py_LOCAL_INLINE(int) static inline int
equiv_format(const Py_buffer *dest, const Py_buffer *src) equiv_format(const Py_buffer *dest, const Py_buffer *src)
{ {
const char *dfmt, *sfmt; const char *dfmt, *sfmt;
...@@ -279,7 +279,7 @@ equiv_format(const Py_buffer *dest, const Py_buffer *src) ...@@ -279,7 +279,7 @@ equiv_format(const Py_buffer *dest, const Py_buffer *src)
/* Two shapes are equivalent if they are either equal or identical up /* Two shapes are equivalent if they are either equal or identical up
to a zero element at the same position. For example, in NumPy arrays to a zero element at the same position. For example, in NumPy arrays
the shapes [1, 0, 5] and [1, 0, 7] are equivalent. */ the shapes [1, 0, 5] and [1, 0, 7] are equivalent. */
Py_LOCAL_INLINE(int) static inline int
equiv_shape(const Py_buffer *dest, const Py_buffer *src) equiv_shape(const Py_buffer *dest, const Py_buffer *src)
{ {
int i; int i;
...@@ -438,7 +438,7 @@ copy_buffer(Py_buffer *dest, Py_buffer *src) ...@@ -438,7 +438,7 @@ copy_buffer(Py_buffer *dest, Py_buffer *src)
} }
/* Initialize strides for a C-contiguous array. */ /* Initialize strides for a C-contiguous array. */
Py_LOCAL_INLINE(void) static inline void
init_strides_from_shape(Py_buffer *view) init_strides_from_shape(Py_buffer *view)
{ {
Py_ssize_t i; Py_ssize_t i;
...@@ -451,7 +451,7 @@ init_strides_from_shape(Py_buffer *view) ...@@ -451,7 +451,7 @@ init_strides_from_shape(Py_buffer *view)
} }
/* Initialize strides for a Fortran-contiguous array. */ /* Initialize strides for a Fortran-contiguous array. */
Py_LOCAL_INLINE(void) static inline void
init_fortran_strides_from_shape(Py_buffer *view) init_fortran_strides_from_shape(Py_buffer *view)
{ {
Py_ssize_t i; Py_ssize_t i;
...@@ -513,7 +513,7 @@ buffer_to_contiguous(char *mem, Py_buffer *src, char order) ...@@ -513,7 +513,7 @@ buffer_to_contiguous(char *mem, Py_buffer *src, char order)
/****************************************************************************/ /****************************************************************************/
/* Initialize values that are shared with the managed buffer. */ /* Initialize values that are shared with the managed buffer. */
Py_LOCAL_INLINE(void) static inline void
init_shared_values(Py_buffer *dest, const Py_buffer *src) init_shared_values(Py_buffer *dest, const Py_buffer *src)
{ {
dest->obj = src->obj; dest->obj = src->obj;
...@@ -553,7 +553,7 @@ init_shape_strides(Py_buffer *dest, const Py_buffer *src) ...@@ -553,7 +553,7 @@ init_shape_strides(Py_buffer *dest, const Py_buffer *src)
} }
} }
Py_LOCAL_INLINE(void) static inline void
init_suboffsets(Py_buffer *dest, const Py_buffer *src) init_suboffsets(Py_buffer *dest, const Py_buffer *src)
{ {
Py_ssize_t i; Py_ssize_t i;
...@@ -567,7 +567,7 @@ init_suboffsets(Py_buffer *dest, const Py_buffer *src) ...@@ -567,7 +567,7 @@ init_suboffsets(Py_buffer *dest, const Py_buffer *src)
} }
/* len = product(shape) * itemsize */ /* len = product(shape) * itemsize */
Py_LOCAL_INLINE(void) static inline void
init_len(Py_buffer *view) init_len(Py_buffer *view)
{ {
Py_ssize_t i, len; Py_ssize_t i, len;
...@@ -614,7 +614,7 @@ init_flags(PyMemoryViewObject *mv) ...@@ -614,7 +614,7 @@ init_flags(PyMemoryViewObject *mv)
/* Allocate a new memoryview and perform basic initialization. New memoryviews /* Allocate a new memoryview and perform basic initialization. New memoryviews
are exclusively created through the mbuf_add functions. */ are exclusively created through the mbuf_add functions. */
Py_LOCAL_INLINE(PyMemoryViewObject *) static inline PyMemoryViewObject *
memory_alloc(int ndim) memory_alloc(int ndim)
{ {
PyMemoryViewObject *mv; PyMemoryViewObject *mv;
...@@ -1099,7 +1099,7 @@ memory_exit(PyObject *self, PyObject *args) ...@@ -1099,7 +1099,7 @@ memory_exit(PyObject *self, PyObject *args)
#define IS_BYTE_FORMAT(f) (f == 'b' || f == 'B' || f == 'c') #define IS_BYTE_FORMAT(f) (f == 'b' || f == 'B' || f == 'c')
Py_LOCAL_INLINE(Py_ssize_t) static inline Py_ssize_t
get_native_fmtchar(char *result, const char *fmt) get_native_fmtchar(char *result, const char *fmt)
{ {
Py_ssize_t size = -1; Py_ssize_t size = -1;
...@@ -1127,7 +1127,7 @@ get_native_fmtchar(char *result, const char *fmt) ...@@ -1127,7 +1127,7 @@ get_native_fmtchar(char *result, const char *fmt)
return -1; return -1;
} }
Py_LOCAL_INLINE(const char *) static inline const char *
get_native_fmtstr(const char *fmt) get_native_fmtstr(const char *fmt)
{ {
int at = 0; int at = 0;
...@@ -1642,7 +1642,7 @@ pylong_as_zu(PyObject *item) ...@@ -1642,7 +1642,7 @@ pylong_as_zu(PyObject *item)
/* Unpack a single item. 'fmt' can be any native format character in struct /* Unpack a single item. 'fmt' can be any native format character in struct
module syntax. This function is very sensitive to small changes. With this module syntax. This function is very sensitive to small changes. With this
layout gcc automatically generates a fast jump table. */ layout gcc automatically generates a fast jump table. */
Py_LOCAL_INLINE(PyObject *) static inline PyObject *
unpack_single(const char *ptr, const char *fmt) unpack_single(const char *ptr, const char *fmt)
{ {
unsigned long long llu; unsigned long long llu;
...@@ -1998,7 +1998,7 @@ struct_unpack_single(const char *ptr, struct unpacker *x) ...@@ -1998,7 +1998,7 @@ struct_unpack_single(const char *ptr, struct unpacker *x)
/****************************************************************************/ /****************************************************************************/
/* allow explicit form of native format */ /* allow explicit form of native format */
Py_LOCAL_INLINE(const char *) static inline const char *
adjust_fmt(const Py_buffer *view) adjust_fmt(const Py_buffer *view)
{ {
const char *fmt; const char *fmt;
...@@ -2280,7 +2280,7 @@ memory_item_multi(PyMemoryViewObject *self, PyObject *tup) ...@@ -2280,7 +2280,7 @@ memory_item_multi(PyMemoryViewObject *self, PyObject *tup)
return unpack_single(ptr, fmt); return unpack_single(ptr, fmt);
} }
Py_LOCAL_INLINE(int) static inline int
init_slice(Py_buffer *base, PyObject *key, int dim) init_slice(Py_buffer *base, PyObject *key, int dim)
{ {
Py_ssize_t start, stop, step, slicelength; Py_ssize_t start, stop, step, slicelength;
...@@ -2602,7 +2602,7 @@ struct_unpack_cmp(const char *p, const char *q, ...@@ -2602,7 +2602,7 @@ struct_unpack_cmp(const char *p, const char *q,
equal = (x == y); \ equal = (x == y); \
} while (0) } while (0)
Py_LOCAL_INLINE(int) static inline int
unpack_cmp(const char *p, const char *q, char fmt, unpack_cmp(const char *p, const char *q, char fmt,
struct unpacker *unpack_p, struct unpacker *unpack_q) struct unpacker *unpack_p, struct unpacker *unpack_q)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment