r13243@catbus: nickm | 2007-06-04 15:17:15 -0400

Start of code to compute consensus network-status stuff from a bunch of votes.  Strangely, it does not yet feel like an enormous ugly hack. 


svn:r10489
This commit is contained in:
Nick Mathewson
2007-06-04 19:19:01 +00:00
parent 32d12dcfbc
commit bb6f53d60c
8 changed files with 558 additions and 23 deletions
+12
View File
@@ -196,6 +196,18 @@ smartlist_string_isin(const smartlist_t *sl, const char *element)
return 0;
}
/** DOCDOC */
int
smartlist_string_pos(const smartlist_t *sl, const char *element)
{
int i;
if (!sl) return -1;
for (i=0; i < sl->num_used; i++)
if (strcmp((const char*)sl->list[i],element)==0)
return i;
return -1;
}
/** Return true iff <b>sl</b> has some element E such that
* !strcasecmp(E,<b>element</b>)
*/
+1
View File
@@ -40,6 +40,7 @@ void smartlist_string_remove(smartlist_t *sl, const char *element);
int smartlist_isin(const smartlist_t *sl, const void *element) ATTR_PURE;
int smartlist_string_isin(const smartlist_t *sl, const char *element)
ATTR_PURE;
int smartlist_string_pos(const smartlist_t *, const char *elt) ATTR_PURE;
int smartlist_string_isin_case(const smartlist_t *sl, const char *element)
ATTR_PURE;
int smartlist_string_num_isin(const smartlist_t *sl, int num) ATTR_PURE;