[riot-devel] pktbuf question

Kaspar Schleiser kaspar at schleiser.de
Tue Jun 16 23:00:05 CEST 2015


(this goes probably to Martine)

The docs of ng_pktbuf_add say:

"If @p data is already in the packet buffer (e.g. a payload of an
already allocated packet) it will not be duplicated."

Does this check for pointer equality, or would it correctly de-duplicate
the snip if I add e.g., just the end of a packet a second time?

pkt = ng_pktbuf_add(0,0,size,undef);
memcpy(pkt->data, src, size);

payload = ng_pktbuf_add(pkt, pkt->data + hdr_size, size-hdr_size, hdr_type);

Would this allocate the space for pkt->data + hdr_size a second time?


More information about the devel mailing list