From: Eero Tamminen Date: Fri, 9 Jul 2021 15:43:38 +0000 (+0300) Subject: write_prometheus: annotate unused args and fix comments X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=de84e63cf9450a0107386f15bd753d0997f956d7;p=thirdparty%2Fcollectd.git write_prometheus: annotate unused args and fix comments Fix obsolete comment to match MHD docs: https://www.gnu.org/software/libmicrohttpd/ ("Queueing responses" section) https://git.gnunet.org/libmicrohttpd.git/tree/src/include/microhttpd.h#n2398 --- diff --git a/src/write_prometheus.c b/src/write_prometheus.c index 63845b23a..adf76ea63 100644 --- a/src/write_prometheus.c +++ b/src/write_prometheus.c @@ -179,7 +179,7 @@ static char *format_labels(char *buffer, size_t buffer_size, return buffer; } -/* format_protobuf iterates over all metric families in "metrics" and adds them +/* format_text iterates over all metric families in "metrics" and adds them * to a buffer in plain text format. */ static void format_text(ProtobufCBuffer *buffer) { pthread_mutex_lock(&metrics_lock); @@ -233,18 +233,20 @@ static void format_text(ProtobufCBuffer *buffer) { /* http_handler is the callback called by the microhttpd library. It essentially * handles all HTTP request aspects and creates an HTTP response. */ -static MHD_RESULT http_handler(void *cls, struct MHD_Connection *connection, - const char *url, const char *method, - const char *version, const char *upload_data, - size_t *upload_data_size, +static MHD_RESULT http_handler(__attribute__((unused)) void *cls, + struct MHD_Connection *connection, + __attribute__((unused)) const char *url, + const char *method, + __attribute__((unused)) const char *version, + __attribute__((unused)) const char *upload_data, + __attribute__((unused)) size_t *upload_data_size, void **connection_state) { if (strcmp(method, MHD_HTTP_METHOD_GET) != 0) { return MHD_NO; } - /* On the first call for each connection, return without anything further. - * Apparently not everything has been initialized yet or so; the docs are not - * very specific on the issue. */ + /* According to documentation, first call for each connection is after headers + * have been parsed, and should be used only for reporting errors */ if (*connection_state == NULL) { /* keep track of connection state */ *connection_state = &"called";