packetbuf: Use MIN macro

This commit is contained in:
kkrentz 2016-02-03 08:09:13 -08:00
parent 3d79292e44
commit 0af4a18c09

View File

@ -47,6 +47,7 @@
#include "contiki-net.h" #include "contiki-net.h"
#include "net/packetbuf.h" #include "net/packetbuf.h"
#include "net/rime/rime.h" #include "net/rime/rime.h"
#include "sys/cc.h"
struct packetbuf_attr packetbuf_attrs[PACKETBUF_NUM_ATTRS]; struct packetbuf_attr packetbuf_attrs[PACKETBUF_NUM_ATTRS];
struct packetbuf_addr packetbuf_addrs[PACKETBUF_NUM_ADDRS]; struct packetbuf_addr packetbuf_addrs[PACKETBUF_NUM_ADDRS];
@ -89,7 +90,7 @@ packetbuf_copyfrom(const void *from, uint16_t len)
uint16_t l; uint16_t l;
packetbuf_clear(); packetbuf_clear();
l = len > PACKETBUF_SIZE? PACKETBUF_SIZE: len; l = MIN(PACKETBUF_SIZE, len);
memcpy(packetbufptr, from, l); memcpy(packetbufptr, from, l);
buflen = l; buflen = l;
return l; return l;