Convert Flow macros to inline functions

Convert FlowReference and FlowDeReference to inline functions for
better readability and to aid static code analyzers.
pull/694/head
Victor Julien 12 years ago
parent b4e6bbe4bc
commit 1476db44d9

@ -28,6 +28,7 @@
#include "util-var.h" #include "util-var.h"
#include "util-atomic.h" #include "util-atomic.h"
#include "detect-tag.h" #include "detect-tag.h"
#include "util-optimize.h"
#define FLOW_QUIET TRUE #define FLOW_QUIET TRUE
#define FLOW_VERBOSE FALSE #define FLOW_VERBOSE FALSE
@ -507,19 +508,19 @@ static inline void FlowDecrUsecnt(Flow *f)
(void) SC_ATOMIC_SUB(f->use_cnt, 1); (void) SC_ATOMIC_SUB(f->use_cnt, 1);
} }
#define FlowReference(dst_f_ptr, f) do { \ static inline void FlowReference(Flow **d, Flow *f) {
if ((f) != NULL) { \ if (likely(f != NULL)) {
FlowIncrUsecnt((f)); \ FlowIncrUsecnt(f);
*(dst_f_ptr) = f; \ *d = f;
} \ }
} while (0) }
#define FlowDeReference(src_f_ptr) do { \ static inline void FlowDeReference(Flow **d) {
if (*(src_f_ptr) != NULL) { \ if (likely(*d != NULL)) {
FlowDecrUsecnt(*(src_f_ptr)); \ FlowDecrUsecnt(*d);
*(src_f_ptr) = NULL; \ *d = NULL;
} \ }
} while (0) }
int FlowClearMemory(Flow *,uint8_t ); int FlowClearMemory(Flow *,uint8_t );

Loading…
Cancel
Save