]> git.ipfire.org Git - thirdparty/collectd.git/commitdiff
write_prometheus: annotate unused args and fix comments
authorEero Tamminen <eero.t.tamminen@intel.com>
Fri, 9 Jul 2021 15:43:38 +0000 (18:43 +0300)
committerEero Tamminen <eero.t.tamminen@intel.com>
Tue, 16 Jan 2024 13:02:29 +0000 (15:02 +0200)
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

src/write_prometheus.c

index 63845b23a931f9a5ab83383851ea90b7218fe5d2..adf76ea632a6df062d8bcb4991ef66caf8c3ccb4 100644 (file)
@@ -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";