aboutsummaryrefslogtreecommitdiff
path: root/src/common/container.h
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2008-09-09 03:48:01 +0000
committerNick Mathewson <nickm@torproject.org>2008-09-09 03:48:01 +0000
commitaacda9cd8eae992c9359279782234dd626415948 (patch)
tree2ef186a23b8586f45df741952cdc18f1b16c2b46 /src/common/container.h
parent346ca2d48e481f760fea421657fca76c2c474d65 (diff)
downloadtor-aacda9cd8eae992c9359279782234dd626415948.tar
tor-aacda9cd8eae992c9359279782234dd626415948.tar.gz
We should not alter an addr_policy_t that has been canonicalized.
svn:r16802
Diffstat (limited to 'src/common/container.h')
-rw-r--r--src/common/container.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/common/container.h b/src/common/container.h
index 6faad3435..598e27aaa 100644
--- a/src/common/container.h
+++ b/src/common/container.h
@@ -222,6 +222,15 @@ char *smartlist_join_strings2(smartlist_t *sl, const char *join,
--var ## _sl_len; \
STMT_END
+/** Helper: While in a SMARTLIST_FOREACH loop over the list <b>sl</b> indexed
+ * with the variable <b>var</b>, replace the current element with <b>val</b>.
+ * Does not deallocate the current value of <b>var</b>.
+ */
+#define SMARTLIST_REPLACE_CURRENT(sl, var, val) \
+ STMT_BEGIN \
+ smartlist_set(sl, var ## _sl_idx, val); \
+ STMT_END
+
/* Helper: Given two lists of items, possibly of different types, such that
* both lists are sorted on some common field (as determened by a comparison
* expression <b>cmpexpr</b>), and such that one list (<b>sl1</b>) has no