From ea4e272785eb3a1aab6ac148f178439c86aa68ae Mon Sep 17 00:00:00 2001 From: Francois-Xavier Le Bail Date: Fri, 29 May 2020 23:41:45 +0200 Subject: PTP: Declare 'static' some variables Fix warnings given by '-Wmissing-variable-declarations': ./print-ptp.c:262:13: warning: no previous extern declaration for non-static variable 'p_porigin_ts' [-Wmissing-variable-declarations] const char *p_porigin_ts = "preciseOriginTimeStamp"; ^ ./print-ptp.c:262:7: note: declare 'static' if the variable is not intended to be used outside of this translation unit const char *p_porigin_ts = "preciseOriginTimeStamp"; ^ ./print-ptp.c:263:13: warning: no previous extern declaration for non-static variable 'p_origin_ts' [-Wmissing-variable-declarations] const char *p_origin_ts = "originTimeStamp"; ^ ./print-ptp.c:263:7: note: declare 'static' if the variable is not intended to be used outside of this translation unit const char *p_origin_ts = "originTimeStamp"; ^ ./print-ptp.c:264:13: warning: no previous extern declaration for non-static variable 'p_recv_ts' [-Wmissing-variable-declarations] const char *p_recv_ts = "receiveTimeStamp"; ^ ./print-ptp.c:264:7: note: declare 'static' if the variable is not intended to be used outside of this translation unit const char *p_recv_ts = "receiveTimeStamp"; Moreover: Put a function definition name at the beginning of the line. --- print-ptp.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'print-ptp.c') diff --git a/print-ptp.c b/print-ptp.c index 36001c10..c6d8e544 100644 --- a/print-ptp.c +++ b/print-ptp.c @@ -259,9 +259,9 @@ static const struct tok ptp_flag_values[] = { ND_PRINT("(%s)", tok2str(ptp_msg_type, "unknown", e)); \ } -const char *p_porigin_ts = "preciseOriginTimeStamp"; -const char *p_origin_ts = "originTimeStamp"; -const char *p_recv_ts = "receiveTimeStamp"; +static const char *p_porigin_ts = "preciseOriginTimeStamp"; +static const char *p_origin_ts = "originTimeStamp"; +static const char *p_recv_ts = "receiveTimeStamp"; #define PTP_VER_1 0x1 #define PTP_VER_2 0x2 @@ -340,7 +340,8 @@ ptp_print_1(netdissect_options *ndo) ND_PRINT(" (not implemented)"); } -static void ptp_print_2(netdissect_options *ndo, const u_char *bp, u_int length) +static void +ptp_print_2(netdissect_options *ndo, const u_char *bp, u_int length) { u_int len = length; uint16_t msg_len, flags, port_id, seq_id; -- cgit v1.2.1