gcoap: add asserts for path in gcoap_req_init
This commit is contained in:
parent
c9e9f72454
commit
b9ca8f466f
@ -506,6 +506,9 @@ void gcoap_register_listener(gcoap_listener_t *listener);
|
||||
* @param[in] code Request code: GCOAP_[GET|POST|PUT|DELETE]
|
||||
* @param[in] path Resource path, *must* start with '/'
|
||||
*
|
||||
* @pre @p path not `NULL`
|
||||
* @pre @p path must start with `/`
|
||||
*
|
||||
* @return 0 on success
|
||||
* @return < 0 on error
|
||||
*/
|
||||
|
||||
@ -22,6 +22,7 @@
|
||||
#include <stdint.h>
|
||||
#include <stdatomic.h>
|
||||
|
||||
#include "assert.h"
|
||||
#include "net/gcoap.h"
|
||||
#include "mutex.h"
|
||||
#include "random.h"
|
||||
@ -718,6 +719,8 @@ void gcoap_register_listener(gcoap_listener_t *listener)
|
||||
int gcoap_req_init(coap_pkt_t *pdu, uint8_t *buf, size_t len,
|
||||
unsigned code, const char *path)
|
||||
{
|
||||
assert((path != NULL) && (path[0] == '/'));
|
||||
|
||||
(void)len;
|
||||
|
||||
pdu->hdr = (coap_hdr_t *)buf;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user