MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / pbuf_clone

Function pbuf_clone

components/net/lwip/lwip-2.1.2/src/core/pbuf.c:1305–1318  ·  view source on GitHub ↗

* @ingroup pbuf * Allocates a new pbuf of same length (via pbuf_alloc()) and copies the source * pbuf into this new pbuf (using pbuf_copy()). * * @param layer pbuf_layer of the new pbuf * @param type this parameter decides how and where the pbuf should be allocated * (@see pbuf_alloc()) * @param p the source pbuf * * @return a new pbuf or NULL if allocation fails */

Source from the content-addressed store, hash-verified

1303 * @return a new pbuf or NULL if allocation fails
1304 */
1305struct pbuf *
1306pbuf_clone(pbuf_layer layer, pbuf_type type, struct pbuf *p)
1307{
1308 struct pbuf *q;
1309 err_t err;
1310 q = pbuf_alloc(layer, p->tot_len, type);
1311 if (q == NULL) {
1312 return NULL;
1313 }
1314 err = pbuf_copy(q, p);
1315 LWIP_UNUSED_ARG(err); /* in case of LWIP_NOASSERT */
1316 LWIP_ASSERT("pbuf_copy failed", err == ERR_OK);
1317 return q;
1318}
1319
1320#if LWIP_CHECKSUM_ON_COPY
1321/**

Callers 7

pbuf_coalesceFunction · 0.85
udp_inputFunction · 0.85
nd6_queue_packetFunction · 0.85
etharp_queryFunction · 0.85
zepif_linkoutputFunction · 0.85
vj_compress_tcpFunction · 0.85
recv_rawFunction · 0.85

Calls 2

pbuf_allocFunction · 0.70
pbuf_copyFunction · 0.70

Tested by

no test coverage detected