mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-12-06 19:41:15 +01:00
Convenience function to do a strcmp on each member of a smartlist of strings
svn:r2243
This commit is contained in:
@@ -360,6 +360,14 @@ int smartlist_isin(const smartlist_t *sl, void *element) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int smartlist_string_isin(const smartlist_t *sl, const char *element) {
|
||||
int i;
|
||||
for(i=0; i < sl->num_used; i++)
|
||||
if(strcmp((const char*)sl->list[i],element)==0)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** Return true iff some element E of sl2 has smartlist_isin(sl1,E).
|
||||
*/
|
||||
int smartlist_overlap(const smartlist_t *sl1, const smartlist_t *sl2) {
|
||||
|
||||
@@ -147,6 +147,7 @@ void smartlist_add(smartlist_t *sl, void *element);
|
||||
void smartlist_add_all(smartlist_t *sl, const smartlist_t *s2);
|
||||
void smartlist_remove(smartlist_t *sl, void *element);
|
||||
int smartlist_isin(const smartlist_t *sl, void *element);
|
||||
int smartlist_string_isin(const smartlist_t *sl, const char *element);
|
||||
int smartlist_overlap(const smartlist_t *sl1, const smartlist_t *sl2);
|
||||
void smartlist_intersect(smartlist_t *sl1, const smartlist_t *sl2);
|
||||
void smartlist_subtract(smartlist_t *sl1, const smartlist_t *sl2);
|
||||
|
||||
Reference in New Issue
Block a user