summaryrefslogtreecommitdiff
path: root/src/common/util.c
diff options
context:
space:
mode:
authorovercaffeinated <overcaffeinated@airmail.cc>2016-10-27 10:12:28 +0100
committerovercaffeinated <overcaffeinated@airmail.cc>2016-10-27 10:12:28 +0100
commitb8b8b6b70e670cb735b43bc6b90150ab1ed4e2d1 (patch)
tree7b7576212ceb2c0f342120860cc6c68c4abdd206 /src/common/util.c
parent48d7b693022e911899f1798386a2f5e277512cb2 (diff)
downloadtor-b8b8b6b70e670cb735b43bc6b90150ab1ed4e2d1.tar.gz
tor-b8b8b6b70e670cb735b43bc6b90150ab1ed4e2d1.zip
Add implementation of smartlist_add_strdup
Add smartlist_add_strdup(sl, string) - replaces the use of smartlist_add(sl, tor_strdup(string)). Fixes bug 20048.
Diffstat (limited to 'src/common/util.c')
-rw-r--r--src/common/util.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/common/util.c b/src/common/util.c
index 9162967907..02ccf4ff0f 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -3532,6 +3532,17 @@ smartlist_add_vasprintf(struct smartlist_t *sl, const char *pattern,
smartlist_add(sl, str);
}
+/** Append a copy of string to sl */
+void
+smartlist_add_strdup(struct smartlist_t *sl, const char *string)
+{
+ char *copy;
+
+ copy = tor_strdup(string);
+
+ smartlist_add(sl, copy);
+}
+
/** Return a new list containing the filenames in the directory <b>dirname</b>.
* Return NULL on error or if <b>dirname</b> is not a directory.
*/