Move FlowIncrUsecnt to header file to allow for inlining.

Move FlowIncrUsecnt() and FlowDecrUsecnt() from flow.c to flow.h to
allow for inlining.
pull/547/merge
Ken Steele 12 years ago committed by Victor Julien
parent e05034f5dd
commit d84079ba7d

@ -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

@ -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)); \

Loading…
Cancel
Save