From eb9157281b478b510e039a3eb8be41dfc64787cc Mon Sep 17 00:00:00 2001 From: Chewing_Bever Date: Fri, 3 Nov 2023 15:02:03 +0100 Subject: [PATCH] chore(http): rename step to http_step --- include/http_loop.h | 8 ++++---- src/http_loop/http_loop.c | 2 +- src/http_loop/http_loop_res.c | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/http_loop.h b/include/http_loop.h index fe13382..e05ee22 100644 --- a/include/http_loop.h +++ b/include/http_loop.h @@ -32,9 +32,9 @@ typedef enum http_route_type { * before the step can finish its processing. For response steps, `false` means * there's new data in the write buffer that needs to be written. */ -typedef bool (*step)(event_loop_conn *conn); +typedef bool (*http_step)(event_loop_conn *conn); -extern const step http_default_res_steps[HTTP_LOOP_MAX_STEPS]; +extern const http_step http_default_res_steps[HTTP_LOOP_MAX_STEPS]; /** * Struct describing a route a request can take. @@ -46,8 +46,8 @@ typedef struct http_route { // Compiled regex for a regex route. This value gets set at runtime when // starting the http loop regex_t *regex; - step steps[HTTP_LOOP_MAX_STEPS]; - step steps_res[HTTP_LOOP_MAX_STEPS]; + const http_step steps[HTTP_LOOP_MAX_STEPS]; + const http_step steps_res[HTTP_LOOP_MAX_STEPS]; } http_route; /** diff --git a/src/http_loop/http_loop.c b/src/http_loop/http_loop.c index d65ea1c..964992d 100644 --- a/src/http_loop/http_loop.c +++ b/src/http_loop/http_loop.c @@ -4,7 +4,7 @@ #include "http_loop.h" #include "log.h" -const step http_default_res_steps[HTTP_LOOP_MAX_STEPS] = { +const http_step http_default_res_steps[HTTP_LOOP_MAX_STEPS] = { http_loop_step_write_header, http_loop_step_write_body, NULL}; bool http_loop_handle_request(event_loop_conn *conn) { diff --git a/src/http_loop/http_loop_res.c b/src/http_loop/http_loop_res.c index cb372da..fec7cd9 100644 --- a/src/http_loop/http_loop_res.c +++ b/src/http_loop/http_loop_res.c @@ -106,7 +106,7 @@ void http_loop_handle_response(event_loop_conn *conn) { http_loop_ctx *ctx = conn->ctx; // Non-routed requests also need to be processed - const step *steps = + const http_step *steps = ctx->route != NULL ? ctx->route->steps_res : http_default_res_steps; while ((conn->state == event_loop_conn_state_res) &&