🎈 perf(pacekt and tcp_segment init): reduce memset
This commit is contained in:
@@ -32,13 +32,7 @@ struct tcp_reassembly
|
||||
|
||||
struct tcp_segment *tcp_segment_new(uint32_t seq, const void *data, uint32_t len)
|
||||
{
|
||||
struct tcp_segment_private *p = (struct tcp_segment_private *)calloc(1, sizeof(struct tcp_segment_private) + len);
|
||||
if (!p)
|
||||
{
|
||||
TCP_REASSEMBLY_LOG_ERROR("calloc failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct tcp_segment_private *p = (struct tcp_segment_private *)malloc(sizeof(struct tcp_segment_private) + len);
|
||||
p->node.start = seq;
|
||||
p->node.last = (uint64_t)seq + (uint64_t)len - 1;
|
||||
p->data = (char *)p + sizeof(struct tcp_segment_private);
|
||||
|
||||
Reference in New Issue
Block a user