diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2015-10-09 10:37:03 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2015-10-09 10:37:03 (GMT) |
commit | 53926a1ce2772ea5dc1c4fb8c19f5f9ae461750d (patch) | |
tree | 0bcfb4a42bcb869f2b9441aa4fc5913b2859222d /Objects | |
parent | fa7762ec066aa3632a25b6a52bb7597b8f17c2f3 (diff) | |
download | cpython-53926a1ce2772ea5dc1c4fb8c19f5f9ae461750d.zip cpython-53926a1ce2772ea5dc1c4fb8c19f5f9ae461750d.tar.gz cpython-53926a1ce2772ea5dc1c4fb8c19f5f9ae461750d.tar.bz2 |
_PyBytesWriter: rename size attribute to min_size
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/bytesobject.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c index ef53288..4a0735f 100644 --- a/Objects/bytesobject.c +++ b/Objects/bytesobject.c @@ -3821,7 +3821,7 @@ _PyBytesWriter_Init(_PyBytesWriter *writer) { writer->buffer = NULL; writer->allocated = 0; - writer->size = 0; + writer->min_size = 0; writer->overallocate = 0; writer->use_small_buffer = 0; #ifdef Py_DEBUG @@ -3874,7 +3874,7 @@ _PyBytesWriter_CheckConsistency(_PyBytesWriter *writer, char *str) } start = _PyBytesWriter_AsString(writer); - assert(0 <= writer->size && writer->size <= writer->allocated); + assert(0 <= writer->min_size && writer->min_size <= writer->allocated); /* the last byte must always be null */ assert(start[writer->allocated] == 0); @@ -3897,18 +3897,18 @@ _PyBytesWriter_Prepare(_PyBytesWriter *writer, char *str, Py_ssize_t size) return str; } - if (writer->size > PY_SSIZE_T_MAX - size) { + if (writer->min_size > PY_SSIZE_T_MAX - size) { PyErr_NoMemory(); _PyBytesWriter_Dealloc(writer); return NULL; } - writer->size += size; + writer->min_size += size; allocated = writer->allocated; - if (writer->size <= allocated) + if (writer->min_size <= allocated) return str; - allocated = writer->size; + allocated = writer->min_size; if (writer->overallocate && allocated <= (PY_SSIZE_T_MAX - allocated / OVERALLOCATE_FACTOR)) { /* overallocate to limit the number of realloc() */ @@ -3957,7 +3957,7 @@ char* _PyBytesWriter_Alloc(_PyBytesWriter *writer, Py_ssize_t size) { /* ensure that _PyBytesWriter_Alloc() is only called once */ - assert(writer->size == 0 && writer->buffer == NULL); + assert(writer->min_size == 0 && writer->buffer == NULL); assert(size >= 0); writer->use_small_buffer = 1; |