summaryrefslogtreecommitdiff
path: root/trafgen_parser.y
diff options
context:
space:
mode:
authorVadim Kochan <vadim4j@gmail.com>2017-07-29 12:46:08 +0300
committerTobias Klauser <tklauser@distanz.ch>2017-08-10 09:03:37 +0200
commit19348cec323373d84674c1d2cf34315cbf47c80d (patch)
tree3dd13803e6f9b2e84ff85b90b17a9cbc97bc93ea /trafgen_parser.y
parentd55874b960a8663cc86284fad4d0472ff37b7a7e (diff)
trafgen: dev_io: Change read/write to specify struct packet *
Refactor dev_io_ops read & write to specify struct packet *, it may simplify a bit a caller logic. And it allow to keep required members within one struct packet object. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Diffstat (limited to 'trafgen_parser.y')
-rw-r--r--trafgen_parser.y6
1 files changed, 4 insertions, 2 deletions
diff --git a/trafgen_parser.y b/trafgen_parser.y
index 656c4f6..74015b5 100644
--- a/trafgen_parser.y
+++ b/trafgen_parser.y
@@ -167,10 +167,10 @@ static inline void __setup_new_csum16(struct csum16 *s, off_t from, off_t to,
s->which = which;
}
-void realloc_packet(void)
+struct packet *realloc_packet(void)
{
if (test_ignore())
- return;
+ return NULL;
plen++;
packets = xrealloc(packets, plen * sizeof(*packets));
@@ -184,6 +184,8 @@ void realloc_packet(void)
__init_new_randomizer_slot(&packet_dyn[packetd_last]);
__init_new_csum_slot(&packet_dyn[packetd_last]);
__init_new_fields_slot(&packet_dyn[packetd_last]);
+
+ return &packets[packet_last];
}
struct packet *current_packet(void)