From: Ken Steele Date: Thu, 12 Sep 2013 20:39:07 +0000 (-0400) Subject: Move FlowIncrUsecnt to header file to allow for inlining. X-Git-Tag: suricata-2.0beta2~379 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d84079ba7dca5fbb8c3718afffdd90bea21b6fea;p=thirdparty%2Fsuricata.git Move FlowIncrUsecnt to header file to allow for inlining. Move FlowIncrUsecnt() and FlowDecrUsecnt() from flow.c to flow.h to allow for inlining. --- diff --git a/src/flow.c b/src/flow.c index f22e6ab80e..2b24d3298f 100644 --- a/src/flow.c +++ b/src/flow.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2007-2012 Open Information Security Foundation +/* Copyright (C) 2007-2013 Open Information Security Foundation * * You can copy, redistribute or modify this Program under the terms of * the GNU General Public License version 2 as published by the Free @@ -172,33 +172,6 @@ void FlowSetIPOnlyFlagNoLock(Flow *f, char direction) return; } -/** - * \brief increase the use cnt of a flow - * - * \param f flow to decrease use cnt for - */ -void FlowIncrUsecnt(Flow *f) -{ - if (f == NULL) - return; - - (void) SC_ATOMIC_ADD(f->use_cnt, 1); - return; -} -/** - * \brief decrease the use cnt of a flow - * - * \param f flow to decrease use cnt for - */ -void FlowDecrUsecnt(Flow *f) -{ - if (f == NULL) - return; - - (void) SC_ATOMIC_SUB(f->use_cnt, 1); - return; -} - /** * \brief determine the direction of the packet compared to the flow * \retval 0 to_server diff --git a/src/flow.h b/src/flow.h index 2afe4f8bf3..b94882cd7a 100644 --- a/src/flow.h +++ b/src/flow.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2007-2012 Open Information Security Foundation +/* Copyright (C) 2007-2013 Open Information Security Foundation * * You can copy, redistribute or modify this Program under the terms of * the GNU General Public License version 2 as published by the Free @@ -387,9 +387,6 @@ void FlowShutdown(void); void FlowSetIPOnlyFlag(Flow *, char); void FlowSetIPOnlyFlagNoLock(Flow *, char); -void FlowIncrUsecnt(Flow *); -void FlowDecrUsecnt(Flow *); - void FlowRegisterTests (void); int FlowSetProtoTimeout(uint8_t ,uint32_t ,uint32_t ,uint32_t); int FlowSetProtoEmergencyTimeout(uint8_t ,uint32_t ,uint32_t ,uint32_t); @@ -477,6 +474,32 @@ static inline void FlowSetSessionNoApplayerInspectionFlag(Flow *f) { f->flags |= FLOW_NO_APPLAYER_INSPECTION; } +/** + * \brief increase the use count of a flow + * + * \param f flow to decrease use count for + */ +static inline void FlowIncrUsecnt(Flow *f) +{ + if (f == NULL) + return; + + (void) SC_ATOMIC_ADD(f->use_cnt, 1); +} + +/** + * \brief decrease the use count of a flow + * + * \param f flow to decrease use count for + */ +static inline void FlowDecrUsecnt(Flow *f) +{ + if (f == NULL) + return; + + (void) SC_ATOMIC_SUB(f->use_cnt, 1); +} + #define FlowReference(dst_f_ptr, f) do { \ if ((f) != NULL) { \ FlowIncrUsecnt((f)); \