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 | ff601c88100652c703080ff83ba89801e0ea0aba (patch) | |
tree | 647407113d44545b2f799d4c0f3470478397f027 /generic | |
parent | 5dff38707576522b97793ce6ad8024b0f92895bb (diff) | |
download | tcl-bug_3496014.zip tcl-bug_3496014.tar.gz tcl-bug_3496014.tar.bz2 |
[Bug 3496014]: Unecessary memset() in Tcl_SetByteArrayObj()bug_3496014
Diffstat (limited to 'generic')
-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; |