From bb9eb3eaa03eecbf169489d3be83ddccf7b77815 Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Thu, 21 Apr 2016 15:03:24 +0200 Subject: trafgen: proto: Inline proto_current_header() into its only caller proto_lower_header() is the only caller for proto_current_header() which already checks header_count > 0, so inline proto_current_header() and omit the additional check and a panic() which thus can never be triggered. Signed-off-by: Tobias Klauser --- trafgen_proto.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'trafgen_proto.c') diff --git a/trafgen_proto.c b/trafgen_proto.c index 214547e..d0b5580 100644 --- a/trafgen_proto.c +++ b/trafgen_proto.c @@ -31,14 +31,6 @@ static size_t headers_count; static struct proto_hdr *registered; -static inline struct proto_hdr *proto_current_header(void) -{ - if (headers_count > 0) - return headers[headers_count - 1]; - - panic("No header was added\n"); -} - struct proto_hdr *proto_lower_header(struct proto_hdr *hdr) { struct proto_hdr *lower = NULL; @@ -161,7 +153,7 @@ struct proto_hdr *proto_lower_default_add(struct proto_hdr *hdr, struct proto_hdr *current; if (headers_count > 0) { - current = proto_current_header(); + current = headers[headers_count - 1]; if (current->layer >= proto_header_by_id(pid)->layer) goto set_proto; -- cgit v1.2.3-54-g00ecf