aboutsummaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/common')
-rw-r--r--src/common/address.h2
-rw-r--r--src/common/container.c13
-rw-r--r--src/common/container.h12
-rw-r--r--src/common/util.c11
-rw-r--r--src/common/util.h1
-rw-r--r--src/common/util_bug.c1
6 files changed, 22 insertions, 18 deletions
diff --git a/src/common/address.h b/src/common/address.h
index 317c7f329c..6986143f6e 100644
--- a/src/common/address.h
+++ b/src/common/address.h
@@ -16,6 +16,7 @@
#include "lib/cc/torint.h"
#include "common/compat.h"
#include "common/container.h"
+#include "common/util_bug.h"
#ifdef ADDRESS_PRIVATE
@@ -376,4 +377,3 @@ STATIC smartlist_t *get_interface_addresses_ioctl(int severity,
#endif /* defined(ADDRESS_PRIVATE) */
#endif /* !defined(TOR_ADDRESS_H) */
-
diff --git a/src/common/container.c b/src/common/container.c
index c30e84ba24..a7810ba90b 100644
--- a/src/common/container.c
+++ b/src/common/container.c
@@ -11,9 +11,7 @@
* a digest-to-void* map.
**/
-#include "common/compat.h"
#include "common/util.h"
-#include "common/torlog.h"
#include "common/container.h"
#include "lib/crypt_ops/crypto_digest.h"
@@ -113,6 +111,17 @@ smartlist_add_all(smartlist_t *s1, const smartlist_t *s2)
s1->num_used = (int) new_size;
}
+/** 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);
+}
+
/** 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.
diff --git a/src/common/container.h b/src/common/container.h
index 372fa6640c..c45bfc359b 100644
--- a/src/common/container.h
+++ b/src/common/container.h
@@ -6,7 +6,15 @@
#ifndef TOR_CONTAINER_H
#define TOR_CONTAINER_H
-#include "common/util.h"
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "lib/cc/compat_compiler.h"
+#include "lib/cc/torint.h"
+#include "lib/testsupport/testsupport.h"
+#include "lib/malloc/util_malloc.h"
+#include "common/util_bug.h"
#include "siphash.h"
/** A resizeable list of pointers, with associated helpful functionality.
@@ -34,6 +42,7 @@ MOCK_DECL(void, smartlist_free_, (smartlist_t *sl));
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_remove(smartlist_t *sl, const void *element);
void smartlist_remove_keeporder(smartlist_t *sl, const void *element);
void *smartlist_pop_last(smartlist_t *sl);
@@ -739,4 +748,3 @@ third_quartile_uint32(uint32_t *array, int n_elements)
}
#endif /* !defined(TOR_CONTAINER_H) */
-
diff --git a/src/common/util.c b/src/common/util.c
index d09d194158..fbb2fed395 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -3279,17 +3279,6 @@ 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.
*/
diff --git a/src/common/util.h b/src/common/util.h
index bc29ddbe2a..1c889082b9 100644
--- a/src/common/util.h
+++ b/src/common/util.h
@@ -167,7 +167,6 @@ void smartlist_add_asprintf(struct smartlist_t *sl, const char *pattern, ...)
void smartlist_add_vasprintf(struct smartlist_t *sl, const char *pattern,
va_list args)
CHECK_PRINTF(2, 0);
-void smartlist_add_strdup(struct smartlist_t *sl, const char *string);
/* Time helpers */
long tv_udiff(const struct timeval *start, const struct timeval *end);
diff --git a/src/common/util_bug.c b/src/common/util_bug.c
index 5cfd00649f..524d48c68a 100644
--- a/src/common/util_bug.c
+++ b/src/common/util_bug.c
@@ -116,4 +116,3 @@ tor_bug_occurred_(const char *fname, unsigned int line,
}
#endif
}
-