From ec6cfcaf227e0a7310cfaa9fcf5e0bd7716ac573 Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Fri, 28 Jan 2022 16:22:03 +0100 Subject: [PATCH] [network] enum connection_priority -> connection_priority_T --- src/network/connection.c | 18 +++++++++--------- src/network/connection.h | 4 ++-- src/network/state.h | 2 ++ src/protocol/test/stub.c | 2 +- src/session/download.h | 2 +- src/session/session.c | 2 +- src/session/session.h | 2 +- 7 files changed, 17 insertions(+), 15 deletions(-) diff --git a/src/network/connection.c b/src/network/connection.c index 8caa7fdba..cd60d7eb5 100644 --- a/src/network/connection.c +++ b/src/network/connection.c @@ -72,7 +72,7 @@ static INIT_LIST_OF(struct keepalive_connection, keepalive_connections); static void check_keepalive_connections(void); static void notify_connection_callbacks(struct connection *conn); -static /* inline */ enum connection_priority +static /* inline */ connection_priority_T get_priority(struct connection *conn) { int priority; @@ -215,11 +215,11 @@ static void check_queue_bugs(void) { struct connection *conn; - enum connection_priority prev_priority = 0; + connection_priority_T prev_priority = 0; int cc = 0; foreach (conn, connection_queue) { - enum connection_priority priority = get_priority(conn); + connection_priority_T priority = get_priority(conn); cc += conn->running; @@ -269,7 +269,7 @@ done_connection_socket(struct socket *socket, struct connection_state state) static struct connection * init_connection(struct uri *uri, struct uri *proxied_uri, struct uri *referrer, off_t start, enum cache_mode cache_mode, - enum connection_priority priority) + connection_priority_T priority) { static struct socket_operations connection_socket_operations = { set_connection_socket_state, @@ -496,7 +496,7 @@ static inline void add_to_queue(struct connection *conn) { struct connection *c; - enum connection_priority priority = get_priority(conn); + connection_priority_T priority = get_priority(conn); foreach (c, connection_queue) if (get_priority(c) > priority) @@ -801,7 +801,7 @@ retry_connection(struct connection *conn, struct connection_state state) static int try_to_suspend_connection(struct connection *conn, struct uri *uri) { - enum connection_priority priority = get_priority(conn); + connection_priority_T priority = get_priority(conn); struct connection *c; foreachback (c, connection_queue) { @@ -845,7 +845,7 @@ again: while (conn != (struct connection *) &connection_queue) { struct connection *c; - enum connection_priority pri = get_priority(conn); + connection_priority_T pri = get_priority(conn); for (c = conn; c != (struct connection *) &connection_queue && get_priority(c) == pri;) { struct connection *cc = c; @@ -889,7 +889,7 @@ register_check_queue(void) int load_uri(struct uri *uri, struct uri *referrer, struct download *download, - enum connection_priority pri, enum cache_mode cache_mode, off_t start) + connection_priority_T pri, enum cache_mode cache_mode, off_t start) { struct cache_entry *cached; struct connection *conn; @@ -1081,7 +1081,7 @@ cancel_download(struct download *download, int interrupt) void move_download(struct download *old, struct download *new_, - enum connection_priority newpri) + connection_priority_T newpri) { struct connection *conn; diff --git a/src/network/connection.h b/src/network/connection.h index a1b427628..32695d123 100644 --- a/src/network/connection.h +++ b/src/network/connection.h @@ -104,7 +104,7 @@ void retry_connection(struct connection *, struct connection_state); void cancel_download(struct download *download, int interrupt); void move_download(struct download *old, struct download *new_, - enum connection_priority newpri); + connection_priority_T newpri); void detach_connection(struct download *, off_t); void abort_all_connections(void); @@ -119,7 +119,7 @@ void shutdown_connection_stream(struct connection *conn); * that should be probably something else than data, but... ;-) */ /* Returns 0 on success and -1 on failure. */ int load_uri(struct uri *uri, struct uri *referrer, struct download *download, - enum connection_priority pri, enum cache_mode cache_mode, off_t start); + connection_priority_T pri, enum cache_mode cache_mode, off_t start); int is_entry_used(struct cache_entry *cached); diff --git a/src/network/state.h b/src/network/state.h index ea299fe4f..06a44d4b5 100644 --- a/src/network/state.h +++ b/src/network/state.h @@ -22,6 +22,8 @@ enum connection_priority { PRIORITIES, }; +typedef unsigned char connection_priority_T; + #define is_system_error(state) ((state).basic == S_ERRNO) #define is_in_state(state,basic_) ((state).basic == (basic_)) #define is_in_result_state(state) ((state).basic < 0) diff --git a/src/protocol/test/stub.c b/src/protocol/test/stub.c index 79262ce9e..53bf04658 100644 --- a/src/protocol/test/stub.c +++ b/src/protocol/test/stub.c @@ -88,7 +88,7 @@ get_user_program(struct terminal *term, char *progid, int progidlen) /* declared in "session/session.h" */ void print_error_dialog(struct session *ses, struct connection_state state, - struct uri *uri, enum connection_priority priority) + struct uri *uri, connection_priority_T priority) { stub_called("print_error_dialog"); } diff --git a/src/session/download.h b/src/session/download.h index 0fd657342..0db9090a1 100644 --- a/src/session/download.h +++ b/src/session/download.h @@ -63,7 +63,7 @@ struct download { struct connection_state state; struct connection_state prev_error; - enum connection_priority pri; + connection_priority_T pri; }; /** The user has navigated to a resource that ELinks does not display diff --git a/src/session/session.c b/src/session/session.c index 7180ea2f4..71d927bc4 100644 --- a/src/session/session.c +++ b/src/session/session.c @@ -288,7 +288,7 @@ retry_connection_without_verification(void *data) void print_error_dialog(struct session *ses, struct connection_state state, - struct uri *uri, enum connection_priority priority) + struct uri *uri, connection_priority_T priority) { struct string msg; char *uristring; diff --git a/src/session/session.h b/src/session/session.h index 2039be4b6..f2bd3be07 100644 --- a/src/session/session.h +++ b/src/session/session.h @@ -278,7 +278,7 @@ void set_session_referrer(struct session *ses, struct uri *referrer); void print_error_dialog(struct session *ses, struct connection_state state, - struct uri *uri, enum connection_priority priority); + struct uri *uri, connection_priority_T priority); void process_file_requests(struct session *);