Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mRemoteNG/PuTTYNG.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2020-03-11 00:06:29 +0300
committerSimon Tatham <anakin@pobox.com>2020-03-11 00:06:29 +0300
commitb4e1bca2c31b830503921ae96412b2b00aa86fac (patch)
treecfe1dfad510921fd63d1385402c0a2d11cc67954 /psftp.c
parentade10f13040474b8fecf0427e14cc34f481d5f0b (diff)
Change vtable defs to use C99 designated initialisers.
This is a sweeping change applied across the whole code base by a spot of Emacs Lisp. Now, everywhere I declare a vtable filled with function pointers (and the occasional const data member), all the members of the vtable structure are initialised by name using the '.fieldname = value' syntax introduced in C99. We were already using this syntax for a handful of things in the new key-generation progress report system, so it's not new to the code base as a whole. The advantage is that now, when a vtable only declares a subset of the available fields, I can initialise the rest to NULL or zero just by leaving them out. This is most dramatic in a couple of the outlying vtables in things like psocks (which has a ConnectionLayerVtable containing only one non-NULL method), but less dramatically, it means that the new 'flags' field in BackendVtable can be completely left out of every backend definition except for the SUPDUP one which defines it to a nonzero value. Similarly, the test_for_upstream method only used by SSH doesn't have to be mentioned in the rest of the backends; network Plugs for listening sockets don't have to explicitly null out 'receive' and 'sent', and vice versa for 'accepting', and so on. While I'm at it, I've normalised the declarations so they don't use the unnecessarily verbose 'struct' keyword. Also a handful of them weren't const; now they are.
Diffstat (limited to 'psftp.c')
-rw-r--r--psftp.c42
1 files changed, 21 insertions, 21 deletions
diff --git a/psftp.c b/psftp.c
index 99e0e12e..6bdf01e3 100644
--- a/psftp.c
+++ b/psftp.c
@@ -45,27 +45,27 @@ static size_t psftp_output(Seat *, bool is_stderr, const void *, size_t);
static bool psftp_eof(Seat *);
static const SeatVtable psftp_seat_vt = {
- psftp_output,
- psftp_eof,
- filexfer_get_userpass_input,
- nullseat_notify_remote_exit,
- console_connection_fatal,
- nullseat_update_specials_menu,
- nullseat_get_ttymode,
- nullseat_set_busy_status,
- console_verify_ssh_host_key,
- console_confirm_weak_crypto_primitive,
- console_confirm_weak_cached_hostkey,
- nullseat_is_never_utf8,
- nullseat_echoedit_update,
- nullseat_get_x_display,
- nullseat_get_windowid,
- nullseat_get_window_pixel_size,
- console_stripctrl_new,
- nullseat_set_trust_status_vacuously,
- cmdline_seat_verbose,
- nullseat_interactive_yes,
- nullseat_get_cursor_position,
+ .output = psftp_output,
+ .eof = psftp_eof,
+ .get_userpass_input = filexfer_get_userpass_input,
+ .notify_remote_exit = nullseat_notify_remote_exit,
+ .connection_fatal = console_connection_fatal,
+ .update_specials_menu = nullseat_update_specials_menu,
+ .get_ttymode = nullseat_get_ttymode,
+ .set_busy_status = nullseat_set_busy_status,
+ .verify_ssh_host_key = console_verify_ssh_host_key,
+ .confirm_weak_crypto_primitive = console_confirm_weak_crypto_primitive,
+ .confirm_weak_cached_hostkey = console_confirm_weak_cached_hostkey,
+ .is_utf8 = nullseat_is_never_utf8,
+ .echoedit_update = nullseat_echoedit_update,
+ .get_x_display = nullseat_get_x_display,
+ .get_windowid = nullseat_get_windowid,
+ .get_window_pixel_size = nullseat_get_window_pixel_size,
+ .stripctrl_new = console_stripctrl_new,
+ .set_trust_status = nullseat_set_trust_status_vacuously,
+ .verbose = cmdline_seat_verbose,
+ .interactive = nullseat_interactive_yes,
+ .get_cursor_position = nullseat_get_cursor_position,
};
static Seat psftp_seat[1] = {{ &psftp_seat_vt }};