mirror of
https://github.com/obgm/libcoap.git
synced 2026-10-31 23:15:48 +03:00
net.h: fixed ugly macro usage in coap_new_message_id()
context->message_id has been incremented as a side-effect of calling the htons macro. To avoid potential issues with this, the increment operation has been moved outside the macro call.
This commit is contained in:
1 parent
a4c163937a
commit
8a96bfa5c2
1 file changed
+3
-2
+3
-2
@@ -208,10 +208,11 @@ coap_context_t *coap_new_context(const coap_address_t *listen_addr);
|
||||
*/
|
||||
static inline unsigned short
|
||||
coap_new_message_id(coap_context_t *context) {
|
||||
context->message_id++;
|
||||
#ifndef WITH_CONTIKI
|
||||
return htons(++(context->message_id));
|
||||
return htons(context->message_id);
|
||||
#else /* WITH_CONTIKI */
|
||||
return uip_htons(++context->message_id);
|
||||
return uip_htons(context->message_id);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user