diff options
author | Tobias Klauser <tklauser@distanz.ch> | 2015-10-14 11:24:38 +0200 |
---|---|---|
committer | Tobias Klauser <tklauser@distanz.ch> | 2015-10-14 11:24:38 +0200 |
commit | dc2ac62da99712b8f3d7ecf0fbf9904e143869e1 (patch) | |
tree | ca81ab6b4512637c81f705b45cd3fb453b78c402 /trafgen_parser.y | |
parent | 68bc34c0e88b6eff8279201bdc2d16dab7a4dd68 (diff) |
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 <tklauser@distanz.ch>
Diffstat (limited to 'trafgen_parser.y')
-rw-r--r-- | trafgen_parser.y | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/trafgen_parser.y b/trafgen_parser.y index 8eab614..88daf7a 100644 --- a/trafgen_parser.y +++ b/trafgen_parser.y @@ -66,11 +66,6 @@ static inline int test_ignore(void) return 1; } -static inline int has_dynamic_elems(struct packet_dyn *p) -{ - return (p->rlen + p->slen + p->clen); -} - static inline void __init_new_packet_slot(struct packet *slot) { slot->payload = NULL; @@ -230,7 +225,7 @@ static void set_csum16(size_t from, size_t to, enum csum which) bug_on(!(from < to)); - if (has_dynamic_elems(pktd) || to >= pkt->len || is_dynamic_csum(which)) + if (packet_dyn_has_elems(pktd) || to >= pkt->len || is_dynamic_csum(which)) __set_csum16_dynamic(from, to, which); else __set_csum16_static(from, to, which); |