gnrc_pktbuf: add asserts
- fix static analyzer warning
- update @pre doc accordingly
This commit is contained in:
parent
ba23fb55f7
commit
ad698267fb
@ -191,6 +191,8 @@ gnrc_pktsnip_t *gnrc_pktbuf_start_write(gnrc_pktsnip_t *pkt);
|
|||||||
/**
|
/**
|
||||||
* @brief Create a IOVEC representation of the packet pointed to by *pkt*
|
* @brief Create a IOVEC representation of the packet pointed to by *pkt*
|
||||||
*
|
*
|
||||||
|
* @pre `(len != NULL)`
|
||||||
|
*
|
||||||
* @details This function will create a new packet snip in the packet buffer,
|
* @details This function will create a new packet snip in the packet buffer,
|
||||||
* which points to the given *pkt* and contains a IOVEC representation
|
* which points to the given *pkt* and contains a IOVEC representation
|
||||||
* of the referenced packet in its data section.
|
* of the referenced packet in its data section.
|
||||||
|
|||||||
@ -276,6 +276,7 @@ gnrc_pktsnip_t *gnrc_pktbuf_get_iovec(gnrc_pktsnip_t *pkt, size_t *len)
|
|||||||
gnrc_pktsnip_t *head;
|
gnrc_pktsnip_t *head;
|
||||||
struct iovec *vec;
|
struct iovec *vec;
|
||||||
|
|
||||||
|
assert(len != NULL);
|
||||||
if (pkt == NULL) {
|
if (pkt == NULL) {
|
||||||
*len = 0;
|
*len = 0;
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -289,6 +290,8 @@ gnrc_pktsnip_t *gnrc_pktbuf_get_iovec(gnrc_pktsnip_t *pkt, size_t *len)
|
|||||||
*len = 0;
|
*len = 0;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
assert(head->data != NULL);
|
||||||
vec = (struct iovec *)(head->data);
|
vec = (struct iovec *)(head->data);
|
||||||
/* fill the IOVEC */
|
/* fill the IOVEC */
|
||||||
while (pkt != NULL) {
|
while (pkt != NULL) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user