Browse code

socket: make stream_buf_* functions static

stream_buf_init(), stream_buf_close() and stream_buf_added()
are only used within socket.c, therefore there is noneed to
have them declared in socket.h.

Make them static and remove useless declarations.
This change reuired adding function prototypes in socket.c to
avoid useless code re-ordering.

Signed-off-by: Antonio Quartulli <a@unstable.cc>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20180712012955.24050-1-a@unstable.cc>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg17246.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>

Antonio Quartulli authored on 2018/07/12 10:29:55
Showing 2 changed files
... ...
@@ -1492,6 +1492,22 @@ done:
1492 1492
     gc_free(&gc);
1493 1493
 }
1494 1494
 
1495
+/*
1496
+ * Stream buffer handling prototypes -- stream_buf is a helper class
1497
+ * to assist in the packetization of stream transport protocols
1498
+ * such as TCP.
1499
+ */
1500
+
1501
+static void
1502
+stream_buf_init(struct stream_buf *sb, struct buffer *buf,
1503
+                const unsigned int sockflags, const int proto);
1504
+
1505
+static void
1506
+stream_buf_close(struct stream_buf *sb);
1507
+
1508
+static bool
1509
+stream_buf_added(struct stream_buf *sb, int length_added);
1510
+
1495 1511
 /* For stream protocols, allocate a buffer to build up packet.
1496 1512
  * Called after frame has been finalized. */
1497 1513
 
... ...
@@ -2501,7 +2517,7 @@ stream_buf_reset(struct stream_buf *sb)
2501 2501
     sb->len = -1;
2502 2502
 }
2503 2503
 
2504
-void
2504
+static void
2505 2505
 stream_buf_init(struct stream_buf *sb,
2506 2506
                 struct buffer *buf,
2507 2507
                 const unsigned int sockflags,
... ...
@@ -2575,7 +2591,7 @@ stream_buf_read_setup_dowork(struct link_socket *sock)
2575 2575
     return !sock->stream_buf.residual_fully_formed;
2576 2576
 }
2577 2577
 
2578
-bool
2578
+static bool
2579 2579
 stream_buf_added(struct stream_buf *sb,
2580 2580
                  int length_added)
2581 2581
 {
... ...
@@ -2642,7 +2658,7 @@ stream_buf_added(struct stream_buf *sb,
2642 2642
     }
2643 2643
 }
2644 2644
 
2645
-void
2645
+static void
2646 2646
 stream_buf_close(struct stream_buf *sb)
2647 2647
 {
2648 2648
     free_buf(&sb->residual);
... ...
@@ -994,21 +994,6 @@ link_socket_set_outgoing_addr(const struct buffer *buf,
994 994
     }
995 995
 }
996 996
 
997
-/*
998
- * Stream buffer handling -- stream_buf is a helper class
999
- * to assist in the packetization of stream transport protocols
1000
- * such as TCP.
1001
- */
1002
-
1003
-void stream_buf_init(struct stream_buf *sb,
1004
-                     struct buffer *buf,
1005
-                     const unsigned int sockflags,
1006
-                     const int proto);
1007
-
1008
-void stream_buf_close(struct stream_buf *sb);
1009
-
1010
-bool stream_buf_added(struct stream_buf *sb, int length_added);
1011
-
1012 997
 static inline bool
1013 998
 stream_buf_read_setup(struct link_socket *sock)
1014 999
 {