X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=include%2Fbabeltrace%2Fgraph%2Fport-const.h;fp=include%2Fbabeltrace%2Fgraph%2Fport-const.h;h=826ab02b034a456589e2807d42c798cc792b87fc;hb=c5b9b4417bedfbec9b5dd23b8395ccdd4eeffc44;hp=414c5ccde842163e279d4566631005b6b3d276c8;hpb=e2f7325d1e58710ee928373592adcee466f93d06;p=babeltrace.git diff --git a/include/babeltrace/graph/port-const.h b/include/babeltrace/graph/port-const.h index 414c5ccd..826ab02b 100644 --- a/include/babeltrace/graph/port-const.h +++ b/include/babeltrace/graph/port-const.h @@ -66,6 +66,23 @@ bt_bool bt_port_is_output(const struct bt_port *port) return bt_port_get_type(port) == BT_PORT_TYPE_OUTPUT; } +extern void bt_port_get_ref(const struct bt_port *port); + +extern void bt_port_put_ref(const struct bt_port *port); + +#define BT_PORT_PUT_REF_AND_RESET(_var) \ + do { \ + bt_port_put_ref(_var); \ + (_var) = NULL; \ + } while (0) + +#define BT_PORT_MOVE_REF(_var_dst, _var_src) \ + do { \ + bt_port_put_ref(_var_dst); \ + (_var_dst) = (_var_src); \ + (_var_src) = NULL; \ + } while (0) + #ifdef __cplusplus } #endif