diff options
author | dgp <dgp@users.sourceforge.net> | 2012-08-23 14:37:20 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2012-08-23 14:37:20 (GMT) |
commit | e6bb8f361290d568722685292e0aca56a53a6ad9 (patch) | |
tree | 2f4d3ac01ad5a04aacfc41444976c6657970dad8 | |
parent | 7d4e05824b97c9ea47add1149866767725a281f7 (diff) | |
parent | 5b6d377583611280dd6b24739e4891334c3fb515 (diff) | |
download | tcl-e6bb8f361290d568722685292e0aca56a53a6ad9.zip tcl-e6bb8f361290d568722685292e0aca56a53a6ad9.tar.gz tcl-e6bb8f361290d568722685292e0aca56a53a6ad9.tar.bz2 |
merge trunk
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | generic/tclBinary.c | 12 |
2 files changed, 10 insertions, 7 deletions
@@ -1,3 +1,8 @@ +2012-08-23 Jan Nijtmans <nijtmans@users.sf.net> + + * generic/tclBinary.c: [Bug 3496014] Unecessary memset() in + Tcl_SetByteArrayObj(). + 2012-08-20 Don Porter <dgp@users.sourceforge.net> * generic/tclPathObj.c: [Bug 3559678] Fix bad filename normalization diff --git a/generic/tclBinary.c b/generic/tclBinary.c index a1e836e..4953e27 100644 --- a/generic/tclBinary.c +++ b/generic/tclBinary.c @@ -303,16 +303,14 @@ Tcl_SetByteArrayObj( TclFreeIntRep(objPtr); Tcl_InvalidateStringRep(objPtr); - length = (length < 0) ? 0 : length; + if (length < 0) { + length = 0; + } 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; |