2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 06:15:47 +00:00

util: Introduce ASSIGN_CONTAINER to make iteration macros easier to read.

This commit is contained in:
Ben Pfaff
2010-11-17 14:25:33 -08:00
parent 7c9b00732c
commit 772ec52b89
4 changed files with 35 additions and 37 deletions

View File

@@ -101,6 +101,14 @@ extern const char *program_name;
((OVS_TYPEOF(OBJECT)) (void *) \
((char *) (POINTER) - ((char *) &(OBJECT)->MEMBER - (char *) (OBJECT))))
/* Given POINTER, the address of the given MEMBER within an object of the type
* that that OBJECT points to, assigns the address of the outer object to
* OBJECT, which must be an lvalue.
*
* Evaluates to 1. */
#define ASSIGN_CONTAINER(OBJECT, POINTER, MEMBER) \
((OBJECT) = OBJECT_CONTAINING(POINTER, OBJECT, MEMBER), 1)
#ifdef __cplusplus
extern "C" {
#endif