From f08497d1e4bdbccb5d5309ac08124974b0359c35 Mon Sep 17 00:00:00 2001 From: Anoop Saldanha Date: Fri, 5 Oct 2012 17:52:37 +0530 Subject: [PATCH] Move Flow Reference/Dereferene api from flow-util.h to flow.h. Remove duplicate FlowDeReference from decode.h --- src/decode.h | 11 ----------- src/flow-util.h | 17 ----------------- src/flow.h | 17 +++++++++++++++++ 3 files changed, 17 insertions(+), 28 deletions(-) diff --git a/src/decode.h b/src/decode.h index 4b097a2123..68333e4605 100644 --- a/src/decode.h +++ b/src/decode.h @@ -626,17 +626,6 @@ typedef struct DecodeThreadVars_ } #endif - -/* \todo there is another copy of this same macro inside flow-util.h. The - * reason we have this duplicate is because we couldn't solve endless - * header files cross-reference. */ -#define FlowDeReference(src_f_ptr) do { \ - if (*(src_f_ptr) != NULL) { \ - FlowDecrUsecnt(*(src_f_ptr)); \ - *(src_f_ptr) = NULL; \ - } \ - } while (0) - /** * \brief Recycle a packet structure for reuse. * \todo the mutex destroy & init is necessary because of the memset, reconsider diff --git a/src/flow-util.h b/src/flow-util.h index c6e15b3e21..e93b013a6a 100644 --- a/src/flow-util.h +++ b/src/flow-util.h @@ -127,23 +127,6 @@ #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 { \ - if ((f) != NULL) { \ - FlowIncrUsecnt((f)); \ - *(dst_f_ptr) = f; \ - } \ - } while (0) - -/* \todo there is another copy of this same macro inside decode.h. The reason - * we have this duplicate is because we couldn't solve endless header - * files cross-reference. */ -#define FlowDeReference(src_f_ptr) do { \ - if (*(src_f_ptr) != NULL) { \ - FlowDecrUsecnt(*(src_f_ptr)); \ - *(src_f_ptr) = NULL; \ - } \ - } while (0) - Flow *FlowAlloc(void); Flow *FlowAllocDirect(void); void FlowFree(Flow *); diff --git a/src/flow.h b/src/flow.h index 5b030eed56..5595110adf 100644 --- a/src/flow.h +++ b/src/flow.h @@ -481,6 +481,23 @@ static inline void FlowSetSessionNoApplayerInspectionFlag(Flow *f) { f->flags |= FLOW_NO_APPLAYER_INSPECTION; } +#define FlowReference(dst_f_ptr, f) do { \ + if ((f) != NULL) { \ + FlowIncrUsecnt((f)); \ + *(dst_f_ptr) = f; \ + } \ + } while (0) + +/* \todo there is another copy of this same macro inside decode.h. The reason + * we have this duplicate is because we couldn't solve endless header + * files cross-reference. */ +#define FlowDeReference(src_f_ptr) do { \ + if (*(src_f_ptr) != NULL) { \ + FlowDecrUsecnt(*(src_f_ptr)); \ + *(src_f_ptr) = NULL; \ + } \ + } while (0) + int FlowClearMemory(Flow *,uint8_t ); #endif /* __FLOW_H__ */