commit f41df3ff9e7df8ba154e882f02acdcfa881f35c7
parent 9e95f5ce06dfd3bb193c98d31b8cb7046736b9b8
Author: Yersa Nordman <yersa@finwo.nl>
Date: Sat, 8 Jul 2023 22:34:01 +0200
Mark method/path as const, we're not changing them
Diffstat:
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/http-server.c b/src/http-server.c
@@ -14,8 +14,8 @@ struct evio_udata {
struct hs_route {
void *next;
- char *method;
- char *path;
+ const char *method;
+ const char *path;
void (*fn)(struct hs_udata*);
};
@@ -112,7 +112,7 @@ void http_server_response_send(struct hs_udata *hsdata, bool close) {
}
}
-void http_server_route(char *method, char *path, void (*fn)(struct hs_udata*)) {
+void http_server_route(const char *method, const char *path, void (*fn)(struct hs_udata*)) {
struct hs_route *route = calloc(1, sizeof(struct hs_route));
route->next = registered_routes;
route->method = method;
diff --git a/src/http-server.h b/src/http-server.h
@@ -19,7 +19,7 @@ struct http_server_events {
};
void http_server_response_send(struct hs_udata *hsdata, bool close);
-void http_server_route(char *method, char *path, void (*fn)(struct hs_udata*));
+void http_server_route(const char *method, const char *path, void (*fn)(struct hs_udata*));
void http_server_main(char **addrs, int naddrs, struct http_server_events *hsevs, void *udata);
#endif // __FINWO_HTTP_SERVER_H__