Fix warning in coap-observe

../..//apps/er-coap/er-coap-observe.c:237:15: warning: unused variable
‘content’ [-Wunused-variable]
This was caused by a buffer that was declared, but used only in
commented out code.
The variable was moved to the commented out block.
The block was surrounded by an #if 0 ... #endif to make it easier to
uncomment.
Everything still compiles with the code in question uncommented.
This commit is contained in:
Arthur Fabre 2015-07-16 10:25:10 +01:00
parent 8739113308
commit 158087db62

View file

@ -234,8 +234,6 @@ coap_observe_handler(resource_t *resource, void *request, void *response)
coap_packet_t *const coap_res = (coap_packet_t *)response; coap_packet_t *const coap_res = (coap_packet_t *)response;
coap_observer_t * obs; coap_observer_t * obs;
static char content[16];
if(coap_req->code == COAP_GET && coap_res->code < 128) { /* GET request and response without error code */ if(coap_req->code == COAP_GET && coap_res->code < 128) { /* GET request and response without error code */
if(IS_OPTION(coap_req, COAP_OPTION_OBSERVE)) { if(IS_OPTION(coap_req, COAP_OPTION_OBSERVE)) {
if(coap_req->observe == 0) { if(coap_req->observe == 0) {
@ -249,13 +247,14 @@ coap_observe_handler(resource_t *resource, void *request, void *response)
* A subscription should return the same representation as a normal GET. * A subscription should return the same representation as a normal GET.
* Uncomment if you want an information about the avaiable observers. * Uncomment if you want an information about the avaiable observers.
*/ */
/* #if 0
* coap_set_payload(coap_res, static char content[16];
* content, coap_set_payload(coap_res,
* snprintf(content, sizeof(content), "Added %u/%u", content,
* list_length(observers_list), snprintf(content, sizeof(content), "Added %u/%u",
* COAP_MAX_OBSERVERS)); list_length(observers_list),
*/ COAP_MAX_OBSERVERS));
#endif
} else { } else {
coap_res->code = SERVICE_UNAVAILABLE_5_03; coap_res->code = SERVICE_UNAVAILABLE_5_03;
coap_set_payload(coap_res, "TooManyObservers", 16); coap_set_payload(coap_res, "TooManyObservers", 16);