]> The Tcpdump Group git mirrors - tcpdump/commitdiff
PTP: Declare 'static' some variables
authorFrancois-Xavier Le Bail <[email protected]>
Fri, 29 May 2020 21:41:45 +0000 (23:41 +0200)
committerFrancois-Xavier Le Bail <[email protected]>
Fri, 29 May 2020 22:05:32 +0000 (00:05 +0200)
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

index 36001c106f6d9ce8c4dc8993dab8f75080533ff5..c6d8e544fdf74fe9c72c9cbf2ba0c35f2d755871 100644 (file)
@@ -259,9 +259,9 @@ static const struct tok ptp_flag_values[] = {
             ND_PRINT("(%s)", tok2str(ptp_msg_type, "unknown", e)); \
         }
 
             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
 
 #define PTP_VER_1 0x1
 #define PTP_VER_2 0x2
@@ -340,7 +340,8 @@ ptp_print_1(netdissect_options *ndo)
     ND_PRINT(" (not implemented)");
 }
 
     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;
 {
     u_int len = length;
     uint16_t msg_len, flags, port_id, seq_id;