diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2012-07-16 20:31:44 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2012-07-16 20:31:44 (GMT) |
commit | 05904e5ffb9ebe71f9bed3b84472139f8d4394c9 (patch) | |
tree | 647407113d44545b2f799d4c0f3470478397f027 /generic/tclBinary.c | |
parent | ad3c0d8addcd132eb23ae96bcc21ce59458cb67a (diff) | |
download | tcl-05904e5ffb9ebe71f9bed3b84472139f8d4394c9.zip tcl-05904e5ffb9ebe71f9bed3b84472139f8d4394c9.tar.gz tcl-05904e5ffb9ebe71f9bed3b84472139f8d4394c9.tar.bz2 |
[Bug 3496014]: Unecessary memset() in Tcl_SetByteArrayObj()
Diffstat (limited to 'generic/tclBinary.c')
-rw-r--r-- | generic/tclBinary.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/generic/tclBinary.c b/generic/tclBinary.c index 444e7fa..ae8172f 100644 --- a/generic/tclBinary.c +++ b/generic/tclBinary.c @@ -307,12 +307,8 @@ Tcl_SetByteArrayObj( byteArrayPtr = ckalloc(BYTEARRAY_SIZE(length)); byteArrayPtr->used = length; byteArrayPtr->allocated = length; - if (length) { - if (bytes) { - memcpy(byteArrayPtr->bytes, bytes, (size_t) length); - } else { - memset(byteArrayPtr->bytes, 0, (size_t) length); - } + if (length && bytes) { + memcpy(byteArrayPtr->bytes, bytes, (size_t) length); } objPtr->typePtr = &tclByteArrayType; |