From be9660f7d037f3e2d687e8b816c28dd6a511ec73 Mon Sep 17 00:00:00 2001 From: Kalle Olavi Niemitalo Date: Sun, 28 Jan 2007 14:41:40 +0200 Subject: [PATCH] Make all instances of struct widget_ops const. And widget_type_to_ops[] too. --- src/bfu/button.c | 2 +- src/bfu/button.h | 2 +- src/bfu/checkbox.c | 2 +- src/bfu/checkbox.h | 2 +- src/bfu/dialog.c | 2 +- src/bfu/inpfield.c | 4 ++-- src/bfu/inpfield.h | 4 ++-- src/bfu/listbox.c | 2 +- src/bfu/listbox.h | 2 +- src/bfu/text.c | 2 +- src/bfu/text.h | 2 +- 11 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/bfu/button.c b/src/bfu/button.c index 8b84110a1..b7ead27a2 100644 --- a/src/bfu/button.c +++ b/src/bfu/button.c @@ -331,7 +331,7 @@ select_button(struct dialog_data *dlg_data, struct widget_data *widget_data) return widget_data->widget->handler(dlg_data, widget_data); } -struct widget_ops button_ops = { +const struct widget_ops button_ops = { display_button, NULL, mouse_button, diff --git a/src/bfu/button.h b/src/bfu/button.h index 90dba05f0..06c1d9210 100644 --- a/src/bfu/button.h +++ b/src/bfu/button.h @@ -47,7 +47,7 @@ void add_dlg_button_do(struct dialog *dlg, unsigned char *text, int flags, widge add_dlg_button_do(dlg, text, flags, handler, data, NULL, NULL) #endif -extern struct widget_ops button_ops; +extern const struct widget_ops button_ops; void dlg_format_buttons(struct terminal *, struct widget_data *, int, int, int *, int, int *, enum format_align, int); #endif diff --git a/src/bfu/checkbox.c b/src/bfu/checkbox.c index 8fa6c6360..7ed97e0b2 100644 --- a/src/bfu/checkbox.c +++ b/src/bfu/checkbox.c @@ -164,7 +164,7 @@ select_checkbox(struct dialog_data *dlg_data, struct widget_data *widget_data) return EVENT_PROCESSED; } -struct widget_ops checkbox_ops = { +const struct widget_ops checkbox_ops = { display_checkbox, init_checkbox, mouse_checkbox, diff --git a/src/bfu/checkbox.h b/src/bfu/checkbox.h index 627be5724..573f1d2fd 100644 --- a/src/bfu/checkbox.h +++ b/src/bfu/checkbox.h @@ -27,7 +27,7 @@ void add_dlg_radio_do(struct dialog *dlg, unsigned char *text, int groupid, int #define add_dlg_checkbox(dlg, text, data) \ add_dlg_radio_do(dlg, text, 0, 0, data) -extern struct widget_ops checkbox_ops; +extern const struct widget_ops checkbox_ops; void dlg_format_checkbox(struct terminal *term, diff --git a/src/bfu/dialog.c b/src/bfu/dialog.c index 3bdc574b7..335c4ec6d 100644 --- a/src/bfu/dialog.c +++ b/src/bfu/dialog.c @@ -140,7 +140,7 @@ select_dlg_item(struct dialog_data *dlg_data, struct widget_data *widget_data) widget_data->widget->ops->select(dlg_data, widget_data); } -static struct widget_ops *widget_type_to_ops[] = { +static const struct widget_ops *const widget_type_to_ops[] = { &checkbox_ops, &field_ops, &field_pass_ops, diff --git a/src/bfu/inpfield.c b/src/bfu/inpfield.c index 7edd838c4..76104081d 100644 --- a/src/bfu/inpfield.c +++ b/src/bfu/inpfield.c @@ -744,7 +744,7 @@ clear_field(struct dialog_data *dlg_data, struct widget_data *widget_data) return EVENT_PROCESSED; } -struct widget_ops field_ops = { +const struct widget_ops field_ops = { display_field, init_field, mouse_field, @@ -753,7 +753,7 @@ struct widget_ops field_ops = { clear_field, }; -struct widget_ops field_pass_ops = { +const struct widget_ops field_pass_ops = { display_field_pass, init_field, mouse_field, diff --git a/src/bfu/inpfield.h b/src/bfu/inpfield.h index 5bd47da4b..2829eb707 100644 --- a/src/bfu/inpfield.h +++ b/src/bfu/inpfield.h @@ -56,8 +56,8 @@ add_dlg_field_do(struct dialog *dlg, enum widget_type type, unsigned char *label add_dlg_field_do(dlg, WIDGET_FIELD_PASS, label, min, max, handler, len, field, NULL, INPFIELD_FLOAT) -extern struct widget_ops field_ops; -extern struct widget_ops field_pass_ops; +extern const struct widget_ops field_ops; +extern const struct widget_ops field_pass_ops; widget_handler_status_T check_number(struct dialog_data *, struct widget_data *); widget_handler_status_T check_nonempty(struct dialog_data *, struct widget_data *); diff --git a/src/bfu/listbox.c b/src/bfu/listbox.c index f59fbef86..f0da43827 100644 --- a/src/bfu/listbox.c +++ b/src/bfu/listbox.c @@ -735,7 +735,7 @@ kbd_listbox(struct dialog_data *dlg_data, struct widget_data *widget_data) return EVENT_NOT_PROCESSED; } -struct widget_ops listbox_ops = { +const struct widget_ops listbox_ops = { display_listbox, init_listbox, mouse_listbox, diff --git a/src/bfu/listbox.h b/src/bfu/listbox.h index 9aadbd95b..46c3184ba 100644 --- a/src/bfu/listbox.h +++ b/src/bfu/listbox.h @@ -131,7 +131,7 @@ struct listbox_item { void *udata; }; -extern struct widget_ops listbox_ops; +extern const struct widget_ops listbox_ops; void dlg_format_listbox(struct terminal *, struct widget_data *, int, int *, int, int, int *, enum format_align, int format_only); diff --git a/src/bfu/text.c b/src/bfu/text.c index 2fa4c1d23..8adf0c96a 100644 --- a/src/bfu/text.c +++ b/src/bfu/text.c @@ -542,7 +542,7 @@ mouse_text(struct dialog_data *dlg_data, struct widget_data *widget_data) } -struct widget_ops text_ops = { +const struct widget_ops text_ops = { display_text, NULL, mouse_text, diff --git a/src/bfu/text.h b/src/bfu/text.h index 408c7ce30..8dd33652d 100644 --- a/src/bfu/text.h +++ b/src/bfu/text.h @@ -44,7 +44,7 @@ struct widget_data_info_text { void add_dlg_text(struct dialog *dlg, unsigned char *text, enum format_align align, int bottom_pad); -extern struct widget_ops text_ops; +extern const struct widget_ops text_ops; void dlg_format_text_do(struct terminal *term, unsigned char *text, int x, int *y, int w, int *rw, struct color_pair *scolor, enum format_align align, int format_only);