1+ /*
2+ Copyright (c) 2019, PyData Development Team
3+ All rights reserved.
4+
5+ Distributed under the terms of the BSD Simplified License.
6+
7+ The full license is in the LICENSE file, distributed with this software.
8+ */
9+
110#include <Python.h>
211
312#define COMPILING_IN_PY2 (PY_VERSION_HEX <= 0x03000000)
@@ -31,15 +40,13 @@ typedef struct {
3140static PyTypeObject stolenbuf_type ; /* forward declare type */
3241
3342static void
34- stolenbuf_dealloc (stolenbufobject * self )
35- {
43+ stolenbuf_dealloc (stolenbufobject * self ) {
3644 Py_DECREF (self -> invalid_bytes );
3745 PyObject_Del (self );
3846}
3947
4048static int
41- stolenbuf_getbuffer (stolenbufobject * self , Py_buffer * view , int flags )
42- {
49+ stolenbuf_getbuffer (stolenbufobject * self , Py_buffer * view , int flags ) {
4350 return PyBuffer_FillInfo (view ,
4451 (PyObject * ) self ,
4552 (void * ) PyString_AS_STRING (self -> invalid_bytes ),
@@ -51,8 +58,8 @@ stolenbuf_getbuffer(stolenbufobject *self, Py_buffer *view, int flags)
5158#if COMPILING_IN_PY2
5259
5360static Py_ssize_t
54- stolenbuf_getreadwritebuf (stolenbufobject * self , Py_ssize_t segment , void * * out )
55- {
61+ stolenbuf_getreadwritebuf (stolenbufobject * self ,
62+ Py_ssize_t segment , void * * out ) {
5663 if (segment != 0 ) {
5764 PyErr_SetString (PyExc_SystemError ,
5865 "accessing non-existent string segment" );
@@ -63,8 +70,7 @@ stolenbuf_getreadwritebuf(stolenbufobject *self, Py_ssize_t segment, void **out)
6370}
6471
6572static Py_ssize_t
66- stolenbuf_getsegcount (stolenbufobject * self , Py_ssize_t * len )
67- {
73+ stolenbuf_getsegcount (stolenbufobject * self , Py_ssize_t * len ) {
6874 if (len ) {
6975 * len = PyString_GET_SIZE (self -> invalid_bytes );
7076 }
@@ -157,8 +163,7 @@ PyDoc_STRVAR(
157163 however, if called through *unpacking like ``stolenbuf(*(a,))`` it would
158164 only have the one reference (the tuple). */
159165static PyObject *
160- move_into_mutable_buffer (PyObject * self , PyObject * bytes_rvalue )
161- {
166+ move_into_mutable_buffer (PyObject * self , PyObject * bytes_rvalue ) {
162167 stolenbufobject * ret ;
163168
164169 if (!PyString_CheckExact (bytes_rvalue )) {
0 commit comments