]>
git.proxmox.com Git - mirror_ovs.git/blob - lib/svec.h
2 * Copyright (c) 2008, 2009, 2011 Nicira, Inc.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at:
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
33 #define SVEC_EMPTY_INITIALIZER { NULL, 0, 0 }
35 void svec_init(struct svec
*);
36 void svec_clone(struct svec
*, const struct svec
*);
37 void svec_destroy(struct svec
*);
38 void svec_clear(struct svec
*);
39 bool svec_is_empty(const struct svec
*);
40 void svec_add(struct svec
*, const char *);
41 void svec_add_nocopy(struct svec
*, char *);
42 void svec_del(struct svec
*, const char *);
43 void svec_append(struct svec
*, const struct svec
*);
44 void svec_terminate(struct svec
*);
45 void svec_sort(struct svec
*);
46 void svec_sort_unique(struct svec
*);
47 void svec_unique(struct svec
*);
48 void svec_compact(struct svec
*);
49 void svec_shuffle(struct svec
*);
50 void svec_diff(const struct svec
*a
, const struct svec
*b
,
51 struct svec
*a_only
, struct svec
*both
, struct svec
*b_only
);
52 bool svec_contains(const struct svec
*, const char *);
53 size_t svec_find(const struct svec
*, const char *);
54 bool svec_is_sorted(const struct svec
*);
55 bool svec_is_unique(const struct svec
*);
56 const char *svec_get_duplicate(const struct svec
*);
57 void svec_swap(struct svec
*a
, struct svec
*b
);
58 void svec_print(const struct svec
*svec
, const char *title
);
59 void svec_parse_words(struct svec
*svec
, const char *words
);
60 bool svec_equal(const struct svec
*, const struct svec
*);
61 char *svec_join(const struct svec
*,
62 const char *delimiter
, const char *terminator
);
63 const char *svec_back(const struct svec
*);
64 void svec_pop_back(struct svec
*);
66 /* Iterates over the names in SVEC, assigning each name in turn to NAME and its
68 #define SVEC_FOR_EACH(INDEX, NAME, SVEC) \
70 ((INDEX) < (SVEC)->n \
71 ? (NAME) = (SVEC)->names[INDEX], 1 \