[Asterisk-Dev] Shared module symbols leak, take 2
Thorsten Lockert
tholo at sigmasoft.com
Sun Apr 27 14:05:19 MST 2003
This patch makes it so that many module-private symbols are linked
such that they will not show up in global contexts on systems where
this is the default behaviour.
Index: apps/app_agi.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_agi.c,v
retrieving revision 1.2
diff -u -r1.2 app_agi.c
--- apps/app_agi.c 23 Apr 2003 19:09:13 -0000 1.2
+++ apps/app_agi.c 27 Apr 2003 21:10:09 -0000
@@ -914,7 +914,7 @@
" Usage: NOOP\n"
" Does nothing.\n";
-agi_command commands[] = {
+static agi_command commands[] = {
{ { "answer", NULL }, handle_answer, "Asserts answer", usage_answer },
{ { "wait", "for", "digit", NULL }, handle_waitfordigit, "Waits for a digit to be pressed", usage_waitfordigit },
{ { "send", "text", NULL }, handle_sendtext, "Sends text to channels supporting it", usage_sendtext },
@@ -1343,10 +1343,10 @@
"Usage: dump agihtml <filename>\n"
" Dumps the agi command list in html format to given filename\n";
-struct ast_cli_entry showagi =
+static struct ast_cli_entry showagi =
{ { "show", "agi", NULL }, handle_showagi, "Show AGI commands or specific help", showagi_help };
-struct ast_cli_entry dumpagihtml =
+static struct ast_cli_entry dumpagihtml =
{ { "dump", "agihtml", NULL }, handle_dumpagihtml, "Dumps a list of agi command in html format", dumpagihtml_help };
int unload_module(void)
Index: apps/app_disa.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_disa.c,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 app_disa.c
--- apps/app_disa.c 7 Mar 2003 06:00:09 -0000 1.1.1.2
+++ apps/app_disa.c 27 Apr 2003 21:10:10 -0000
@@ -83,8 +83,8 @@
static float loudness=4096.0;
-int firstdigittimeout = 20000; /* 20 seconds first digit timeout */
-int digittimeout = 10000; /* 10 seconds subsequent digit timeout */
+static int firstdigittimeout = 20000; /* 20 seconds first digit timeout */
+static int digittimeout = 10000; /* 10 seconds subsequent digit timeout */
static void make_tone_block(unsigned char *data, float f1, float f2, int len, int *x)
{
Index: apps/app_qcall.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_qcall.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 app_qcall.c
--- apps/app_qcall.c 12 Feb 2003 13:59:14 -0000 1.1.1.1
+++ apps/app_qcall.c 27 Apr 2003 21:10:10 -0000
@@ -73,7 +73,7 @@
#include <sys/file.h>
#include "../astconf.h"
-char qdir[255];
+static char qdir[255];
static char *tdesc = "Call from Queue";
static pthread_t qcall_thread;
static int debug = 0;
Index: apps/app_voicemail.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_voicemail.c,v
retrieving revision 1.9
diff -u -r1.9 app_voicemail.c
--- apps/app_voicemail.c 15 Apr 2003 00:19:27 -0000 1.9
+++ apps/app_voicemail.c 27 Apr 2003 21:10:13 -0000
@@ -64,11 +64,11 @@
#define BASELINELEN 72
#define eol "\r\n"
-int iocp;
-int iolen;
-int linelength;
-int ateof;
-unsigned char iobuf[BASEMAXINLINE];
+static int iocp;
+static int iolen;
+static int linelength;
+static int ateof;
+static unsigned char iobuf[BASEMAXINLINE];
static char *tdesc = "Comedian Mail (Voicemail System)";
Index: channels/alaw.h
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/alaw.h,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 alaw.h
--- channels/alaw.h 12 Feb 2003 13:59:14 -0000 1.1.1.1
+++ channels/alaw.h 27 Apr 2003 21:10:15 -0000
@@ -23,7 +23,7 @@
// table to convert unsigned a-law bytes to signed linear integers
-const int alaw2int[256] = {
+static const int alaw2int[256] = {
-5504,5504,-344,344,-22016,22016,-1376,1376,-2752,2752,-88,88,-11008,11008,
-688,688,-7552,7552,-472,472,-30208,30208,-1888,1888,-3776,3776,-216,216,
-15104,15104,-944,944,-4480,4480,-280,280,-17920,17920,-1120,1120,-2240,2240,
@@ -50,7 +50,7 @@
// shift the integer to be 12+1 bit first, then add 4096 to get
// the right index
-const unsigned char int2alaw[8192] = {
+static const unsigned char int2alaw[8192] = {
84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,
84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,
84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,
Index: channels/chan_iax.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_iax.c,v
retrieving revision 1.6
diff -u -r1.6 chan_iax.c
--- channels/chan_iax.c 24 Apr 2003 23:35:17 -0000 1.6
+++ channels/chan_iax.c 27 Apr 2003 21:10:22 -0000
@@ -93,7 +93,7 @@
static int usecnt;
static pthread_mutex_t usecnt_lock = AST_MUTEX_INITIALIZER;
-int (*regfunk)(char *username, int onoff) = NULL;
+int (*iax_regfunk)(char *username, int onoff) = NULL;
/* Ethernet, etc */
#define IAX_CAPABILITY_FULLBANDWIDTH 0xFFFF
@@ -218,7 +218,7 @@
struct iax_registry *next;
};
-struct iax_registry *registrations;
+static struct iax_registry *registrations;
/* Don't retry more frequently than every 10 ms, or less frequently than every 5 seconds */
#define MIN_RETRY_TIME 10
@@ -426,10 +426,10 @@
struct iax_dpcache *peer; /* For linking in peers */
} *dpcache;
-pthread_mutex_t dpcache_lock;
+static pthread_mutex_t dpcache_lock;
#ifdef DEBUG_SUPPORT
-void showframe(struct ast_iax_frame *f, struct ast_iax_full_hdr *fhi, int rx, struct sockaddr_in *sin)
+static void showframe(struct ast_iax_frame *f, struct ast_iax_full_hdr *fhi, int rx, struct sockaddr_in *sin)
{
char *frames[] = {
"(0?)",
@@ -4501,7 +4501,7 @@
}
-void delete_users(void){
+static void delete_users(void){
struct iax_user *user, *userlast;
struct iax_peer *peer;
struct iax_registry *reg, *regl;
@@ -4535,7 +4535,7 @@
ast_pthread_mutex_unlock(&peerl.lock);
}
-void prune_peers(void){
+static void prune_peers(void){
/* Prune peers who still are supposed to be deleted */
struct iax_peer *peer, *peerlast, *peernext;
int x;
Index: channels/chan_iax2.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_iax2.c,v
retrieving revision 1.15
diff -u -r1.15 chan_iax2.c
--- channels/chan_iax2.c 24 Apr 2003 23:35:17 -0000 1.15
+++ channels/chan_iax2.c 27 Apr 2003 21:10:28 -0000
@@ -109,7 +109,7 @@
static int usecnt;
static pthread_mutex_t usecnt_lock = AST_MUTEX_INITIALIZER;
-int (*regfunk)(char *username, int onoff) = NULL;
+int (*iax2_regfunk)(char *username, int onoff) = NULL;
/* Ethernet, etc */
#define IAX_CAPABILITY_FULLBANDWIDTH 0xFFFF
@@ -244,7 +244,7 @@
struct iax2_registry *next;
};
-struct iax2_registry *registrations;
+static struct iax2_registry *registrations;
/* Don't retry more frequently than every 10 ms, or less frequently than every 5 seconds */
#define MIN_RETRY_TIME 10
@@ -429,7 +429,7 @@
struct iax2_dpcache *peer; /* For linking in peers */
} *dpcache;
-pthread_mutex_t dpcache_lock;
+static pthread_mutex_t dpcache_lock;
static void iax_debug_output(const char *data)
{
@@ -4808,7 +4808,7 @@
}
-void delete_users(void){
+static void delete_users(void){
struct iax2_user *user, *userlast;
struct iax2_peer *peer;
struct iax2_registry *reg, *regl;
@@ -4842,7 +4842,7 @@
ast_pthread_mutex_unlock(&peerl.lock);
}
-void prune_peers(void){
+static void prune_peers(void){
/* Prune peers who still are supposed to be deleted */
struct iax2_peer *peer, *peerlast, *peernext;
int x;
Index: channels/chan_mgcp.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_mgcp.c,v
retrieving revision 1.7
diff -u -r1.7 chan_mgcp.c
--- channels/chan_mgcp.c 14 Apr 2003 20:48:30 -0000 1.7
+++ channels/chan_mgcp.c 27 Apr 2003 21:10:30 -0000
@@ -155,7 +155,7 @@
struct mgcp_gateway *parent;
};
-struct mgcp_gateway {
+static struct mgcp_gateway {
/* A gateway containing one or more endpoints */
char name[80];
struct sockaddr_in addr;
@@ -293,7 +293,7 @@
} ifr_ifru;
};
-struct in_addr *lookup_iface(char *iface) {
+static struct in_addr *lookup_iface(char *iface) {
int mysock;
int res;
static struct my_ifreq ifreq;
@@ -1694,7 +1694,7 @@
return tmpc;
}
-struct mgcp_gateway *build_gateway(char *cat, struct ast_variable *v)
+static struct mgcp_gateway *build_gateway(char *cat, struct ast_variable *v)
{
struct mgcp_gateway *gw;
struct mgcp_endpoint *e;
Index: channels/chan_modem_aopen.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_modem_aopen.c,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 chan_modem_aopen.c
--- channels/chan_modem_aopen.c 16 Mar 2003 22:37:29 -0000 1.1.1.2
+++ channels/chan_modem_aopen.c 27 Apr 2003 21:10:31 -0000
@@ -33,8 +33,8 @@
static char *desc = "A/Open (Rockwell Chipset) ITU-2 VoiceModem Driver";
-int usecnt;
-pthread_mutex_t usecnt_lock = AST_MUTEX_INITIALIZER;
+static int usecnt;
+static pthread_mutex_t usecnt_lock = AST_MUTEX_INITIALIZER;
static char *aopen_idents[] = {
/* Identify A/Open Modem */
Index: channels/chan_modem_bestdata.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_modem_bestdata.c,v
retrieving revision 1.2
diff -u -r1.2 chan_modem_bestdata.c
--- channels/chan_modem_bestdata.c 30 Mar 2003 22:55:42 -0000 1.2
+++ channels/chan_modem_bestdata.c 27 Apr 2003 21:10:31 -0000
@@ -38,8 +38,8 @@
static char *desc = "BestData (Conexant V.90 Chipset) VoiceModem Driver";
-int usecnt;
-pthread_mutex_t usecnt_lock = AST_MUTEX_INITIALIZER;
+static int usecnt;
+static pthread_mutex_t usecnt_lock = AST_MUTEX_INITIALIZER;
static char *bestdata_idents[] = {
/* Identify BestData Modem */
Index: channels/chan_modem_i4l.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_modem_i4l.c,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 chan_modem_i4l.c
--- channels/chan_modem_i4l.c 10 Mar 2003 06:00:15 -0000 1.1.1.2
+++ channels/chan_modem_i4l.c 27 Apr 2003 21:10:32 -0000
@@ -33,8 +33,8 @@
static char *desc = "ISDN4Linux Emulated Modem Driver";
-int usecnt;
-pthread_mutex_t usecnt_lock = AST_MUTEX_INITIALIZER;
+static int usecnt;
+static pthread_mutex_t usecnt_lock = AST_MUTEX_INITIALIZER;
static char *i4l_idents[] = {
/* Identify ISDN4Linux Driver */
Index: channels/chan_oss.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_oss.c,v
retrieving revision 1.4
diff -u -r1.4 chan_oss.c
--- channels/chan_oss.c 27 Apr 2003 18:13:11 -0000 1.4
+++ channels/chan_oss.c 27 Apr 2003 21:10:32 -0000
@@ -75,7 +75,7 @@
static char language[MAX_LANGUAGE] = "";
static char exten[AST_MAX_EXTENSION] = "s";
-int hookstate=0;
+static int hookstate=0;
static short silence[FRAME_SIZE] = {0, };
@@ -123,7 +123,7 @@
with 160 sample frames, and a buffer size of 3, we have a 60ms buffer,
usually plenty. */
-pthread_t sthread;
+static pthread_t sthread;
#define MAX_BUFFER_SIZE 100
static int buffersize = 3;
Index: channels/chan_sip.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_sip.c,v
retrieving revision 1.92
diff -u -r1.92 chan_sip.c
--- channels/chan_sip.c 25 Apr 2003 03:56:46 -0000 1.92
+++ channels/chan_sip.c 27 Apr 2003 21:10:38 -0000
@@ -343,7 +343,7 @@
#define REINVITE_UPDATE 2
static int sip_do_register(struct sip_registry *r);
-struct sip_registry *registrations;
+static struct sip_registry *registrations;
static int sipsock = -1;
static int globalnat = 0;
@@ -361,7 +361,7 @@
static int transmit_info_with_digit(struct sip_pvt *p, char digit);
static int transmit_message_with_text(struct sip_pvt *p, char *text);
static int do_proxy_auth(struct sip_pvt *p, struct sip_request *req);
-char *getsipuri(char *header);
+static char *getsipuri(char *header);
static void free_old_route(struct sip_route *route);
static int build_reply_digest(struct sip_pvt *p, char *orig_header, char *digest, int digest_len);
@@ -848,7 +848,7 @@
struct sockaddr_in ifru_addr;
};
-struct in_addr *lookup_iface(char *iface) {
+static struct in_addr *lookup_iface(char *iface) {
int mysock;
int res;
static struct my_ifreq ifreq;
@@ -5350,7 +5350,7 @@
return res;
}
-void delete_users(void)
+static void delete_users(void)
{
struct sip_user *user, *userlast;
struct sip_peer *peer;
@@ -5384,7 +5384,7 @@
ast_pthread_mutex_unlock(&peerl.lock);
}
-void prune_peers(void)
+static void prune_peers(void)
{
/* Prune peers who still are supposed to be deleted */
struct sip_peer *peer, *peerlast, *peernext;
@@ -5502,7 +5502,7 @@
return desc;
}
-char *getsipuri(char *header)
+static char *getsipuri(char *header)
{
char *c, *d, *retval;
int n;
--
Thorsten Lockert | tholo at sigmasoft.com | Universe, n.:
2121 N. Lakeshore Dr. | tholo at openbsd.org | The problem.
Chapel Hill, NC 27514 | |
More information about the asterisk-dev
mailing list