From d7e4b571463fad83f6b67f5e22e25483cb571b52 Mon Sep 17 00:00:00 2001 From: Kalle Olavi Niemitalo Date: Sun, 4 Feb 2007 15:17:49 +0200 Subject: [PATCH] Make instances of struct listbox_ops const. --- src/bfu/hierbox.c | 10 +++++----- src/bfu/hierbox.h | 2 +- src/bfu/listbox.c | 2 +- src/bfu/listbox.h | 2 +- src/bookmarks/dialogs.c | 2 +- src/cache/dialogs.c | 2 +- src/config/dialogs.c | 4 ++-- src/cookies/dialogs.c | 2 +- src/dialogs/download.c | 2 +- src/formhist/dialogs.c | 2 +- src/globhist/dialogs.c | 2 +- src/protocol/auth/dialogs.c | 2 +- 12 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/bfu/hierbox.c b/src/bfu/hierbox.c index 618830def..751d4c574 100644 --- a/src/bfu/hierbox.c +++ b/src/bfu/hierbox.c @@ -592,7 +592,7 @@ static const struct listbox_ops_messages default_listbox_ops_messages = { static void print_delete_error(struct listbox_item *item, struct terminal *term, - struct listbox_ops *ops, enum delete_error err) + const struct listbox_ops *ops, enum delete_error err) { struct string msg; unsigned char *errmsg; @@ -647,7 +647,7 @@ static void do_delete_item(struct listbox_item *item, struct listbox_context *info, int last) { - struct listbox_ops *ops = info->box->ops; + const struct listbox_ops *ops = info->box->ops; assert(item); @@ -720,7 +720,7 @@ query_delete_selected_item(void *context_) struct listbox_context *context, *oldcontext = context_; struct terminal *term = oldcontext->term; struct listbox_data *box = oldcontext->box; - struct listbox_ops *ops = box->ops; + const struct listbox_ops *ops = box->ops; struct listbox_item *item = box->sel; unsigned char *text; enum delete_error delete; @@ -779,7 +779,7 @@ push_hierbox_delete_button(struct dialog_data *dlg_data, /* [gettext_accelerator_context(push_hierbox_delete_button)] */ struct terminal *term = dlg_data->win->term; struct listbox_data *box = get_dlg_listbox_data(dlg_data); - struct listbox_ops *ops = box->ops; + const struct listbox_ops *ops = box->ops; struct listbox_item *item = box->sel; struct listbox_context *context; @@ -842,7 +842,7 @@ push_hierbox_clear_button(struct dialog_data *dlg_data, { /* [gettext_accelerator_context(push_hierbox_clear_button)] */ struct listbox_data *box = get_dlg_listbox_data(dlg_data); - struct listbox_ops *ops = box->ops; + const struct listbox_ops *ops = box->ops; struct terminal *term = dlg_data->win->term; struct listbox_context *context; diff --git a/src/bfu/hierbox.h b/src/bfu/hierbox.h index b4a354b95..513d09748 100644 --- a/src/bfu/hierbox.h +++ b/src/bfu/hierbox.h @@ -24,7 +24,7 @@ struct hierbox_browser { struct list_head boxes; struct list_head dialogs; struct listbox_item root; - struct listbox_ops *ops; + const struct listbox_ops *ops; /* For saving state */ unsigned int do_not_save_state:1; diff --git a/src/bfu/listbox.c b/src/bfu/listbox.c index f0da43827..0ad32a987 100644 --- a/src/bfu/listbox.c +++ b/src/bfu/listbox.c @@ -452,7 +452,7 @@ display_listbox_item(struct listbox_item *item, void *data_, int *offset) } else { unsigned char *text; - struct listbox_ops *ops = data->box->ops; + const struct listbox_ops *ops = data->box->ops; int len_bytes; assert(ops && ops->get_info); diff --git a/src/bfu/listbox.h b/src/bfu/listbox.h index 46c3184ba..bca2a2662 100644 --- a/src/bfu/listbox.h +++ b/src/bfu/listbox.h @@ -100,7 +100,7 @@ struct listbox_ops { struct listbox_data { LIST_HEAD(struct listbox_data); - struct listbox_ops *ops; /* Backend-provided operations */ + const struct listbox_ops *ops; /* Backend-provided operations */ struct listbox_item *sel; /* Item currently selected */ struct listbox_item *top; /* Item which is on the top line of the box */ diff --git a/src/bookmarks/dialogs.c b/src/bookmarks/dialogs.c index a7e3cea96..bb6fa4481 100644 --- a/src/bookmarks/dialogs.c +++ b/src/bookmarks/dialogs.c @@ -139,7 +139,7 @@ static struct listbox_ops_messages bookmarks_messages = { N_("Do you really want to remove all bookmarks?"), }; -static struct listbox_ops bookmarks_listbox_ops = { +static const struct listbox_ops bookmarks_listbox_ops = { lock_bookmark, unlock_bookmark, is_bookmark_used, diff --git a/src/cache/dialogs.c b/src/cache/dialogs.c index 839d6ba2a..b0a33b346 100644 --- a/src/cache/dialogs.c +++ b/src/cache/dialogs.c @@ -209,7 +209,7 @@ static struct listbox_ops_messages cache_messages = { NULL, }; -static struct listbox_ops cache_entry_listbox_ops = { +static const struct listbox_ops cache_entry_listbox_ops = { lock_cache_entry, unlock_cache_entry, is_cache_entry_used, diff --git a/src/config/dialogs.c b/src/config/dialogs.c index cff11a7fc..35d893c48 100644 --- a/src/config/dialogs.c +++ b/src/config/dialogs.c @@ -242,7 +242,7 @@ delete_option_item(struct listbox_item *item, int last) mark_option_as_deleted(option); } -static struct listbox_ops options_listbox_ops = { +static const struct listbox_ops options_listbox_ops = { lock_option, unlock_option, is_option_used, @@ -727,7 +727,7 @@ delete_keybinding_item(struct listbox_item *item, int last) free_keybinding(keybinding); } -static struct listbox_ops keybinding_listbox_ops = { +static const struct listbox_ops keybinding_listbox_ops = { lock_keybinding, unlock_keybinding, is_keybinding_used, diff --git a/src/cookies/dialogs.c b/src/cookies/dialogs.c index b859bc9d4..1b8101668 100644 --- a/src/cookies/dialogs.c +++ b/src/cookies/dialogs.c @@ -219,7 +219,7 @@ static struct listbox_ops_messages cookies_messages = { N_("Do you really want to remove all cookies?"), }; -static struct listbox_ops cookies_listbox_ops = { +static const struct listbox_ops cookies_listbox_ops = { lock_cookie, unlock_cookie, is_cookie_used, diff --git a/src/dialogs/download.c b/src/dialogs/download.c index 931169f0e..63c1a055e 100644 --- a/src/dialogs/download.c +++ b/src/dialogs/download.c @@ -445,7 +445,7 @@ static struct listbox_ops_messages download_messages = { N_("Do you really want to interrupt all downloads?"), }; -static struct listbox_ops downloads_listbox_ops = { +static const struct listbox_ops downloads_listbox_ops = { lock_file_download, unlock_file_download, is_file_download_used, diff --git a/src/formhist/dialogs.c b/src/formhist/dialogs.c index 2727e7032..c4a65ddad 100644 --- a/src/formhist/dialogs.c +++ b/src/formhist/dialogs.c @@ -142,7 +142,7 @@ static struct listbox_ops_messages formhist_messages = { N_("Do you really want to remove all forms?"), }; -static struct listbox_ops formhist_listbox_ops = { +static const struct listbox_ops formhist_listbox_ops = { lock_formhist_data, unlock_formhist_data, is_formhist_data_used, diff --git a/src/globhist/dialogs.c b/src/globhist/dialogs.c index 896263dea..b8dc26a52 100644 --- a/src/globhist/dialogs.c +++ b/src/globhist/dialogs.c @@ -127,7 +127,7 @@ static struct listbox_ops_messages globhist_messages = { N_("Do you really want to remove all history entries?"), }; -static struct listbox_ops gh_listbox_ops = { +static const struct listbox_ops gh_listbox_ops = { lock_globhist_item, unlock_globhist_item, is_globhist_item_used, diff --git a/src/protocol/auth/dialogs.c b/src/protocol/auth/dialogs.c index ce39da6b5..784135e4b 100644 --- a/src/protocol/auth/dialogs.c +++ b/src/protocol/auth/dialogs.c @@ -241,7 +241,7 @@ static struct listbox_ops_messages http_auth_messages = { N_("Do you really want to remove all auth entries?"), }; -static struct listbox_ops auth_listbox_ops = { +static const struct listbox_ops auth_listbox_ops = { lock_auth_entry, unlock_auth_entry, is_auth_entry_used,