Fix inconsistency in naming within an enum.

This commit is contained in:
Brett Cannon 2006-06-09 17:05:48 +00:00
parent 0873b11f2e
commit c48b0e6657
1 changed files with 12 additions and 12 deletions

View File

@ -16,9 +16,9 @@ typedef struct {
enum buffer_t { enum buffer_t {
READBUFFER, READ_BUFFER,
WRITEBUFFER, WRITE_BUFFER,
CHARBUFFER, CHAR_BUFFER,
ANY_BUFFER, ANY_BUFFER,
}; };
@ -40,13 +40,13 @@ get_buf(PyBufferObject *self, void **ptr, Py_ssize_t *size,
"single-segment buffer object expected"); "single-segment buffer object expected");
return 0; return 0;
} }
if ((buffer_type == READBUFFER) || if ((buffer_type == READ_BUFFER) ||
((buffer_type == ANY_BUFFER) && self->b_readonly)) ((buffer_type == ANY_BUFFER) && self->b_readonly))
proc = bp->bf_getreadbuffer; proc = bp->bf_getreadbuffer;
else if ((buffer_type == WRITEBUFFER) || else if ((buffer_type == WRITE_BUFFER) ||
(buffer_type == ANY_BUFFER)) (buffer_type == ANY_BUFFER))
proc = (readbufferproc)bp->bf_getwritebuffer; proc = (readbufferproc)bp->bf_getwritebuffer;
else if (buffer_type == CHARBUFFER) { else if (buffer_type == CHAR_BUFFER) {
if (!PyType_HasFeature(self->ob_type, if (!PyType_HasFeature(self->ob_type,
Py_TPFLAGS_HAVE_GETCHARBUFFER)) { Py_TPFLAGS_HAVE_GETCHARBUFFER)) {
PyErr_SetString(PyExc_TypeError, PyErr_SetString(PyExc_TypeError,
@ -58,13 +58,13 @@ get_buf(PyBufferObject *self, void **ptr, Py_ssize_t *size,
if (!proc) { if (!proc) {
char *buffer_type_name; char *buffer_type_name;
switch (buffer_type) { switch (buffer_type) {
case READBUFFER: case READ_BUFFER:
buffer_type_name = "read"; buffer_type_name = "read";
break; break;
case WRITEBUFFER: case WRITE_BUFFER:
buffer_type_name = "write"; buffer_type_name = "write";
break; break;
case CHARBUFFER: case CHAR_BUFFER:
buffer_type_name = "char"; buffer_type_name = "char";
break; break;
default: default:
@ -592,7 +592,7 @@ buffer_getreadbuf(PyBufferObject *self, Py_ssize_t idx, void **pp)
"accessing non-existent buffer segment"); "accessing non-existent buffer segment");
return -1; return -1;
} }
if (!get_buf(self, pp, &size, READBUFFER)) if (!get_buf(self, pp, &size, READ_BUFFER))
return -1; return -1;
return size; return size;
} }
@ -613,7 +613,7 @@ buffer_getwritebuf(PyBufferObject *self, Py_ssize_t idx, void **pp)
"accessing non-existent buffer segment"); "accessing non-existent buffer segment");
return -1; return -1;
} }
if (!get_buf(self, pp, &size, WRITEBUFFER)) if (!get_buf(self, pp, &size, WRITE_BUFFER))
return -1; return -1;
return size; return size;
} }
@ -640,7 +640,7 @@ buffer_getcharbuf(PyBufferObject *self, Py_ssize_t idx, const char **pp)
"accessing non-existent buffer segment"); "accessing non-existent buffer segment");
return -1; return -1;
} }
if (!get_buf(self, &ptr, &size, CHARBUFFER)) if (!get_buf(self, &ptr, &size, CHAR_BUFFER))
return -1; return -1;
*pp = (const char *)ptr; *pp = (const char *)ptr;
return size; return size;