From 158087db626b19c868d078fa7712e993aeeabaa8 Mon Sep 17 00:00:00 2001 From: Arthur Fabre Date: Thu, 16 Jul 2015 10:25:10 +0100 Subject: [PATCH] Fix warning in coap-observe MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ../..//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. --- apps/er-coap/er-coap-observe.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/apps/er-coap/er-coap-observe.c b/apps/er-coap/er-coap-observe.c index 4e3d2baa1..710671bff 100644 --- a/apps/er-coap/er-coap-observe.c +++ b/apps/er-coap/er-coap-observe.c @@ -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_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(IS_OPTION(coap_req, COAP_OPTION_OBSERVE)) { 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. * Uncomment if you want an information about the avaiable observers. */ - /* - * coap_set_payload(coap_res, - * content, - * snprintf(content, sizeof(content), "Added %u/%u", - * list_length(observers_list), - * COAP_MAX_OBSERVERS)); - */ +#if 0 + static char content[16]; + coap_set_payload(coap_res, + content, + snprintf(content, sizeof(content), "Added %u/%u", + list_length(observers_list), + COAP_MAX_OBSERVERS)); +#endif } else { coap_res->code = SERVICE_UNAVAILABLE_5_03; coap_set_payload(coap_res, "TooManyObservers", 16);