From dc2ac62da99712b8f3d7ecf0fbf9904e143869e1 Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Wed, 14 Oct 2015 11:24:38 +0200 Subject: trafgen: Move checking of dynamic packet elements to header Move has_dynamic_elems() to to trafgen_conf.h, rename it to packet_dyn_has_elems() and use it to check whether dynamic packet elements are present. Also change the return type to bool and use || instead of + to potentially make use of short-circuit evaluation. Signed-off-by: Tobias Klauser --- trafgen_conf.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'trafgen_conf.h') diff --git a/trafgen_conf.h b/trafgen_conf.h index aee385e..d2df1f4 100644 --- a/trafgen_conf.h +++ b/trafgen_conf.h @@ -45,6 +45,11 @@ struct packet_dyn { size_t slen; }; +static inline bool packet_dyn_has_elems(struct packet_dyn *p) +{ + return (p->rlen || p->slen || p->clen); +} + extern void compile_packets(char *file, bool verbose, unsigned int cpu, bool invoke_cpp); extern void cleanup_packets(void); -- cgit v1.2.3-54-g00ecf