summaryrefslogtreecommitdiff
path: root/lib/simap.h
Commit message (Collapse)AuthorAgeFilesLines
* simap: New function simap_equal().Ben Pfaff2017-05-051-1/+2
| | | | | | This will acquire a user in an upcoming commit. Signed-off-by: Ben Pfaff <blp@ovn.org>
* json: Move from lib to include/openvswitch.Terry Wilson2016-07-221-1/+1
| | | | | | | | | | | | | | | To easily allow both in- and out-of-tree building of the Python wrapper for the OVS JSON parser (e.g. w/ pip), move json.h to include/openvswitch. This also requires moving lib/{hmap,shash}.h. Both hmap.h and shash.h were #include-ing "util.h" even though the headers themselves did not use anything from there, but rather from include/openvswitch/util.h. Fixing that required including util.h in several C files mostly due to OVS_NOT_REACHED and things like xmalloc. Signed-off-by: Terry Wilson <twilson@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* hmap: Add extra build-time iteration checks for types derived from hmap.Ben Pfaff2016-02-191-5/+10
| | | | | | | | | | | | | | | | | | | | | | | | | Some of our data structures derived from hmap use the same member names. This means it's possible to confuse them in iteration, e.g. to iterate a shash with SIMAP_FOR_EACH. Of course this will crash at runtime, but it seems even better to catch it at compile time. An alternative would be to use unique member names, e.g. shash_map and simap_map instead of just map. I like short names, though. It's kind of nasty that we need support from the hmap code to do this. An alternative would be to insert the build assertions as statements before the for loop. But that would cause nasty surprises if someone forgets the {} around a block of statements; even though the OVS coding style requires them in all cases, I suspect that programmers doing debugging, etc. tend to omit them sometimes. It's not actually necessary to have multiple variants of these macros, e.g. one can write a C99-compliant HMAP_FOR_EACH that accepts 3 or 4 or more arguments. But such a macro is harder to read, so I don't know whether this is a good tradeoff. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Andy Zhou <azhou@ovn.org>
* vxlan: Add utility functions to the simap data structure.Kyle Mestery2013-02-141-0/+2
| | | | | | | | | Add utility functions to the simap structure. These are used by future patches in this seris. The functions added are. Signed-off-by: Kyle Mestery <kmestery@cisco.com> Acked-by: Ethan Jackson <ethan@nicira.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* simap: New data structure for string-to-integer maps.Ben Pfaff2012-05-221-0/+70
This commit adapts a couple of existing pieces of code to use the new data structure. The following commit will add another user (which is also the first use of the simap_increas() function). Signed-off-by: Ben Pfaff <blp@nicira.com>