Loading src/common/util.c +0 −24 Original line number Diff line number Diff line Loading @@ -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. */ Loading src/common/util.h +1 −7 Original line number Diff line number Diff line Loading @@ -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); Loading Loading @@ -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, Loading src/lib/container/smartlist.c +25 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ #include "lib/defs/digest_sizes.h" #include "lib/ctime/di_ops.h" #include "lib/string/util_string.h" #include "lib/string/printf.h" #include <stdlib.h> #include <string.h> Loading Loading @@ -124,6 +125,30 @@ smartlist_add_strdup(struct smartlist_t *sl, const char *string) smartlist_add(sl, copy); } /** 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); } /** Remove all elements E from sl such that E==element. Preserve * the order of any elements before E, but elements after E can be * rearranged. Loading src/lib/container/smartlist.h +5 −0 Original line number Diff line number Diff line Loading @@ -37,6 +37,11 @@ void smartlist_clear(smartlist_t *sl); void smartlist_add(smartlist_t *sl, void *element); void smartlist_add_all(smartlist_t *sl, const smartlist_t *s2); void smartlist_add_strdup(struct smartlist_t *sl, const char *string); 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); void smartlist_remove(smartlist_t *sl, const void *element); void smartlist_remove_keeporder(smartlist_t *sl, const void *element); void *smartlist_pop_last(smartlist_t *sl); Loading src/rust/build.rs +1 −0 Original line number Diff line number Diff line Loading @@ -152,6 +152,7 @@ pub fn main() { cfg.component("tor-crypt-ops-testing"); cfg.component("or-testing"); cfg.component("tor-container-testing"); cfg.component("tor-string-testing"); cfg.component("tor-malloc"); cfg.component("tor-err-testing"); cfg.component("or-event-testing"); Loading Loading
src/common/util.c +0 −24 Original line number Diff line number Diff line Loading @@ -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. */ Loading
src/common/util.h +1 −7 Original line number Diff line number Diff line Loading @@ -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); Loading Loading @@ -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, Loading
src/lib/container/smartlist.c +25 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ #include "lib/defs/digest_sizes.h" #include "lib/ctime/di_ops.h" #include "lib/string/util_string.h" #include "lib/string/printf.h" #include <stdlib.h> #include <string.h> Loading Loading @@ -124,6 +125,30 @@ smartlist_add_strdup(struct smartlist_t *sl, const char *string) smartlist_add(sl, copy); } /** 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); } /** Remove all elements E from sl such that E==element. Preserve * the order of any elements before E, but elements after E can be * rearranged. Loading
src/lib/container/smartlist.h +5 −0 Original line number Diff line number Diff line Loading @@ -37,6 +37,11 @@ void smartlist_clear(smartlist_t *sl); void smartlist_add(smartlist_t *sl, void *element); void smartlist_add_all(smartlist_t *sl, const smartlist_t *s2); void smartlist_add_strdup(struct smartlist_t *sl, const char *string); 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); void smartlist_remove(smartlist_t *sl, const void *element); void smartlist_remove_keeporder(smartlist_t *sl, const void *element); void *smartlist_pop_last(smartlist_t *sl); Loading
src/rust/build.rs +1 −0 Original line number Diff line number Diff line Loading @@ -152,6 +152,7 @@ pub fn main() { cfg.component("tor-crypt-ops-testing"); cfg.component("or-testing"); cfg.component("tor-container-testing"); cfg.component("tor-string-testing"); cfg.component("tor-malloc"); cfg.component("tor-err-testing"); cfg.component("or-event-testing"); Loading