Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Declare promhttp_handler with the correct return type #79

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions promhttp/include/promhttp.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,15 @@
*/
void promhttp_set_active_collector_registry(prom_collector_registry_t *active_registry);

#if MHD_VERSION >= 0x00097002
#define PROM_MHD_RESULT enum MHD_Result
#else
#define PROM_MHD_RESULT int
#endif

PROM_MHD_RESULT promhttp_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, void **con_cls);

/**
* @brief Starts a daemon in the background and returns a pointer to an HMD_Daemon.
*
Expand Down
3 changes: 2 additions & 1 deletion promhttp/src/promhttp.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

#include "microhttpd.h"
#include "prom.h"
#include "promhttp.h"

prom_collector_registry_t *PROM_ACTIVE_REGISTRY;

Expand All @@ -29,7 +30,7 @@ void promhttp_set_active_collector_registry(prom_collector_registry_t *active_re
}
}

int promhttp_handler(void *cls, struct MHD_Connection *connection, const char *url, const char *method,
PROM_MHD_RESULT promhttp_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, void **con_cls) {
if (strcmp(method, "GET") != 0) {
char *buf = "Invalid HTTP Method\n";
Expand Down