diff options
author | Steve Bennett <steveb@workware.net.au> | 2023-02-05 14:16:08 +1000 |
---|---|---|
committer | Steve Bennett <steveb@workware.net.au> | 2023-02-13 10:43:00 +1000 |
commit | d30183cbf77bce87ed5d96c1021e9521ac10c015 (patch) | |
tree | 35690a566883725e0f95f3c427678be634186db1 | |
parent | b3874a49dcfcbf0a04e1af974f0fa86a021432f1 (diff) | |
download | jimtcl-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>
-rw-r--r-- | jim.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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; } |