diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-02-27 08:34:05 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-02-27 08:34:05 (GMT) |
commit | f04b875d88bbe9cd4d2114d60c194be01a7c9e04 (patch) | |
tree | 34dde540a1ed936003a721aec62cf6ede6e5bfa2 /generic/tclCkalloc.c | |
parent | 4fdbe79875a43efd9f42e75ccf256884f657dac3 (diff) | |
download | tcl-f04b875d88bbe9cd4d2114d60c194be01a7c9e04.zip tcl-f04b875d88bbe9cd4d2114d60c194be01a7c9e04.tar.gz tcl-f04b875d88bbe9cd4d2114d60c194be01a7c9e04.tar.bz2 |
More use of (efficient) TclHasIntRep() macro. Also eliminate many (size_t) and (unsigned) type-casts, which don't make sense any more.
Diffstat (limited to 'generic/tclCkalloc.c')
-rw-r--r-- | generic/tclCkalloc.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/generic/tclCkalloc.c b/generic/tclCkalloc.c index e3fb98e..94327b5 100644 --- a/generic/tclCkalloc.c +++ b/generic/tclCkalloc.c @@ -405,7 +405,7 @@ Tcl_DbCkalloc( /* Don't let size argument to TclpAlloc overflow */ if (size <= UINT_MAX - HIGH_GUARD_SIZE -sizeof(struct mem_header)) { - result = (struct mem_header *) TclpAlloc((unsigned)size + + result = (struct mem_header *) TclpAlloc(size + sizeof(struct mem_header) + HIGH_GUARD_SIZE); } if (result == NULL) { @@ -495,7 +495,7 @@ Tcl_AttemptDbCkalloc( /* Don't let size argument to TclpAlloc overflow */ if (size <= UINT_MAX - HIGH_GUARD_SIZE - sizeof(struct mem_header)) { - result = (struct mem_header *) TclpAlloc((unsigned)size + + result = (struct mem_header *) TclpAlloc(size + sizeof(struct mem_header) + HIGH_GUARD_SIZE); } if (result == NULL) { @@ -691,7 +691,7 @@ Tcl_DbCkrealloc( copySize = memp->length; } newPtr = Tcl_DbCkalloc(size, file, line); - memcpy(newPtr, ptr, (size_t) copySize); + memcpy(newPtr, ptr, copySize); Tcl_DbCkfree(ptr, file, line); return newPtr; } @@ -725,7 +725,7 @@ Tcl_AttemptDbCkrealloc( if (newPtr == NULL) { return NULL; } - memcpy(newPtr, ptr, (size_t) copySize); + memcpy(newPtr, ptr, copySize); Tcl_DbCkfree(ptr, file, line); return newPtr; } |