From 88e89d630232d0fa3d22f76179f237318fe9a217 Mon Sep 17 00:00:00 2001 From: Anoop Saldanha Date: Thu, 27 Sep 2012 14:40:07 +0530 Subject: [PATCH] Introduce utility flow macros to help referencing/dereferencing flows. --- src/flow-util.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/flow-util.h b/src/flow-util.h index e93b013a6a..a44a553a8d 100644 --- a/src/flow-util.h +++ b/src/flow-util.h @@ -127,6 +127,16 @@ #define FLOW_CHECK_MEMCAP(size) \ ((((uint64_t)SC_ATOMIC_GET(flow_memuse) + (uint64_t)(size)) <= flow_config.memcap)) +#define FlowReference(dst_f_ptr, f) do { \ + FlowIncrUsecnt((f)); \ + *(dst_f_ptr) = f; \ + } while (0) + +#define FlowDeReference(src_f_ptr) do { \ + FlowDecrUsecnt(*(src_f_ptr)); \ + *(src_f_ptr) = NULL; \ + } while (0) + Flow *FlowAlloc(void); Flow *FlowAllocDirect(void); void FlowFree(Flow *);