From 7e8d0093b411729c8c570b25280bef6b55415594 Mon Sep 17 00:00:00 2001
From: Gavin Smith <gavinsmith0123@gmail.com>
Date: Fri, 9 Aug 2024 11:05:08 +0100
Subject: [PATCH] Remove VFunction.

* info/terminal.c, info/terminal.h
(terminal_begin_blink_hook, terminal_begin_bold_hook)
(terminal_begin_inverse_hook, terminal_begin_standout_hook)
(terminal_begin_underline_hook, terminal_clear_screen_hook)
(terminal_clear_to_eol_hook, terminal_default_colour_hook)
(terminal_down_line_hook, terminal_end_all_modes_hook)
(terminal_end_inverse_hook, terminal_end_standout_hook)
(terminal_end_underline_hook, terminal_get_screen_size_hook)
(terminal_goto_xy_hook, terminal_initialize_terminal_hook)
(terminal_new_terminal_hook, terminal_prep_terminal_hook)
(terminal_put_text_hook, terminal_ring_bell_hook)
(terminal_scroll_terminal_hook, terminal_set_bgcolour_hook,)
(terminal_set_colour_hook, terminal_unprep_terminal_hook,)
(terminal_up_line_hook, terminal_write_chars_hook):
Declare with explicit variable list.
(VFunction): Remove.

C23 does not allow a variable list to be left undefined as ().
Report from Jeffrey Cliff <jeffrey.cliff@gmail.com>.

Upstream-Status: Backport [https://cgit.git.savannah.gnu.org/cgit/texinfo.git/commit/?id=7e8d0093b411729c8c570b25280bef6b55415594]
Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
---
 info/terminal.c | 53 +++++++++++++++++++++++++------------------------
 info/terminal.h | 42 +++++++++++++++++++--------------------
 2 files changed, 47 insertions(+), 48 deletions(-)

diff --git a/info/terminal.c b/info/terminal.c
index 7a9793befc..b6f59ff5c5 100644
--- a/info/terminal.c
+++ b/info/terminal.c
@@ -53,32 +53,33 @@ extern int tputs ();
    function is called when appropriate instead of its namesake.  Your
    function is called with exactly the same arguments that were passed
    to the namesake function. */
-VFunction *terminal_begin_inverse_hook = NULL;
-VFunction *terminal_end_inverse_hook = NULL;
-VFunction *terminal_begin_standout_hook = NULL;
-VFunction *terminal_end_standout_hook = NULL;
-VFunction *terminal_begin_underline_hook = NULL;
-VFunction *terminal_end_underline_hook = NULL;
-VFunction *terminal_begin_bold_hook = NULL;
-VFunction *terminal_begin_blink_hook = NULL;
-VFunction *terminal_end_all_modes_hook = NULL;
-VFunction *terminal_default_colour_hook = NULL;
-VFunction *terminal_set_colour_hook = NULL;
-VFunction *terminal_set_bgcolour_hook = NULL;
-VFunction *terminal_prep_terminal_hook = NULL;
-VFunction *terminal_unprep_terminal_hook = NULL;
-VFunction *terminal_up_line_hook = NULL;
-VFunction *terminal_down_line_hook = NULL;
-VFunction *terminal_clear_screen_hook = NULL;
-VFunction *terminal_clear_to_eol_hook = NULL;
-VFunction *terminal_get_screen_size_hook = NULL;
-VFunction *terminal_goto_xy_hook = NULL;
-VFunction *terminal_initialize_terminal_hook = NULL;
-VFunction *terminal_new_terminal_hook = NULL;
-VFunction *terminal_put_text_hook = NULL;
-VFunction *terminal_ring_bell_hook = NULL;
-VFunction *terminal_write_chars_hook = NULL;
-VFunction *terminal_scroll_terminal_hook = NULL;
+
+void (*terminal_initialize_terminal_hook) (char *terminal_name) = NULL;
+void (*terminal_get_screen_size_hook) (void) = NULL;
+int (*terminal_prep_terminal_hook) (void) = NULL;
+void (*terminal_unprep_terminal_hook) (void) = NULL;
+void (*terminal_new_terminal_hook) (char *terminal_name) = NULL;
+void (*terminal_goto_xy_hook) (int x, int y) = NULL;
+void (*terminal_put_text_hook) (char *string) = NULL;
+void (*terminal_write_chars_hook) (char *string, int nchars) = NULL;
+void (*terminal_clear_to_eol_hook) (void) = NULL;
+void (*terminal_clear_screen_hook) (void) = NULL;
+void (*terminal_up_line_hook) (void) = NULL;
+void (*terminal_down_line_hook) (void) = NULL;
+void (*terminal_begin_inverse_hook) (void) = NULL;
+void (*terminal_end_inverse_hook) (void) = NULL;
+void (*terminal_begin_standout_hook) (void) = NULL;
+void (*terminal_end_standout_hook) (void) = NULL;
+void (*terminal_begin_underline_hook) (void) = NULL;
+void (*terminal_end_underline_hook) (void) = NULL;
+void (*terminal_scroll_terminal_hook) (int start, int end, int amount) = NULL;
+void (*terminal_ring_bell_hook) (void) = NULL;
+void (*terminal_begin_bold_hook) (void) = NULL;
+void (*terminal_begin_blink_hook) (void) = NULL;
+void (*terminal_default_colour_hook) (void) = NULL;
+void (*terminal_set_colour_hook) (int) = NULL;
+void (*terminal_set_bgcolour_hook) (int) = NULL;
+void (*terminal_end_all_modes_hook) (void) = NULL;
 
 /* User variable 'mouse'.  Values can be MP_* constants in terminal.h. */
 int mouse_protocol = MP_NONE;
diff --git a/info/terminal.h b/info/terminal.h
index ee881a8bb1..718d0844a6 100644
--- a/info/terminal.h
+++ b/info/terminal.h
@@ -20,8 +20,6 @@
 #if !defined (TERMINAL_H)
 #define TERMINAL_H
 
-typedef void VFunction ();
-
 /* For almost every function externally visible from terminal.c, there is
    a corresponding "hook" function which can be bound in order to replace
    the functionality of the one found in terminal.c.  This is how we go
@@ -50,87 +48,87 @@ extern int terminal_can_scroll_region;
    The variables SCREENHEIGHT and SCREENWIDTH are set to the dimensions that
    this terminal actually has. */
 extern void terminal_initialize_terminal (char *terminal_name);
-extern VFunction *terminal_initialize_terminal_hook;
+extern void (*terminal_initialize_terminal_hook) (char *terminal_name);
 
 /* Return the current screen width and height in the variables
    SCREENWIDTH and SCREENHEIGHT. */
 extern void terminal_get_screen_size (void);
-extern VFunction *terminal_get_screen_size_hook;
+extern void (*terminal_get_screen_size_hook) (void);
 
 /* Save and restore tty settings. */
 extern int terminal_prep_terminal (void);
 extern void terminal_unprep_terminal (void);
 
-extern VFunction *terminal_prep_terminal_hook;
-extern VFunction *terminal_unprep_terminal_hook;
+extern int (*terminal_prep_terminal_hook) (void);
+extern void (*terminal_unprep_terminal_hook) (void);
 
 /* Re-initialize the terminal to TERMINAL_NAME. */
 extern void terminal_new_terminal (char *terminal_name);
-extern VFunction *terminal_new_terminal_hook;
+extern void (*terminal_new_terminal_hook) (char *terminal_name);
 
 /* Move the cursor to the terminal location of X and Y. */
 extern void terminal_goto_xy (int x, int y);
-extern VFunction *terminal_goto_xy_hook;
+extern void (*terminal_goto_xy_hook) (int x, int y);
 
 /* Print STRING to the terminal at the current position. */
 extern void terminal_put_text (char *string);
-extern VFunction *terminal_put_text_hook;
+extern void (*terminal_put_text_hook) (char *string);
 
 /* Print NCHARS from STRING to the terminal at the current position. */
 extern void terminal_write_chars (char *string, int nchars);
-extern VFunction *terminal_write_chars_hook;
+extern void (*terminal_write_chars_hook) (char *string, int nchars);
 
 /* Clear from the current position of the cursor to the end of the line. */
 extern void terminal_clear_to_eol (void);
-extern VFunction *terminal_clear_to_eol_hook;
+extern void (*terminal_clear_to_eol_hook) (void);
 
 /* Clear the entire terminal screen. */
 extern void terminal_clear_screen (void);
-extern VFunction *terminal_clear_screen_hook;
+extern void (*terminal_clear_screen_hook) (void);
 
 /* Move the cursor up one line. */
 extern void terminal_up_line (void);
-extern VFunction *terminal_up_line_hook;
+extern void (*terminal_up_line_hook) (void);
 
 /* Move the cursor down one line. */
 extern void terminal_down_line (void);
-extern VFunction *terminal_down_line_hook;
+extern void (*terminal_down_line_hook) (void);
 
 /* Turn on reverse video if possible. */
 extern void terminal_begin_inverse (void);
-extern VFunction *terminal_begin_inverse_hook;
+extern void (*terminal_begin_inverse_hook) (void);
 
 /* Turn off reverse video if possible. */
 extern void terminal_end_inverse (void);
-extern VFunction *terminal_end_inverse_hook;
+extern void (*terminal_end_inverse_hook) (void);
 
 /* Turn on standout mode if possible. */
 extern void terminal_begin_standout (void);
-extern VFunction *terminal_begin_standout_hook;
+extern void (*terminal_begin_standout_hook) (void);
 
 /* Turn off standout mode if possible. */
 extern void terminal_end_standout (void);
-extern VFunction *terminal_end_standout_hook;
+extern void (*terminal_end_standout_hook) (void);
 
 /* Turn on and off underline mode if possible. */
 void terminal_begin_underline (void);
-extern VFunction *terminal_begin_underline_hook;
+extern void (*terminal_begin_underline_hook) (void);
 void terminal_end_underline (void);
-extern VFunction *terminal_end_underline_hook;
+extern void (*terminal_end_underline_hook) (void);
 
 /* Scroll an area of the terminal, starting with the region from START
    to END, AMOUNT lines.  If AMOUNT is negative, the lines are scrolled
    towards the top of the screen, else they are scrolled towards the
    bottom of the screen. */
 extern void terminal_scroll_terminal (int start, int end, int amount);
-extern VFunction *terminal_scroll_terminal_hook;
+extern void (*terminal_scroll_terminal_hook) (int start, int end, int amount);
 
 extern void terminal_scroll_region (int start, int end, int amount);
 
 /* Ring the terminal bell.  The bell is run visibly if it both has one and
    terminal_use_visible_bell_p is non-zero. */
 extern void terminal_ring_bell (void);
-extern VFunction *terminal_ring_bell_hook;
+extern void (*terminal_ring_bell_hook) (void);
 
 /* The key sequences output by special keys, if this terminal has any. */
 extern char *term_ku, *term_kd, *term_kr, *term_kl;
