obj_swap macro <BLOC/object.h>

The obj_swap macro drops a reference to a specified object, and obtains and assigns another reference. It should be used whenever an object is unassigned from a variable, with a replacement object being given.

Syntax

#define obj_swap(v,o) ({ obj_put(v); v = obj_get(o); })

Parameters

v

The variable holding a reference to an object. This will be reassigned, so it should be the original variable and not a duplicate, in order for this macro to be useful.

o

The replacement object. The macro will obtain the new reference, so there is no need to take it before using the macro.