diff options
author | jan.nijtmans <jan.nijtmans@noemail.net> | 2012-09-19 14:50:11 (GMT) |
---|---|---|
committer | jan.nijtmans <jan.nijtmans@noemail.net> | 2012-09-19 14:50:11 (GMT) |
commit | 3a5cc4f9247b76b9afec17299adc649bffbc50e8 (patch) | |
tree | b1a93c9472066ad889bb814aa68d0b255123be23 /generic/tclBinary.c | |
parent | a130a8ddcf0c1ad3d5b3521fd6304e1850b60997 (diff) | |
parent | 1ec38d677d816f81e86fc5d72aa543ad02fd39c7 (diff) | |
download | tcl-3a5cc4f9247b76b9afec17299adc649bffbc50e8.zip tcl-3a5cc4f9247b76b9afec17299adc649bffbc50e8.tar.gz tcl-3a5cc4f9247b76b9afec17299adc649bffbc50e8.tar.bz2 |
merge trunk
<p>change dde version to 1.4.0b2
FossilOrigin-Name: 82e045469a0b089c3d639729b57e12875ba3a4f2
Diffstat (limited to 'generic/tclBinary.c')
-rw-r--r-- | generic/tclBinary.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/generic/tclBinary.c b/generic/tclBinary.c index a1e836e..3d8b24c 100644 --- a/generic/tclBinary.c +++ b/generic/tclBinary.c @@ -303,18 +303,16 @@ 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 ((bytes != NULL) && (length > 0)) { + memcpy(byteArrayPtr->bytes, bytes, (size_t) length); + } objPtr->typePtr = &tclByteArrayType; SET_BYTEARRAY(objPtr, byteArrayPtr); } |