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 (from parent 1:
1acb6ba
)
hmap: Rename "new" to "new_node" for C++ header compatibility.
author
Ben Pfaff
<blp@nicira.com>
Fri, 22 Jan 2010 23:10:07 +0000
(15:10 -0800)
committer
Ben Pfaff
<blp@nicira.com>
Fri, 22 Jan 2010 23:14:03 +0000
(15:14 -0800)
From partner.
lib/hmap.h
patch
|
blob
|
history
diff --git
a/lib/hmap.h
b/lib/hmap.h
index
1809a91
..
d770af8
100644
(file)
--- a/
lib/hmap.h
+++ b/
lib/hmap.h
@@
-21,6
+21,10
@@
#include <stdlib.h>
#include "util.h"
#include <stdlib.h>
#include "util.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* A hash map node, to be embedded inside the data structure being mapped. */
struct hmap_node {
size_t hash; /* Hash value. */
/* A hash map node, to be embedded inside the data structure being mapped. */
struct hmap_node {
size_t hash; /* Hash value. */
@@
-63,8
+67,9
@@
static inline void hmap_insert(struct hmap *, struct hmap_node *, size_t hash);
static inline void hmap_remove(struct hmap *, struct hmap_node *);
static inline void hmap_moved(struct hmap *,
struct hmap_node *, struct hmap_node *);
static inline void hmap_remove(struct hmap *, struct hmap_node *);
static inline void hmap_moved(struct hmap *,
struct hmap_node *, struct hmap_node *);
-static inline void hmap_replace(struct hmap *, const struct hmap_node *old,
- struct hmap_node *new);
+static inline void hmap_replace(struct hmap *,
+ const struct hmap_node *old_node,
+ struct hmap_node *new_node);
/* Search. */
#define HMAP_FOR_EACH_WITH_HASH(NODE, STRUCT, MEMBER, HASH, HMAP) \
/* Search. */
#define HMAP_FOR_EACH_WITH_HASH(NODE, STRUCT, MEMBER, HASH, HMAP) \
@@
-173,23
+178,23
@@
hmap_moved(struct hmap *hmap,
*bucket = node;
}
*bucket = node;
}
-/* Puts 'new
' in the position in 'hmap' currently occupied by 'old'. The 'new'
- *
node must hash to the same value as 'old'. The client is responsible for
- *
ensuring that the replacement does not violate any client-imposed
- * invariants (e.g. uniqueness of keys within a map).
+/* Puts 'new
_node' in the position in 'hmap' currently occupied by 'old_node'.
+ *
The 'new_node' must hash to the same value as 'old_node'. The client is
+ *
responsible for ensuring that the replacement does not violate any
+ *
client-imposed
invariants (e.g. uniqueness of keys within a map).
*
*
- * Afterward, 'old
' is not part of 'hmap', and the client is responsible for
- * freeing it (if this is desirable). */
+ * Afterward, 'old
_node' is not part of 'hmap', and the client is responsible
+ * f
or f
reeing it (if this is desirable). */
static inline void
hmap_replace(struct hmap *hmap,
static inline void
hmap_replace(struct hmap *hmap,
- const struct hmap_node *old
, struct hmap_node *new
)
+ const struct hmap_node *old
_node, struct hmap_node *new_node
)
{
{
- struct hmap_node **bucket = &hmap->buckets[old->hash & hmap->mask];
- while (*bucket != old) {
+ struct hmap_node **bucket = &hmap->buckets[old
_node
->hash & hmap->mask];
+ while (*bucket != old
_node
) {
bucket = &(*bucket)->next;
}
bucket = &(*bucket)->next;
}
- *bucket = new;
- new
->hash = old
->hash;
+ *bucket = new
_node
;
+ new
_node->hash = old_node
->hash;
}
static inline struct hmap_node *
}
static inline struct hmap_node *
@@
-259,4
+264,8
@@
hmap_next(const struct hmap *hmap, const struct hmap_node *node)
: hmap_next__(hmap, (node->hash & hmap->mask) + 1));
}
: hmap_next__(hmap, (node->hash & hmap->mask) + 1));
}
+#ifdef __cplusplus
+}
+#endif
+
#endif /* hmap.h */
#endif /* hmap.h */