X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=include%2Fbabeltrace%2Fctf-ir%2Fref.h;h=acc89d175b6ddda805cb5f686cea04ff8cb6fe8c;hb=e693822d3c00dbca7336ee2f9ba8f756599c7a3b;hp=fa612ca0a9ed33174952dce36a2c5e0f36b12b76;hpb=de3dd40e6fcad56e227f5fc8a8290fbaa88b4e07;p=babeltrace.git diff --git a/include/babeltrace/ctf-ir/ref.h b/include/babeltrace/ctf-ir/ref.h index fa612ca0..acc89d17 100644 --- a/include/babeltrace/ctf-ir/ref.h +++ b/include/babeltrace/ctf-ir/ref.h @@ -50,6 +50,22 @@ (_obj) = NULL; \ } while (0) +/* + * BT_CTF_MOVE: moves the ownership of a CTF object, setting the old + * owner to NULL. + * + * This macro sets the variable _dst to the value of the variable _src, + * then sets _src to NULL, effectively moving the ownership of a CTF + * object from one variable to the other. + * + * @param obj CTF IR object. + */ +#define BT_CTF_MOVE(_dst, _src) \ + do { \ + (_dst) = (_src); \ + (_src) = NULL; \ + } while (0) + /* * bt_ctf_get: increments the reference count of a CTF IR object. *