diff options
author | Fred Drake <fdrake@acm.org> | 2000-07-09 04:06:11 (GMT) |
---|---|---|
committer | Fred Drake <fdrake@acm.org> | 2000-07-09 04:06:11 (GMT) |
commit | 799124718ddfbb95440470037d8d7760b821646f (patch) | |
tree | cf0324bf7bc44649f01c6ad8184c47e4e9e42cc9 /Objects/bufferobject.c | |
parent | a83b68a143b4d274bf8eb7e67b789f9d7dd27f86 (diff) | |
download | cpython-799124718ddfbb95440470037d8d7760b821646f.zip cpython-799124718ddfbb95440470037d8d7760b821646f.tar.gz cpython-799124718ddfbb95440470037d8d7760b821646f.tar.bz2 |
ANSI-fication of the sources.
Diffstat (limited to 'Objects/bufferobject.c')
-rw-r--r-- | Objects/bufferobject.c | 102 |
1 files changed, 24 insertions, 78 deletions
diff --git a/Objects/bufferobject.c b/Objects/bufferobject.c index 9bce20e..67d26a1 100644 --- a/Objects/bufferobject.c +++ b/Objects/bufferobject.c @@ -26,11 +26,7 @@ typedef struct { static PyObject * -_PyBuffer_FromMemory(base, ptr, size, readonly) - PyObject *base; - void *ptr; - int size; - int readonly; +_PyBuffer_FromMemory(PyObject *base, void *ptr, int size, int readonly) { PyBufferObject * b; @@ -57,12 +53,8 @@ _PyBuffer_FromMemory(base, ptr, size, readonly) } static PyObject * -_PyBuffer_FromObject(base, offset, size, proc, readonly) - PyObject *base; - int offset; - int size; - getreadbufferproc proc; - int readonly; +_PyBuffer_FromObject(PyObject *base, int offset, int size, + getreadbufferproc proc, int readonly) { PyBufferProcs *pb = base->ob_type->tp_as_buffer; void *p; @@ -100,10 +92,7 @@ _PyBuffer_FromObject(base, offset, size, proc, readonly) PyObject * -PyBuffer_FromObject(base, offset, size) - PyObject *base; - int offset; - int size; +PyBuffer_FromObject(PyObject *base, int offset, int size) { PyBufferProcs *pb = base->ob_type->tp_as_buffer; @@ -120,10 +109,7 @@ PyBuffer_FromObject(base, offset, size) } PyObject * -PyBuffer_FromReadWriteObject(base, offset, size) - PyObject *base; - int offset; - int size; +PyBuffer_FromReadWriteObject(PyObject *base, int offset, int size) { PyBufferProcs *pb = base->ob_type->tp_as_buffer; @@ -141,24 +127,19 @@ PyBuffer_FromReadWriteObject(base, offset, size) } PyObject * -PyBuffer_FromMemory(ptr, size) - void *ptr; - int size; +PyBuffer_FromMemory(void *ptr, int size) { return _PyBuffer_FromMemory(NULL, ptr, size, 1); } PyObject * -PyBuffer_FromReadWriteMemory(ptr, size) - void *ptr; - int size; +PyBuffer_FromReadWriteMemory(void *ptr, int size) { return _PyBuffer_FromMemory(NULL, ptr, size, 0); } PyObject * -PyBuffer_New(size) - int size; +PyBuffer_New(int size) { PyBufferObject * b; @@ -187,17 +168,14 @@ PyBuffer_New(size) /* Methods */ static void -buffer_dealloc(self) - PyBufferObject *self; +buffer_dealloc(PyBufferObject *self) { Py_XDECREF(self->b_base); PyObject_DEL(self); } static int -buffer_compare(self, other) - PyBufferObject *self; - PyBufferObject *other; +buffer_compare(PyBufferObject *self, PyBufferObject *other) { int len_self = self->b_size; int len_other = other->b_size; @@ -212,8 +190,7 @@ buffer_compare(self, other) } static PyObject * -buffer_repr(self) - PyBufferObject *self; +buffer_repr(PyBufferObject *self) { char buf[300]; char *status = self->b_readonly ? "read-only" : "read-write"; @@ -240,8 +217,7 @@ buffer_repr(self) } static long -buffer_hash(self) - PyBufferObject *self; +buffer_hash(PyBufferObject *self) { register int len; register unsigned char *p; @@ -274,8 +250,7 @@ buffer_hash(self) } static PyObject * -buffer_str(self) - PyBufferObject *self; +buffer_str(PyBufferObject *self) { return PyString_FromStringAndSize(self->b_ptr, self->b_size); } @@ -283,16 +258,13 @@ buffer_str(self) /* Sequence methods */ static int -buffer_length(self) - PyBufferObject *self; +buffer_length(PyBufferObject *self) { return self->b_size; } static PyObject * -buffer_concat(self, other) - PyBufferObject *self; - PyObject *other; +buffer_concat(PyBufferObject *self, PyObject *other) { PyBufferProcs *pb = other->ob_type->tp_as_buffer; char *p1; @@ -344,9 +316,7 @@ buffer_concat(self, other) } static PyObject * -buffer_repeat(self, count) - PyBufferObject *self; - int count; +buffer_repeat(PyBufferObject *self, int count) { PyObject *ob; register char *p; @@ -373,9 +343,7 @@ buffer_repeat(self, count) } static PyObject * -buffer_item(self, idx) - PyBufferObject *self; - int idx; +buffer_item(PyBufferObject *self, int idx) { if ( idx < 0 || idx >= self->b_size ) { @@ -386,10 +354,7 @@ buffer_item(self, idx) } static PyObject * -buffer_slice(self, left, right) - PyBufferObject *self; - int left; - int right; +buffer_slice(PyBufferObject *self, int left, int right) { if ( left < 0 ) left = 0; @@ -410,10 +375,7 @@ buffer_slice(self, left, right) } static int -buffer_ass_item(self, idx, other) - PyBufferObject *self; - int idx; - PyObject *other; +buffer_ass_item(PyBufferObject *self, int idx, PyObject *other) { PyBufferProcs *pb; void *p; @@ -460,11 +422,7 @@ buffer_ass_item(self, idx, other) } static int -buffer_ass_slice(self, left, right, other) - PyBufferObject *self; - int left; - int right; - PyObject *other; +buffer_ass_slice(PyBufferObject *self, int left, int right, PyObject *other) { PyBufferProcs *pb; void *p; @@ -521,10 +479,7 @@ buffer_ass_slice(self, left, right, other) /* Buffer methods */ static int -buffer_getreadbuf(self, idx, pp) - PyBufferObject *self; - int idx; - void ** pp; +buffer_getreadbuf(PyBufferObject *self, int idx, void **pp) { if ( idx != 0 ) { PyErr_SetString(PyExc_SystemError, @@ -536,10 +491,7 @@ buffer_getreadbuf(self, idx, pp) } static int -buffer_getwritebuf(self, idx, pp) - PyBufferObject *self; - int idx; - void ** pp; +buffer_getwritebuf(PyBufferObject *self, int idx, void **pp) { if ( self->b_readonly ) { @@ -550,9 +502,7 @@ buffer_getwritebuf(self, idx, pp) } static int -buffer_getsegcount(self, lenp) - PyBufferObject *self; - int *lenp; +buffer_getsegcount(PyBufferObject *self, int *lenp) { if ( lenp ) *lenp = self->b_size; @@ -560,10 +510,7 @@ buffer_getsegcount(self, lenp) } static int -buffer_getcharbuf(self, idx, pp) - PyBufferObject *self; - int idx; - const char ** pp; +buffer_getcharbuf(PyBufferObject *self, int idx, const char **pp) { if ( idx != 0 ) { PyErr_SetString(PyExc_SystemError, @@ -616,4 +563,3 @@ PyTypeObject PyBuffer_Type = { Py_TPFLAGS_DEFAULT, /*tp_flags*/ 0, /*tp_doc*/ }; - |