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_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);