projects
/
openvswitch
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
datapath: Avoid __copy_to/from_user(), __get/put_user() functions.
[openvswitch]
/
lib
/
hmap.c
diff --git
a/lib/hmap.c
b/lib/hmap.c
index d66cf271a27e492f3b030d0aeabdeffb241d49f2..71943a74e6e092f5c2f2aba4fac1be4f52137b49 100644
(file)
--- a/
lib/hmap.c
+++ b/
lib/hmap.c
@@
-48,11
+48,17
@@
hmap_swap(struct hmap *a, struct hmap *b)
struct hmap tmp = *a;
*a = *b;
*b = tmp;
struct hmap tmp = *a;
*a = *b;
*b = tmp;
- if (a->buckets == &b->one) {
- a->buckets = &a->one;
- }
- if (b->buckets == &a->one) {
- b->buckets = &b->one;
+ hmap_moved(a);
+ hmap_moved(b);
+}
+
+/* Adjusts 'hmap' to compensate for having moved position in memory (e.g. due
+ * to realloc()). */
+void
+hmap_moved(struct hmap *hmap)
+{
+ if (!hmap->mask) {
+ hmap->buckets = &hmap->one;
}
}
}
}