aboutsummaryrefslogtreecommitdiff
path: root/jim.c
diff options
context:
space:
mode:
authorSteve Bennett <steveb@workware.net.au>2023-02-05 14:16:08 +1000
committerSteve Bennett <steveb@workware.net.au>2023-02-13 10:43:00 +1000
commitd30183cbf77bce87ed5d96c1021e9521ac10c015 (patch)
tree35690a566883725e0f95f3c427678be634186db1 /jim.c
parentb3874a49dcfcbf0a04e1af974f0fa86a021432f1 (diff)
downloadjimtcl-d30183cbf77bce87ed5d96c1021e9521ac10c015.zip
jimtcl-d30183cbf77bce87ed5d96c1021e9521ac10c015.tar.gz
jimtcl-d30183cbf77bce87ed5d96c1021e9521ac10c015.tar.bz2
Jim_StrDupLen: minor optimisation
No need to copy a char that will be overwritten in the next line. Signed-off-by: Steve Bennett <steveb@workware.net.au>
Diffstat (limited to 'jim.c')
-rw-r--r--jim.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/jim.c b/jim.c
index fba93cb..8806ec4 100644
--- a/jim.c
+++ b/jim.c
@@ -684,8 +684,8 @@ char *Jim_StrDupLen(const char *s, int l)
{
char *copy = Jim_Alloc(l + 1);
- memcpy(copy, s, l + 1);
- copy[l] = 0; /* Just to be sure, original could be substring */
+ memcpy(copy, s, l);
+ copy[l] = 0; /* NULL terminate */
return copy;
}