replace another field access with a glue macro

This commit is contained in:
Sven M. Hallberg 2013-01-16 15:06:51 +01:00
parent 3412541370
commit a38d2e4ab0

View file

@ -2,7 +2,6 @@
#include <netinet/in.h> #include <netinet/in.h>
#include <err.h> #include <err.h>
#include <string.h> #include <string.h>
#include <assert.h>
#include "../src/hammer.h" #include "../src/hammer.h"
#include "dns_common.h" #include "dns_common.h"
#include "dns.h" #include "dns.h"
@ -29,8 +28,7 @@ bool is_zero(HParseResult *p) {
bool validate_dns(HParseResult *p) { bool validate_dns(HParseResult *p) {
if (TT_SEQUENCE != p->ast->token_type) if (TT_SEQUENCE != p->ast->token_type)
return false; return false;
assert(p->ast->seq->elements[0]->token_type == (HTokenType)TT_dns_header); dns_header_t *header = H_FIELD(dns_header, 0);
dns_header_t *header = (dns_header_t *)p->ast->seq->elements[0]->user;
size_t qd = header->question_count; size_t qd = header->question_count;
size_t an = header->answer_count; size_t an = header->answer_count;
size_t ns = header->authority_count; size_t ns = header->authority_count;