lib: make public reference count functions have strict types
[babeltrace.git] / include / babeltrace / trace-ir / packet-const.h
index 197b43f5d813136e7708d526f8933bfc9634b75b..3aee95ec60c194badfc0c385efe8c49b70c325ea 100644 (file)
@@ -2,7 +2,7 @@
 #define BABELTRACE_TRACE_IR_PACKET_CONST_H
 
 /*
- * Copyright 2016 Philippe Proulx <pproulx@efficios.com>
+ * Copyright 2016-2018 Philippe Proulx <pproulx@efficios.com>
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -73,6 +73,23 @@ extern
 enum bt_property_availability bt_packet_get_packet_counter_snapshot(
                const struct bt_packet *packet, uint64_t *value);
 
+extern void bt_packet_get_ref(const struct bt_packet *packet);
+
+extern void bt_packet_put_ref(const struct bt_packet *packet);
+
+#define BT_PACKET_PUT_REF_AND_RESET(_var)              \
+       do {                                            \
+               bt_packet_put_ref(_var);                \
+               (_var) = NULL;                          \
+       } while (0)
+
+#define BT_PACKET_MOVE_REF(_var_dst, _var_src)         \
+       do {                                            \
+               bt_packet_put_ref(_var_dst);            \
+               (_var_dst) = (_var_src);                \
+               (_var_src) = NULL;                      \
+       } while (0)
+
 #ifdef __cplusplus
 }
 #endif
This page took 0.034126 seconds and 4 git commands to generate.