From 26f7a2ac723629bc0f56728eff3eb99f4dd742e6 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Sun, 23 Sep 2018 09:30:37 +0100 Subject: [PATCH] Add missing 'static' to BPP vtable definitions. Vtable objects only need to be globally visible throughout the code if they're used directly in some interchangeable way, e.g. by passing them to a constructor like cipher_new that's the same for all implementations of the vtable, or by directly looking up public data fields in the vtable itself. But the BPPs are never used like that: each BPP has its own constructor function with a different type signature, so the BPP types are not interchangeable in any way _before_ an instance of one has been constructed. Hence, their vtable objects don't need external linkage. --- ssh1bpp.c | 2 +- ssh2bpp-bare.c | 2 +- ssh2bpp.c | 2 +- sshverstring.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ssh1bpp.c b/ssh1bpp.c index 702ffb8b..90942587 100644 --- a/ssh1bpp.c +++ b/ssh1bpp.c @@ -33,7 +33,7 @@ static void ssh1_bpp_handle_input(BinaryPacketProtocol *bpp); static PktOut *ssh1_bpp_new_pktout(int type); static void ssh1_bpp_format_packet(BinaryPacketProtocol *bpp, PktOut *pkt); -const struct BinaryPacketProtocolVtable ssh1_bpp_vtable = { +static const struct BinaryPacketProtocolVtable ssh1_bpp_vtable = { ssh1_bpp_free, ssh1_bpp_handle_input, ssh1_bpp_new_pktout, diff --git a/ssh2bpp-bare.c b/ssh2bpp-bare.c index e16c8509..45f757f6 100644 --- a/ssh2bpp-bare.c +++ b/ssh2bpp-bare.c @@ -25,7 +25,7 @@ static void ssh2_bare_bpp_handle_input(BinaryPacketProtocol *bpp); static PktOut *ssh2_bare_bpp_new_pktout(int type); static void ssh2_bare_bpp_format_packet(BinaryPacketProtocol *bpp, PktOut *); -const struct BinaryPacketProtocolVtable ssh2_bare_bpp_vtable = { +static const struct BinaryPacketProtocolVtable ssh2_bare_bpp_vtable = { ssh2_bare_bpp_free, ssh2_bare_bpp_handle_input, ssh2_bare_bpp_new_pktout, diff --git a/ssh2bpp.c b/ssh2bpp.c index 2b7f4654..49ab8cfd 100644 --- a/ssh2bpp.c +++ b/ssh2bpp.c @@ -42,7 +42,7 @@ static void ssh2_bpp_handle_input(BinaryPacketProtocol *bpp); static PktOut *ssh2_bpp_new_pktout(int type); static void ssh2_bpp_format_packet(BinaryPacketProtocol *bpp, PktOut *pkt); -const struct BinaryPacketProtocolVtable ssh2_bpp_vtable = { +static const struct BinaryPacketProtocolVtable ssh2_bpp_vtable = { ssh2_bpp_free, ssh2_bpp_handle_input, ssh2_bpp_new_pktout, diff --git a/sshverstring.c b/sshverstring.c index a9b1e46c..37644276 100644 --- a/sshverstring.c +++ b/sshverstring.c @@ -44,7 +44,7 @@ static void ssh_verstring_handle_input(BinaryPacketProtocol *bpp); static PktOut *ssh_verstring_new_pktout(int type); static void ssh_verstring_format_packet(BinaryPacketProtocol *bpp, PktOut *); -const struct BinaryPacketProtocolVtable ssh_verstring_vtable = { +static const struct BinaryPacketProtocolVtable ssh_verstring_vtable = { ssh_verstring_free, ssh_verstring_handle_input, ssh_verstring_new_pktout,