1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-06-14 23:32:27 +00:00

[cache] enum cache_mode -> cache_mode_T

This commit is contained in:
Witold Filipczyk 2022-01-28 17:32:27 +01:00
parent 2b9f3d5cf9
commit 44f0adb1cb
13 changed files with 32 additions and 30 deletions

2
src/cache/cache.c vendored
View File

@ -174,7 +174,7 @@ cache_entry_has_expired(struct cache_entry *cached)
}
struct cache_entry *
get_validated_cache_entry(struct uri *uri, enum cache_mode cache_mode)
get_validated_cache_entry(struct uri *uri, cache_mode_T cache_mode)
{
struct cache_entry *cached;

6
src/cache/cache.h vendored
View File

@ -27,6 +27,8 @@ enum cache_mode {
CACHE_MODE_NEVER,
};
typedef int cache_mode_T;
struct cache_entry {
OBJECT_HEAD(struct cache_entry);
@ -72,7 +74,7 @@ struct cache_entry {
unsigned int gc_target:1; /* The GC touch of death */
unsigned int cgi:1; /* Is a CGI output? */
enum cache_mode cache_mode; /* Reload condition */
cache_mode_T cache_mode; /* Reload condition */
};
struct fragment {
@ -95,7 +97,7 @@ struct cache_entry *get_cache_entry(struct uri *uri);
/* Searches the cache for a matching entry and checks if it is still valid and
* usable. Returns NULL if the @cache_mode suggests to reload it again. */
struct cache_entry *get_validated_cache_entry(struct uri *uri, enum cache_mode cache_mode);
struct cache_entry *get_validated_cache_entry(struct uri *uri, cache_mode_T cache_mode);
/* Checks if a dangling cache entry pointer is still valid. */
int cache_entry_is_valid(struct cache_entry *cached);

2
src/cache/dialogs.c vendored
View File

@ -139,7 +139,7 @@ get_cache_entry_info(struct listbox_item *item, struct terminal *term)
case CACHE_MODE_NORMAL:
case CACHE_MODE_CHECK_IF_MODIFIED:
case CACHE_MODE_FORCE_RELOAD:
/* Cache entries only use two values of enum cache_mode. */
/* Cache entries only use two values of cache_mode_T. */
INTERNAL("cached->cache_mode = %d", cached->cache_mode);
break;
}

View File

@ -630,7 +630,7 @@ add_cmdline_bool_option(struct string *string, char *name)
void
open_uri_in_new_window(struct session *ses, struct uri *uri, struct uri *referrer,
enum term_env_type env, enum cache_mode cache_mode,
enum term_env_type env, cache_mode_T cache_mode,
enum task_type task)
{
int ring = get_cmd_opt_int("session-ring");

View File

@ -35,7 +35,7 @@ void save_url_as(struct session *ses);
void
open_uri_in_new_window(struct session *ses, struct uri *uri, struct uri *referrer,
enum term_env_type env, enum cache_mode cache_mode,
enum term_env_type env, cache_mode_T cache_mode,
enum task_type task);
void send_open_new_window(struct terminal *term, const struct open_in_new *open, struct session *ses);

View File

@ -268,7 +268,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,
off_t start, cache_mode_T cache_mode,
connection_priority_T priority)
{
static struct socket_operations connection_socket_operations = {
@ -889,7 +889,7 @@ register_check_queue(void)
int
load_uri(struct uri *uri, struct uri *referrer, struct download *download,
connection_priority_T pri, enum cache_mode cache_mode, off_t start)
connection_priority_T pri, cache_mode_T cache_mode, off_t start)
{
struct cache_entry *cached;
struct connection *conn;

View File

@ -38,7 +38,7 @@ struct connection {
struct uri *referrer;
/* Cache information. */
enum cache_mode cache_mode;
cache_mode_T cache_mode;
struct cache_entry *cached;
off_t from; /* Position for new data in the cache entry. */
@ -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,
connection_priority_T pri, enum cache_mode cache_mode, off_t start);
connection_priority_T pri, cache_mode_T cache_mode, off_t start);
int is_entry_used(struct cache_entry *cached);

View File

@ -85,7 +85,7 @@ struct session_info {
struct uri *uri;
struct uri *referrer;
enum task_type task;
enum cache_mode cache_mode;
cache_mode_T cache_mode;
};
#define file_to_load_is_active(ftl) ((ftl)->req_sent && is_in_progress_state((ftl)->download.state))
@ -161,7 +161,7 @@ session_info_timeout(int id)
int
add_session_info(struct session *ses, struct uri *uri, struct uri *referrer,
enum cache_mode cache_mode, enum task_type task)
cache_mode_T cache_mode, enum task_type task)
{
struct session_info *info = (struct session_info *)mem_calloc(1, sizeof(*info));
@ -868,7 +868,7 @@ request_additional_file(struct session *ses, char *name, struct uri *uri, int pr
}
static void
load_additional_file(struct file_to_load *ftl, enum cache_mode cache_mode)
load_additional_file(struct file_to_load *ftl, cache_mode_T cache_mode)
{
struct document_view *doc_view = current_frame(ftl->ses);
struct uri *referrer = doc_view && doc_view->document
@ -1398,14 +1398,14 @@ destroy_session(struct session *ses)
}
void
reload(struct session *ses, enum cache_mode cache_mode)
reload(struct session *ses, cache_mode_T cache_mode)
{
reload_frame(ses, NULL, cache_mode);
}
void
reload_frame(struct session *ses, char *name,
enum cache_mode cache_mode)
cache_mode_T cache_mode)
{
abort_loading(ses, 0);

View File

@ -292,7 +292,7 @@ int decode_session_info(struct terminal *term, struct terminal_info *info);
/** Registers a base session and returns its id. Value <= 0 means error. */
int
add_session_info(struct session *ses, struct uri *uri, struct uri *referrer,
enum cache_mode cache_mode, enum task_type task);
cache_mode_T cache_mode, enum task_type task);
void done_saved_session_info(void);
@ -302,8 +302,8 @@ struct session *init_session(struct session *ses, struct terminal *term,
void doc_loading_callback(struct download *, struct session *);
void abort_loading(struct session *, int);
void reload_frame(struct session *, char *, enum cache_mode);
void reload(struct session *, enum cache_mode);
void reload_frame(struct session *, char *, cache_mode_T);
void reload(struct session *, cache_mode_T);
void load_frames(struct session *, struct document_view *);
struct frame *ses_find_frame(struct session *, char *);

View File

@ -77,13 +77,13 @@ abort_preloading(struct session *ses, int interrupt)
struct task {
struct session *ses;
struct uri *uri;
enum cache_mode cache_mode;
cache_mode_T cache_mode;
struct session_task session_task;
};
void
ses_load(struct session *ses, struct uri *uri, char *target_frame,
struct location *target_location, enum cache_mode cache_mode,
struct location *target_location, cache_mode_T cache_mode,
enum task_type task_type)
{
ses->loading.callback = (download_callback_T *) loading_callback;
@ -175,7 +175,7 @@ check_malicious_uri(struct uri *uri)
void
ses_goto(struct session *ses, struct uri *uri, char *target_frame,
struct location *target_location, enum cache_mode cache_mode,
struct location *target_location, cache_mode_T cache_mode,
enum task_type task_type, int redir)
{
/* [gettext_accelerator_context(ses_goto)] */
@ -583,7 +583,7 @@ end:
static void
do_follow_url(struct session *ses, struct uri *uri, char *target,
enum task_type task, enum cache_mode cache_mode, int do_referrer)
enum task_type task, cache_mode_T cache_mode, int do_referrer)
{
struct uri *referrer = NULL;
protocol_external_handler_T *external_handler;
@ -648,7 +648,7 @@ do_follow_url(struct session *ses, struct uri *uri, char *target,
static void
follow_url(struct session *ses, struct uri *uri, char *target,
enum task_type task, enum cache_mode cache_mode, int referrer)
enum task_type task, cache_mode_T cache_mode, int referrer)
{
#ifdef CONFIG_SCRIPTING
static int follow_url_event_id = EVENT_NONE;
@ -696,7 +696,7 @@ goto_uri(struct session *ses, struct uri *uri)
void
goto_uri_frame(struct session *ses, struct uri *uri,
char *target, enum cache_mode cache_mode)
char *target, cache_mode_T cache_mode)
{
follow_url(ses, uri, target, TASK_FORWARD, cache_mode, 1);
}

View File

@ -24,17 +24,17 @@ struct link_def {
void abort_preloading(struct session *, int);
void ses_load(struct session *ses, struct uri *uri, char *target_frame,
struct location *target_location, enum cache_mode cache_mode,
struct location *target_location, cache_mode_T cache_mode,
enum task_type task_type);
void ses_goto(struct session *, struct uri *, char *,
struct location *, enum cache_mode, enum task_type, int);
struct location *, cache_mode_T, enum task_type, int);
struct view_state *ses_forward(struct session *, int);
struct uri *get_hooked_uri(char *uristring, struct session *ses, char *cwd);
void goto_uri(struct session *ses, struct uri *uri);
void goto_uri_frame(struct session *, struct uri *, char *, enum cache_mode);
void goto_uri_frame(struct session *, struct uri *, char *, cache_mode_T);
void delayed_goto_uri_frame(void *);
void goto_url(struct session *, char *);
void goto_url_with_hook(struct session *, char *);

View File

@ -1426,7 +1426,7 @@ submit_given_form(struct session *ses, struct document_view *doc_view,
if (!list_empty(form->items)) {
struct el_form_control *fc = (struct el_form_control *)form->items.next;
struct uri *uri;
enum cache_mode mode = do_reload ? CACHE_MODE_FORCE_RELOAD : CACHE_MODE_NORMAL;
cache_mode_T mode = do_reload ? CACHE_MODE_FORCE_RELOAD : CACHE_MODE_NORMAL;
if (!fc) return;
uri = get_form_uri(ses, doc_view, fc);

View File

@ -910,7 +910,7 @@ call_onsubmit_and_submit(struct session *ses, struct document_view *doc_view,
struct el_form_control *fc, int do_reload)
{
struct uri *uri = NULL;
enum cache_mode mode = do_reload ? CACHE_MODE_FORCE_RELOAD : CACHE_MODE_NORMAL;
cache_mode_T mode = do_reload ? CACHE_MODE_FORCE_RELOAD : CACHE_MODE_NORMAL;
assert(fc->form); /* regardless of whether there is a FORM element */
if_assert_failed return 0;
@ -993,7 +993,7 @@ goto_link(struct session *ses, struct document_view *doc_view, struct link *link
goto_imgmap(ses, uri, link->target);
} else {
enum cache_mode mode = do_reload ? CACHE_MODE_FORCE_RELOAD
cache_mode_T mode = do_reload ? CACHE_MODE_FORCE_RELOAD
: CACHE_MODE_NORMAL;
goto_uri_frame(ses, uri, link->target, mode);