From: Ben Pfaff Date: Wed, 31 Dec 2008 22:33:47 +0000 (-0800) Subject: New function svec_equal(). X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0273112b898ead0a86151fdf4543a0c52fef6e27;p=openvswitch New function svec_equal(). --- diff --git a/lib/svec.c b/lib/svec.c index 054e5ffe..f0066392 100644 --- a/lib/svec.c +++ b/lib/svec.c @@ -277,3 +277,19 @@ svec_parse_words(struct svec *svec, const char *words) } ds_destroy(&word); } + +bool +svec_equal(const struct svec *a, const struct svec *b) +{ + size_t i; + + if (a->n != b->n) { + return false; + } + for (i = 0; i < a->n; i++) { + if (strcmp(a->names[i], b->names[i])) { + return false; + } + } + return true; +} diff --git a/lib/svec.h b/lib/svec.h index 2215c3cc..2ee275de 100644 --- a/lib/svec.h +++ b/lib/svec.h @@ -61,5 +61,6 @@ bool svec_is_sorted(const struct svec *); void svec_swap(struct svec *a, struct svec *b); void svec_print(const struct svec *svec, const char *title); void svec_parse_words(struct svec *svec, const char *words); +bool svec_equal(const struct svec *, const struct svec *); #endif /* svec.h */