git://git.onelab.eu
/
sliver-openvswitch.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
bc59621
)
New function svec_join().
author
Ben Pfaff
<blp@nicira.com>
Tue, 20 Jan 2009 21:34:02 +0000
(13:34 -0800)
committer
Ben Pfaff
<blp@nicira.com>
Wed, 21 Jan 2009 00:45:22 +0000
(16:45 -0800)
lib/svec.c
patch
|
blob
|
history
lib/svec.h
patch
|
blob
|
history
diff --git
a/lib/svec.c
b/lib/svec.c
index
f006639
..
b568f67
100644
(file)
--- a/
lib/svec.c
+++ b/
lib/svec.c
@@
-293,3
+293,19
@@
svec_equal(const struct svec *a, const struct svec *b)
}
return true;
}
}
return true;
}
+
+char *
+svec_join(const struct svec *svec, const char *delimiter)
+{
+ struct ds ds;
+ size_t i;
+
+ ds_init(&ds);
+ for (i = 0; i < svec->n; i++) {
+ if (i) {
+ ds_put_cstr(&ds, delimiter);
+ }
+ ds_put_cstr(&ds, svec->names[i]);
+ }
+ return ds_cstr(&ds);
+}
diff --git
a/lib/svec.h
b/lib/svec.h
index
2ee275d
..
3362c00
100644
(file)
--- a/
lib/svec.h
+++ b/
lib/svec.h
@@
-62,5
+62,6
@@
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 *);
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 *);
+char *svec_join(const struct svec *, const char *delimiter);
#endif /* svec.h */
#endif /* svec.h */