Skip to content

Commit

Permalink
WIP - Remove unused context pointer in endpoint and use NTOHS macro e…
Browse files Browse the repository at this point in the history
…verywhere
  • Loading branch information
franc0is committed Sep 7, 2015
1 parent f8d2b79 commit b8df045
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 10 deletions.
2 changes: 0 additions & 2 deletions include/coap/coap_io.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@ typedef struct coap_endpoint_t {

#ifdef WITH_LWIP
struct udp_pcb *pcb;
/**< @FIXME this was added in a hurry, not sure it confirms to the overall model --chrysn */
struct coap_context_t *context;
#endif /* WITH_LWIP */

coap_address_t addr; /**< local interface address */
Expand Down
1 change: 1 addition & 0 deletions platform/contiki/platform_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
#define _PLATFORM_UTILS_H_

#define HTONS(BYTES) uip_htons(BYTES);
#define NTOHS(BYTES) uip_ntohs(BYTES);

#endif /* _PLATFORM_UTILS_H_ */
1 change: 1 addition & 0 deletions platform/lwip/platform_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
#define _PLATFORM_UTILS_H_

#define HTONS(BYTES) htons(BYTES);
#define NTOHS(BYTES) ntohs(BYTES);

#endif /* _PLATFORM_UTILS_H_ */
3 changes: 0 additions & 3 deletions src/coap_context.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,6 @@ coap_new_context(
coap_register_option(c, COAP_OPTION_BLOCK1);

c->endpoint = coap_new_endpoint(listen_addr, COAP_ENDPOINT_NOSEC);
#ifdef WITH_LWIP
c->endpoint->context = c;
#endif
if (c->endpoint == NULL) {
goto onerror;
}
Expand Down
6 changes: 1 addition & 5 deletions src/pdu.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,7 @@ coap_pdu_t *
coap_new_pdu(void) {
coap_pdu_t *pdu;

#ifndef WITH_CONTIKI
pdu = coap_pdu_init(0, 0, ntohs(COAP_INVALID_TID), COAP_MAX_PDU_SIZE);
#else /* WITH_CONTIKI */
pdu = coap_pdu_init(0, 0, uip_ntohs(COAP_INVALID_TID), COAP_MAX_PDU_SIZE);
#endif /* WITH_CONTIKI */
pdu = coap_pdu_init(0, 0, NTOHS(COAP_INVALID_TID), COAP_MAX_PDU_SIZE);

#ifndef NDEBUG
if (!pdu)
Expand Down

0 comments on commit b8df045

Please sign in to comment.