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:
@@ -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
|
||||
|
Reference in New Issue
Block a user