'if' statement replaced by a preprocessor directive.

This commit is contained in:
Salvatore Pitrulli 2011-05-12 21:50:47 +02:00
parent 28780dff57
commit 4fb433ac1f

View file

@ -633,7 +633,7 @@ send_packet(mac_callback_t mac_callback, void *mac_callback_ptr)
} }
packetbuf_set_attr(PACKETBUF_ATTR_MAC_ACK, 1); packetbuf_set_attr(PACKETBUF_ATTR_MAC_ACK, 1);
if(WITH_CONTIKIMAC_HEADER) { #if WITH_CONTIKIMAC_HEADER
hdrlen = packetbuf_totlen(); hdrlen = packetbuf_totlen();
if(packetbuf_hdralloc(sizeof(struct hdr)) == 0) { if(packetbuf_hdralloc(sizeof(struct hdr)) == 0) {
/* Failed to allocate space for contikimac header */ /* Failed to allocate space for contikimac header */
@ -653,7 +653,7 @@ send_packet(mac_callback_t mac_callback, void *mac_callback_ptr)
return MAC_TX_ERR_FATAL; return MAC_TX_ERR_FATAL;
} }
hdrlen += sizeof(struct hdr); hdrlen += sizeof(struct hdr);
} else { #else
/* Create the MAC header for the data packet. */ /* Create the MAC header for the data packet. */
hdrlen = NETSTACK_FRAMER.create(); hdrlen = NETSTACK_FRAMER.create();
if(hdrlen == 0) { if(hdrlen == 0) {
@ -661,7 +661,7 @@ send_packet(mac_callback_t mac_callback, void *mac_callback_ptr)
PRINTF("contikimac: send failed, too large header\n"); PRINTF("contikimac: send failed, too large header\n");
return MAC_TX_ERR_FATAL; return MAC_TX_ERR_FATAL;
} }
} #endif
/* Make sure that the packet is longer or equal to the shortest /* Make sure that the packet is longer or equal to the shortest