summaryrefslogtreecommitdiff
path: root/trafgen_parser.y
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2015-02-05 12:14:32 +0100
committerTobias Klauser <tklauser@distanz.ch>2015-02-05 12:14:32 +0100
commitdb20fa00ca9880e6e661befee92e19194fa5e69a (patch)
tree2f1832d48357c53e9285f870478cadaff663b4f4 /trafgen_parser.y
parent42e233eab7e6f5eb1a63545c526aa7dd34945bef (diff)
xmalloc: Make xrealloc() arguments conform to realloc()
xrealloc() has an additional nmemb argument compared to realloc() for which it should serve as a wrapper. Since we always call with nmemb = 1, we might as well remove this argument and thus have xrealloc() conform to the realloc() function prototype. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Diffstat (limited to 'trafgen_parser.y')
-rw-r--r--trafgen_parser.y26
1 files changed, 13 insertions, 13 deletions
diff --git a/trafgen_parser.y b/trafgen_parser.y
index ef753da..ee3d476 100644
--- a/trafgen_parser.y
+++ b/trafgen_parser.y
@@ -127,12 +127,12 @@ static void realloc_packet(void)
return;
plen++;
- packets = xrealloc(packets, 1, plen * sizeof(*packets));
+ packets = xrealloc(packets, plen * sizeof(*packets));
__init_new_packet_slot(&packets[packet_last]);
dlen++;
- packet_dyn = xrealloc(packet_dyn, 1, dlen * sizeof(*packet_dyn));
+ packet_dyn = xrealloc(packet_dyn, dlen * sizeof(*packet_dyn));
__init_new_counter_slot(&packet_dyn[packetd_last]);
__init_new_randomizer_slot(&packet_dyn[packetd_last]);
@@ -147,7 +147,7 @@ static void set_byte(uint8_t val)
return;
pkt->len++;
- pkt->payload = xrealloc(pkt->payload, 1, pkt->len);
+ pkt->payload = xrealloc(pkt->payload, pkt->len);
pkt->payload[payload_last] = val;
}
@@ -168,7 +168,7 @@ static void set_fill(uint8_t val, size_t len)
return;
pkt->len += len;
- pkt->payload = xrealloc(pkt->payload, 1, pkt->len);
+ pkt->payload = xrealloc(pkt->payload, pkt->len);
for (i = 0; i < len; ++i)
pkt->payload[payload_last - i] = val;
}
@@ -179,10 +179,10 @@ static void __set_csum16_dynamic(size_t from, size_t to, enum csum which)
struct packet_dyn *pktd = &packet_dyn[packetd_last];
pkt->len += 2;
- pkt->payload = xrealloc(pkt->payload, 1, pkt->len);
+ pkt->payload = xrealloc(pkt->payload, pkt->len);
pktd->slen++;
- pktd->csum = xrealloc(pktd->csum, 1, pktd->slen * sizeof(struct csum16));
+ pktd->csum = xrealloc(pktd->csum, pktd->slen * sizeof(struct csum16));
__setup_new_csum16(&pktd->csum[packetds_last], from, to, which);
}
@@ -236,7 +236,7 @@ static void set_rnd(size_t len)
return;
pkt->len += len;
- pkt->payload = xrealloc(pkt->payload, 1, pkt->len);
+ pkt->payload = xrealloc(pkt->payload, pkt->len);
for (i = 0; i < len; ++i)
pkt->payload[payload_last - i] = (uint8_t) rand();
}
@@ -250,7 +250,7 @@ static void set_sequential_inc(uint8_t start, size_t len, uint8_t stepping)
return;
pkt->len += len;
- pkt->payload = xrealloc(pkt->payload, 1, pkt->len);
+ pkt->payload = xrealloc(pkt->payload, pkt->len);
for (i = 0; i < len; ++i) {
off_t off = len - 1 - i;
@@ -268,7 +268,7 @@ static void set_sequential_dec(uint8_t start, size_t len, uint8_t stepping)
return;
pkt->len += len;
- pkt->payload = xrealloc(pkt->payload, 1, pkt->len);
+ pkt->payload = xrealloc(pkt->payload, pkt->len);
for (i = 0; i < len; ++i) {
int off = len - 1 - i;
@@ -286,10 +286,10 @@ static void set_dynamic_rnd(void)
return;
pkt->len++;
- pkt->payload = xrealloc(pkt->payload, 1, pkt->len);
+ pkt->payload = xrealloc(pkt->payload, pkt->len);
pktd->rlen++;
- pktd->rnd = xrealloc(pktd->rnd, 1, pktd->rlen * sizeof(struct randomizer));
+ pktd->rnd = xrealloc(pktd->rnd, pktd->rlen * sizeof(struct randomizer));
__setup_new_randomizer(&pktd->rnd[packetdr_last]);
}
@@ -304,10 +304,10 @@ static void set_dynamic_incdec(uint8_t start, uint8_t stop, uint8_t stepping,
return;
pkt->len++;
- pkt->payload = xrealloc(pkt->payload, 1, pkt->len);
+ pkt->payload = xrealloc(pkt->payload, pkt->len);
pktd->clen++;
- pktd->cnt =xrealloc(pktd->cnt, 1, pktd->clen * sizeof(struct counter));
+ pktd->cnt = xrealloc(pktd->cnt, pktd->clen * sizeof(struct counter));
__setup_new_counter(&pktd->cnt[packetdc_last], start, stop, stepping, type);
}