projects
/
openvswitch
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
stream-ssl: Try to shut SSL connections down gracefully.
[openvswitch]
/
lib
/
shash.c
diff --git
a/lib/shash.c
b/lib/shash.c
index c35164bd92e277b98e5599c46f41f92485f909f5..5257de12aad4c4df7acb03809224e1e0bdd70e0c 100644
(file)
--- a/
lib/shash.c
+++ b/
lib/shash.c
@@
-67,15
+67,26
@@
shash_count(const struct shash *shash)
/* It is the caller's responsibility to avoid duplicate names, if that is
* desirable. */
struct shash_node *
/* It is the caller's responsibility to avoid duplicate names, if that is
* desirable. */
struct shash_node *
-shash_add(struct shash *sh, const char *name, void *data)
+shash_add(struct shash *sh, const char *name,
const
void *data)
{
struct shash_node *node = xmalloc(sizeof *node);
node->name = xstrdup(name);
{
struct shash_node *node = xmalloc(sizeof *node);
node->name = xstrdup(name);
- node->data = data;
+ node->data =
(void *)
data;
hmap_insert(&sh->map, &node->node, hash_name(name));
return node;
}
hmap_insert(&sh->map, &node->node, hash_name(name));
return node;
}
+bool
+shash_add_once(struct shash *sh, const char *name, const void *data)
+{
+ if (!shash_find(sh, name)) {
+ shash_add(sh, name, data);
+ return true;
+ } else {
+ return false;
+ }
+}
+
void
shash_delete(struct shash *sh, struct shash_node *node)
{
void
shash_delete(struct shash *sh, struct shash_node *node)
{