summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-06-22 09:26:19 -0400
committerNick Mathewson <nickm@torproject.org>2018-06-22 09:49:13 -0400
commit3883338c8121212b3f6f9c020d489d50bbcdd855 (patch)
tree18d9b69f63060354ad9c7525a46c63e0dcef54d3 /src/common
parent1abadee3fd1c15f3720003c411ec6043c29d7c09 (diff)
downloadtor-3883338c8121212b3f6f9c020d489d50bbcdd855.tar.gz
tor-3883338c8121212b3f6f9c020d489d50bbcdd855.zip
Move smartlist_add_{v,}asprintf into smartlist.[ch]
Now that I know that "strings" nests below "container", I know this is safe.
Diffstat (limited to 'src/common')
-rw-r--r--src/common/util.c24
-rw-r--r--src/common/util.h8
2 files changed, 1 insertions, 31 deletions
diff --git a/src/common/util.c b/src/common/util.c
index 597ff2c420..fc996f16c1 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -2595,30 +2595,6 @@ expand_filename(const char *filename)
#endif /* defined(_WIN32) */
}
-/** Append the string produced by tor_asprintf(<b>pattern</b>, <b>...</b>)
- * to <b>sl</b>. */
-void
-smartlist_add_asprintf(struct smartlist_t *sl, const char *pattern, ...)
-{
- va_list ap;
- va_start(ap, pattern);
- smartlist_add_vasprintf(sl, pattern, ap);
- va_end(ap);
-}
-
-/** va_list-based backend of smartlist_add_asprintf. */
-void
-smartlist_add_vasprintf(struct smartlist_t *sl, const char *pattern,
- va_list args)
-{
- char *str = NULL;
-
- tor_vasprintf(&str, pattern, args);
- tor_assert(str != NULL);
-
- smartlist_add(sl, str);
-}
-
/** 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.
*/
diff --git a/src/common/util.h b/src/common/util.h
index 5833fe567f..de6ba8ece0 100644
--- a/src/common/util.h
+++ b/src/common/util.h
@@ -126,13 +126,6 @@ const char *escaped(const char *string);
char *tor_escape_str_for_pt_args(const char *string,
const char *chars_to_escape);
-struct smartlist_t;
-void smartlist_add_asprintf(struct smartlist_t *sl, const char *pattern, ...)
- CHECK_PRINTF(2, 3);
-void smartlist_add_vasprintf(struct smartlist_t *sl, const char *pattern,
- va_list args)
- CHECK_PRINTF(2, 0);
-
/* Time helpers */
long tv_udiff(const struct timeval *start, const struct timeval *end);
long tv_mdiff(const struct timeval *start, const struct timeval *end);
@@ -250,6 +243,7 @@ typedef struct sized_chunk_t {
const char *bytes;
size_t len;
} sized_chunk_t;
+struct smartlist_t;
int write_chunks_to_file(const char *fname, const struct smartlist_t *chunks,
int bin, int no_tempfile);
int append_bytes_to_file(const char *fname, const char *str, size_t len,