gnrc_pktbuf: add asserts

- fix static analyzer warning
    - update @pre doc accordingly
This commit is contained in:
smlng 2016-12-07 13:54:23 +01:00
parent ba23fb55f7
commit ad698267fb
2 changed files with 5 additions and 0 deletions

View File

@ -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*
*
* @pre `(len != NULL)`
*
* @details This function will create a new packet snip in the packet buffer,
* which points to the given *pkt* and contains a IOVEC representation
* of the referenced packet in its data section.

View File

@ -276,6 +276,7 @@ gnrc_pktsnip_t *gnrc_pktbuf_get_iovec(gnrc_pktsnip_t *pkt, size_t *len)
gnrc_pktsnip_t *head;
struct iovec *vec;
assert(len != NULL);
if (pkt == NULL) {
*len = 0;
return NULL;
@ -289,6 +290,8 @@ gnrc_pktsnip_t *gnrc_pktbuf_get_iovec(gnrc_pktsnip_t *pkt, size_t *len)
*len = 0;
return NULL;
}
assert(head->data != NULL);
vec = (struct iovec *)(head->data);
/* fill the IOVEC */
while (pkt != NULL) {