Ethereal-dev: [Ethereal-dev] patch: missing statics
Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.
From: Joerg Mayer <jmayer@xxxxxxxxx>
Date: Sat, 11 May 2002 00:55:50 +0200
I have started to look a bit more methodically at things that should have been declared static. The attached patch is the result of looking at packet-a* to packet-ipsec. The following files contain symbols that are not used outside but are declared in a .h file: - packet-dcerpc-nt.c: dissect_dcerpc_uint8s dissect_ndr_nt_STRING_string prs_ntstatus prs_pop_ptr prs_push_ptr prs_uint32s - packet-dcerpc-samr.c: dissect_ndr_nt_SID_AND_ATTRIBUTES - packet-dcerpc-spoolss.c: ett_NOTIFY_OPTION_ARRAY - packet-dcerpc.c: dcerpc_tvb_get_ntohs One file I haven't looked at in detail is packet-giop.c. Ciao Jï¿œrg -- Joerg Mayer <jmayer@xxxxxxxxx> I found out that "pro" means "instead of" (as in proconsul). Now I know what proactive means.
Changelog: <jmayer@xxxxxxxxx> Declare various variables static. Create packet-data.h for proto_data and use that in print.c Index: ethereal/packet-afs.c =================================================================== RCS file: /cvsroot/ethereal/packet-afs.c,v retrieving revision 1.45 diff -u -r1.45 packet-afs.c --- packet-afs.c 2002/05/06 01:25:45 1.45 +++ packet-afs.c 2002/05/10 22:33:03 @@ -62,7 +62,7 @@ (opcode >= VOTE_LOW && opcode <= VOTE_HIGH) || \ (opcode >= DISK_LOW && opcode <= DISK_HIGH)) -int afs_packet_init_count = 100; +static int afs_packet_init_count = 100; struct afs_request_key { guint32 conversation, callnumber; @@ -73,9 +73,9 @@ guint32 opcode; }; -GHashTable *afs_request_hash = NULL; -GMemChunk *afs_request_keys = NULL; -GMemChunk *afs_request_vals = NULL; +static GHashTable *afs_request_hash = NULL; +static GMemChunk *afs_request_keys = NULL; +static GMemChunk *afs_request_vals = NULL; Index: ethereal/packet-atalk.c =================================================================== RCS file: /cvsroot/ethereal/packet-atalk.c,v retrieving revision 1.71 diff -u -r1.71 packet-atalk.c --- packet-atalk.c 2002/05/08 23:46:33 1.71 +++ packet-atalk.c 2002/05/10 22:33:04 @@ -433,7 +433,7 @@ * * Are these always in the Mac extended character set? */ -int dissect_pascal_string(tvbuff_t *tvb, int offset, proto_tree *tree, +static int dissect_pascal_string(tvbuff_t *tvb, int offset, proto_tree *tree, int hf_index) { int len; Index: ethereal/packet-cops.c =================================================================== RCS file: /cvsroot/ethereal/packet-cops.c,v retrieving revision 1.30 diff -u -r1.30 packet-cops.c --- packet-cops.c 2002/05/05 00:16:32 1.30 +++ packet-cops.c 2002/05/10 22:33:05 @@ -868,7 +868,7 @@ /*convert hex to binary string (1010....)*/ -gchar* xtobstr(guint8 *hex, guint len) { +static gchar* xtobstr(guint8 *hex, guint len) { guint i=0,j=0,k=0, bit=0; gchar *binstr=NULL; Index: ethereal/packet-dcerpc-netlogon.c =================================================================== RCS file: /cvsroot/ethereal/packet-dcerpc-netlogon.c,v retrieving revision 1.20 diff -u -r1.20 packet-dcerpc-netlogon.c --- packet-dcerpc-netlogon.c 2002/05/04 10:41:16 1.20 +++ packet-dcerpc-netlogon.c 2002/05/10 22:33:05 @@ -238,7 +238,7 @@ return offset; } -int +static int netlogon_dissect_UNICODE_STRING(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *parent_tree, char *drep, int type, int hf_index, int levels) Index: ethereal/packet-diameter.c =================================================================== RCS file: /cvsroot/ethereal/packet-diameter.c,v retrieving revision 1.47 diff -u -r1.47 packet-diameter.c --- packet-diameter.c 2002/05/02 19:32:19 1.47 +++ packet-diameter.c 2002/05/10 22:33:06 @@ -881,7 +881,7 @@ } /*diameter_app_to_str */ /* return an avp type, based on the code */ -diameterDataType +static diameterDataType diameter_avp_get_type(guint32 avpCode, guint32 vendorId){ avpInfo *probe; gchar *vendorName=NULL; Index: ethereal/packet-dsi.c =================================================================== RCS file: /cvsroot/ethereal/packet-dsi.c,v retrieving revision 1.20 diff -u -r1.20 packet-dsi.c --- packet-dsi.c 2002/05/08 23:46:34 1.20 +++ packet-dsi.c 2002/05/10 22:33:07 @@ -95,7 +95,7 @@ static gint ett_dsi_attn = -1; static gint ett_dsi_attn_flag = -1; -const value_string dsi_attn_flag_vals[] = { +static const value_string dsi_attn_flag_vals[] = { {0x0, "Reserved" }, /* 0000 */ {0x1, "Reserved" }, /* 0001 */ {0x2, "Server message" }, /* 0010 */ @@ -107,7 +107,7 @@ {0x11,"Server is shutting down, message,no reconnect"}, /* 1011 */ {0, NULL } }; -const value_string dsi_open_type_vals[] = { +static const value_string dsi_open_type_vals[] = { {0, "Server quantum" }, {1, "Attention quantum" }, {0, NULL } }; Index: ethereal/packet-dvmrp.c =================================================================== RCS file: /cvsroot/ethereal/packet-dvmrp.c,v retrieving revision 1.10 diff -u -r1.10 packet-dvmrp.c --- packet-dvmrp.c 2002/05/02 09:34:33 1.10 +++ packet-dvmrp.c 2002/05/10 22:33:07 @@ -221,7 +221,7 @@ "NOT Netmask capable" }; -int +static int dissect_v3_report(tvbuff_t *tvb, proto_tree *parent_tree, int offset) { guint8 m0,m1,m2,m3; @@ -306,7 +306,7 @@ return offset; } -int +static int dissect_dvmrp_v3(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, int offset) { guint8 code,count; @@ -446,7 +446,7 @@ } -int +static int dissect_dvmrp_v1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, int offset) { guint8 code; Index: ethereal/packet-gtp.c =================================================================== RCS file: /cvsroot/ethereal/packet-gtp.c,v retrieving revision 1.27 diff -u -r1.27 packet-gtp.c --- packet-gtp.c 2002/05/02 11:05:44 1.27 +++ packet-gtp.c 2002/05/10 22:33:09 @@ -1465,7 +1465,7 @@ guint32 teid; } _gtpv1_hdr; -struct gcdr_ { /* GCDR 118B */ +static struct gcdr_ { /* GCDR 118B */ guint8 imsi[8]; guint32 ggsnaddr; guint32 chrgid; @@ -1496,7 +1496,7 @@ guint8 qos_neg[3]; } change_t; -struct _scdr { /* SCDR 277B */ +static struct _scdr { /* SCDR 277B */ guint16 len; guint8 netini; guint8 anon; @@ -1541,7 +1541,7 @@ guint8 omit[8]; } mmchange_t; -struct _mcdr { /* MCDR 147B */ +static struct _mcdr { /* MCDR 147B */ guint16 len; guint8 imsilen; guint8 imsi[8]; @@ -1572,7 +1572,7 @@ guint32 seqno; } mcdr; -struct _socdr { /* SOCDR 80B */ +static struct _socdr { /* SOCDR 80B */ guint16 len; guint8 imsilen; guint8 imsi[8]; @@ -1595,7 +1595,7 @@ } socdr; -struct _stcdr { /* STCDR 79B */ +static struct _stcdr { /* STCDR 79B */ guint16 len; guint8 imsilen; guint8 imsi[8]; @@ -1616,8 +1616,8 @@ guint16 smsres; } stcdr; - guint8 gtp_version = 0; - char *yesno[] = { "False", "True" }; +static guint8 gtp_version = 0; +static char *yesno[] = { "False", "True" }; static void col_append_str_gtp(column_info *cinfo, gint el, gchar *proto_name) { @@ -1693,7 +1693,7 @@ return (gchar *)&str[0]; } -gchar * +static gchar * time_int_to_str (guint32 time) { @@ -1705,7 +1705,7 @@ return abs_time_to_str (&nstime); } -gchar * +static gchar * rel_time_int_to_str (guint32 time) { Index: ethereal/packet-hclnfsd.c =================================================================== RCS file: /cvsroot/ethereal/packet-hclnfsd.c,v retrieving revision 1.13 diff -u -r1.13 packet-hclnfsd.c --- packet-hclnfsd.c 2002/04/25 21:29:13 1.13 +++ packet-hclnfsd.c 2002/05/10 22:33:09 @@ -150,7 +150,7 @@ { 0, NULL } }; -void +static void hclnfsd_decode_obscure(char *ident, int ident_len) { int j, x, y; Index: ethereal/packet-iapp.c =================================================================== RCS file: /cvsroot/ethereal/packet-iapp.c,v retrieving revision 1.2 diff -u -r1.2 packet-iapp.c --- packet-iapp.c 2002/04/29 08:20:08 1.2 +++ packet-iapp.c 2002/05/10 22:33:09 @@ -198,7 +198,8 @@ static gchar textbuffer[2000]; -gchar *iaconvertbufftostr(gchar *dest, tvbuff_t *tvb, int offset, int length) +static gchar* +iaconvertbufftostr(gchar *dest, tvbuff_t *tvb, int offset, int length) { /*converts the raw buffer into printable text */ guint32 i; Index: ethereal/packet-ipsec.c =================================================================== RCS file: /cvsroot/ethereal/packet-ipsec.c,v retrieving revision 1.38 diff -u -r1.38 packet-ipsec.c --- packet-ipsec.c 2002/01/24 09:20:48 1.38 +++ packet-ipsec.c 2002/05/10 22:33:10 @@ -46,7 +46,7 @@ #include "prefs.h" /* Place AH payload in sub tree */ -gboolean g_ah_payload_in_subtree = FALSE; +static gboolean g_ah_payload_in_subtree = FALSE; static int proto_ah = -1; static int hf_ah_spi = -1; Index: ethereal/print.c =================================================================== RCS file: /cvsroot/ethereal/print.c,v retrieving revision 1.45 diff -u -r1.45 print.c --- print.c 2002/04/02 05:07:36 1.45 +++ print.c 2002/05/10 22:33:10 @@ -40,6 +40,7 @@ #include "ps.h" #include "util.h" #include <epan/tvbuff.h> +#include "packet-data.h" static void proto_tree_print_node_text(GNode *node, gpointer data); static void proto_tree_print_node_ps(GNode *node, gpointer data); @@ -49,9 +50,6 @@ register u_int length, char_enc encoding); static void print_hex_data_ps(FILE *fh, register const u_char *cp, register u_int length, char_enc encoding); - -extern int proto_data; /* in packet-data.c */ - typedef struct { int level;
/* packet-data.h * * $Id: $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@xxxxxxxx> * Copyright 1998 Gerald Combs * * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef PACKET_DATA_H extern int proto_data; #endif
- Follow-Ups:
- Re: [Ethereal-dev] patch: missing statics
- From: Guy Harris
- Re: [Ethereal-dev] patch: missing statics
- Prev by Date: [Ethereal-dev] Some questions
- Next by Date: Re: [Ethereal-dev] patch: missing statics
- Previous by thread: [Ethereal-dev] Some questions
- Next by thread: Re: [Ethereal-dev] patch: missing statics
- Index(es):