summaryrefslogtreecommitdiff
path: root/ofproto/collectors.c
diff options
context:
space:
mode:
authorBen Pfaff <blp@nicira.com>2011-03-25 15:04:12 -0700
committerBen Pfaff <blp@nicira.com>2011-03-31 16:42:01 -0700
commit81e2083fe6b7c16055f01c4b1e40f25867594bf6 (patch)
tree797735fa486ba538e0c8f8f5a135fceafaf5b0e7 /ofproto/collectors.c
parent53d046612df6c88ad8b02c8e99bbfb6e45fe2326 (diff)
downloadopenvswitch-81e2083fe6b7c16055f01c4b1e40f25867594bf6.tar.gz
ofproto: Change string sets in interface from svec to sset.
Diffstat (limited to 'ofproto/collectors.c')
-rw-r--r--ofproto/collectors.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/ofproto/collectors.c b/ofproto/collectors.c
index 58d6abbc3..bd3e89b19 100644
--- a/ofproto/collectors.c
+++ b/ofproto/collectors.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2009, 2010 Nicira Networks.
+ * Copyright (c) 2008, 2009, 2010, 2011 Nicira Networks.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,7 +24,7 @@
#include <unistd.h>
#include "socket-util.h"
-#include "svec.h"
+#include "sset.h"
#include "util.h"
#include "vlog.h"
@@ -47,24 +47,19 @@ struct collectors {
* added, otherwise to a new collectors object if at least one was successfully
* added. Thus, even on a failure return, it is possible that '*collectorsp'
* is nonnull, and even on a successful return, it is possible that
- * '*collectorsp' is null, if 'target's is an empty svec. */
+ * '*collectorsp' is null, if 'target's is an empty sset. */
int
-collectors_create(const struct svec *targets_, uint16_t default_port,
+collectors_create(const struct sset *targets, uint16_t default_port,
struct collectors **collectorsp)
{
struct collectors *c;
- struct svec targets;
+ const char *name;
int retval = 0;
- size_t i;
-
- svec_clone(&targets, targets_);
- svec_sort_unique(&targets);
c = xmalloc(sizeof *c);
- c->fds = xmalloc(sizeof *c->fds * targets.n);
+ c->fds = xmalloc(sizeof *c->fds * sset_count(targets));
c->n_fds = 0;
- for (i = 0; i < targets.n; i++) {
- const char *name = targets.names[i];
+ SSET_FOR_EACH (name, targets) {
int error;
int fd;
@@ -81,7 +76,6 @@ collectors_create(const struct svec *targets_, uint16_t default_port,
}
}
}
- svec_destroy(&targets);
if (c->n_fds) {
*collectorsp = c;