summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2012-08-23 14:37:20 (GMT)
committerdgp <dgp@users.sourceforge.net>2012-08-23 14:37:20 (GMT)
commite6bb8f361290d568722685292e0aca56a53a6ad9 (patch)
tree2f4d3ac01ad5a04aacfc41444976c6657970dad8 /generic
parent7d4e05824b97c9ea47add1149866767725a281f7 (diff)
parent5b6d377583611280dd6b24739e4891334c3fb515 (diff)
downloadtcl-e6bb8f361290d568722685292e0aca56a53a6ad9.zip
tcl-e6bb8f361290d568722685292e0aca56a53a6ad9.tar.gz
tcl-e6bb8f361290d568722685292e0aca56a53a6ad9.tar.bz2
merge trunk
Diffstat (limited to 'generic')
-rw-r--r--generic/tclBinary.c12
1 files changed, 5 insertions, 7 deletions
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;