diff options
Diffstat (limited to 'Objects/bytesobject.c')
-rw-r--r-- | Objects/bytesobject.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c index 4223dc9..f9823f1 100644 --- a/Objects/bytesobject.c +++ b/Objects/bytesobject.c @@ -667,9 +667,6 @@ _PyBytes_FormatEx(const char *format, Py_ssize_t format_len, Py_ssize_t len = 0; char onechar; /* For byte_converter() */ Py_ssize_t alloc; -#ifdef Py_DEBUG - char *before; -#endif fmt++; if (*fmt == '%') { @@ -981,8 +978,8 @@ _PyBytes_FormatEx(const char *format, Py_ssize_t format_len, if (res == NULL) goto error; } -#ifdef Py_DEBUG - before = res; +#ifndef NDEBUG + char *before = res; #endif /* Write the sign if needed */ @@ -1047,7 +1044,7 @@ _PyBytes_FormatEx(const char *format, Py_ssize_t format_len, } Py_XDECREF(temp); -#ifdef Py_DEBUG +#ifndef NDEBUG /* check that we computed the exact size for this write */ assert((res - before) == alloc); #endif @@ -3168,8 +3165,9 @@ _PyBytesWriter_Init(_PyBytesWriter *writer) { /* Set all attributes before small_buffer to 0 */ memset(writer, 0, offsetof(_PyBytesWriter, small_buffer)); -#ifdef Py_DEBUG - memset(writer->small_buffer, 0xCB, sizeof(writer->small_buffer)); +#ifndef NDEBUG + memset(writer->small_buffer, PYMEM_CLEANBYTE, + sizeof(writer->small_buffer)); #endif } @@ -3297,8 +3295,9 @@ _PyBytesWriter_Resize(_PyBytesWriter *writer, void *str, Py_ssize_t size) } writer->use_small_buffer = 0; -#ifdef Py_DEBUG - memset(writer->small_buffer, 0xDB, sizeof(writer->small_buffer)); +#ifndef NDEBUG + memset(writer->small_buffer, PYMEM_CLEANBYTE, + sizeof(writer->small_buffer)); #endif } writer->allocated = allocated; @@ -3350,7 +3349,7 @@ _PyBytesWriter_Alloc(_PyBytesWriter *writer, Py_ssize_t size) assert(size >= 0); writer->use_small_buffer = 1; -#ifdef Py_DEBUG +#ifndef NDEBUG writer->allocated = sizeof(writer->small_buffer) - 1; /* In debug mode, don't use the full small buffer because it is less efficient than bytes and bytearray objects to detect buffer underflow |