aboutsummaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2005-07-18 23:33:19 +0000
committerRoger Dingledine <arma@torproject.org>2005-07-18 23:33:19 +0000
commit8c657e4157b6c1e280fab85e46f7ef4afc54348f (patch)
tree0341335bfebb90771b5dce53bff44e842907bdfe /src/common
parente479cc935e9397b7cae65522de997e4405538202 (diff)
downloadtor-8c657e4157b6c1e280fab85e46f7ef4afc54348f.tar.gz
tor-8c657e4157b6c1e280fab85e46f7ef4afc54348f.zip
cosmetic fixes
svn:r4601
Diffstat (limited to 'src/common')
-rw-r--r--src/common/container.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/common/container.c b/src/common/container.c
index 3ddca27f26..b53710d4ff 100644
--- a/src/common/container.c
+++ b/src/common/container.c
@@ -358,14 +358,14 @@ char *smartlist_join_strings2(smartlist_t *sl, const char *join,
tor_assert(sl);
tor_assert(join);
- if (sl->num_used == 0)
- n = join_len; /* special-case this one, to avoid underflow */
+ if (terminate)
+ n = join_len;
for (i = 0; i < sl->num_used; ++i) {
n += strlen(sl->list[i]);
- n += join_len;
+ if (i+1 < sl->num_used) /* avoid double-counting the last one */
+ n += join_len;
}
- if (!terminate) n -= join_len;
dst = r = tor_malloc(n+1);
for (i = 0; i < sl->num_used; ) {
for (src = sl->list[i]; *src; )