diff options
author | Nick Mathewson <nickm@torproject.org> | 2011-05-15 11:44:51 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2011-05-15 11:44:51 -0400 |
commit | 37e3fb8af20b02f764d0993218ed6025448073dd (patch) | |
tree | 956927bb08f18e3f050cafdbc9c0c1f54a083d28 /src/common/container.c | |
parent | 2fd9cfdc234f5ec0d6799511be9ad7a57c52b45e (diff) | |
parent | f2871009346e0589455be14e9cef930c19082c0a (diff) | |
download | tor-37e3fb8af20b02f764d0993218ed6025448073dd.tar.gz tor-37e3fb8af20b02f764d0993218ed6025448073dd.zip |
Merge remote-tracking branch 'origin/maint-0.2.2'
Conflicts:
src/or/connection_edge.c
Diffstat (limited to 'src/common/container.c')
-rw-r--r-- | src/common/container.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/common/container.c b/src/common/container.c index eba5a2f704..af80f881f5 100644 --- a/src/common/container.c +++ b/src/common/container.c @@ -215,6 +215,25 @@ smartlist_string_num_isin(const smartlist_t *sl, int num) return smartlist_string_isin(sl, buf); } +/** Return true iff the two lists contain the same strings in the same + * order, or if they are both NULL. */ +int +smartlist_strings_eq(const smartlist_t *sl1, const smartlist_t *sl2) +{ + if (sl1 == NULL) + return sl2 == NULL; + if (sl2 == NULL) + return 0; + if (smartlist_len(sl1) != smartlist_len(sl2)) + return 0; + SMARTLIST_FOREACH(sl1, const char *, cp1, { + const char *cp2 = smartlist_get(sl2, cp1_sl_idx); + if (strcmp(cp1, cp2)) + return 0; + }); + return 1; +} + /** Return true iff <b>sl</b> has some element E such that * tor_memeq(E,<b>element</b>,DIGEST_LEN) */ |