Skip to content

Commit cd237bb

Browse files
committed
Rename ReadBuffer.read_cstr() -> ReadBuffer.read_null_str()
1 parent 7ff919d commit cd237bb

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

buffer.pxd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ cdef class ReadBuffer:
101101
return self._current_message_len
102102

103103
cdef inline read_utf8(self):
104-
return self.read_cstr().decode('utf-8')
104+
return self.read_null_str().decode('utf-8')
105105

106106
cdef feed_data(self, data)
107107
cdef inline _ensure_first_buf(self)
@@ -113,7 +113,7 @@ cdef class ReadBuffer:
113113
cdef bytes read_bytes(self, ssize_t nbytes)
114114
cdef inline int32_t read_int32(self) except? -1
115115
cdef inline int16_t read_int16(self) except? -1
116-
cdef inline read_cstr(self)
116+
cdef inline read_null_str(self)
117117
cdef int32_t take_message(self) except -1
118118
cdef inline int32_t take_message_type(self, char mtype) except -1
119119
cdef int32_t put_message(self) except -1

buffer.pyx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -419,10 +419,10 @@ cdef class ReadBuffer:
419419
mem = self.read_bytes(2)
420420
return hton.unpack_int16(cpython.PyBytes_AS_STRING(mem))
421421

422-
cdef inline read_cstr(self):
422+
cdef inline read_null_str(self):
423423
if not self._current_message_ready:
424424
raise exceptions.BufferError(
425-
'read_cstr only works when the message guaranteed '
425+
'read_null_str only works when the message guaranteed '
426426
'to be in the buffer')
427427

428428
cdef:
@@ -459,7 +459,8 @@ cdef class ReadBuffer:
459459

460460
self._current_message_len_unread -= nread
461461
if self._current_message_len_unread < 0:
462-
raise exceptions.BufferError('read_cstr: buffer overread')
462+
raise exceptions.BufferError(
463+
'read_null_str: buffer overread')
463464

464465
return result
465466

@@ -471,7 +472,8 @@ cdef class ReadBuffer:
471472

472473
self._current_message_len_unread -= nread
473474
if self._current_message_len_unread < 0:
474-
raise exceptions.BufferError('read_cstr: buffer overread')
475+
raise exceptions.BufferError(
476+
'read_null_str: buffer overread')
475477

476478
self._ensure_first_buf()
477479

0 commit comments

Comments
 (0)