Skip to content

Commit

Permalink
fix a few small things found by using sparse
Browse files Browse the repository at this point in the history
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@152809 65c4cc65-6c06-0410-ace0-fbb531ad65f3
  • Loading branch information
Kevin P. Fleming committed Oct 30, 2008
1 parent de90c84 commit 10d36d9
Show file tree
Hide file tree
Showing 10 changed files with 39 additions and 32 deletions.
2 changes: 1 addition & 1 deletion apps/app_adsiprog.c
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,7 @@ static int onevent(char *buf, char *name, int id, char *args, struct adsi_script
ast_log(LOG_WARNING, "'%s' is not a valid state name at line %d of %s\n", tok, lineno, script);
return 0;
}
if ((snums[scnt] = getstatebyname(state, sname, script, lineno, 0) < 0)) {
if ((snums[scnt] = getstatebyname(state, sname, script, lineno, 0) == NULL)) {
ast_log(LOG_WARNING, "State '%s' not declared at line %d of %s\n", sname, lineno, script);
return 0;
}
Expand Down
25 changes: 16 additions & 9 deletions channels/misdn/isdn_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@
#include "isdn_lib_intern.h"
#include "isdn_lib.h"

enum event_response_e (*cb_event) (enum event_e event, struct misdn_bchannel *bc, void *user_data);

void (*cb_log) (int level, int port, char *tmpl, ...)
__attribute__ ((format (printf, 3, 4)));

int (*cb_jb_empty)(struct misdn_bchannel *bc, char *buffer, int len);


/*
* Define ARRAY_LEN() because I cannot
* #include "asterisk/utils.h"
Expand Down Expand Up @@ -259,8 +267,8 @@ static int entity;

static struct misdn_lib *glob_mgr;

char tone_425_flip[TONE_425_SIZE];
char tone_silence_flip[TONE_SILENCE_SIZE];
static char tone_425_flip[TONE_425_SIZE];
static char tone_silence_flip[TONE_SILENCE_SIZE];

static void misdn_lib_isdn_event_catcher(void *arg);
static int handle_event_nt(void *dat, void *arg);
Expand Down Expand Up @@ -472,7 +480,7 @@ static void dump_chan_list(struct misdn_stack *stack)
}


void misdn_dump_chanlist()
void misdn_dump_chanlist(void)
{
struct misdn_stack *stack=get_misdn_stack();
for ( ; stack; stack=stack->next) {
Expand All @@ -481,7 +489,7 @@ void misdn_dump_chanlist()

}

int set_chan_in_stack(struct misdn_stack *stack, int channel)
static int set_chan_in_stack(struct misdn_stack *stack, int channel)
{

cb_log(4,stack->port,"set_chan_in_stack: %d\n",channel);
Expand Down Expand Up @@ -1838,7 +1846,7 @@ int release_cr(struct misdn_stack *stack, mISDNuser_head_t *hh)
return 0 ;
}

int
static int
handle_event_nt(void *dat, void *arg)
{
manager_t *mgr = (manager_t *)dat;
Expand Down Expand Up @@ -3079,7 +3087,7 @@ static void misdn_lib_isdn_event_catcher(void *arg)

/** App Interface **/

int te_lib_init() {
int te_lib_init(void) {
char buff[1025] = "";
iframe_t *frm=(iframe_t*)buff;
int midev=mISDN_open();
Expand Down Expand Up @@ -3888,7 +3896,7 @@ int misdn_lib_port_restart(int port)



sem_t handler_started;
static sem_t handler_started;

/* This is a thread */
static void manager_event_handler(void *arg)
Expand Down Expand Up @@ -4037,7 +4045,6 @@ void misdn_lib_nt_debug_init( int flags, char *file )
}
}


int misdn_lib_init(char *portlist, struct misdn_lib_iface *iface, void *user_data)
{
struct misdn_lib *mgr=calloc(1, sizeof(struct misdn_lib));
Expand Down Expand Up @@ -4560,7 +4567,7 @@ void manager_ec_disable(struct misdn_bchannel *bc)
#endif
}

struct misdn_stack* get_misdn_stack() {
struct misdn_stack* get_misdn_stack(void) {
return glob_mgr->stack_list;
}

Expand Down
8 changes: 5 additions & 3 deletions channels/misdn/isdn_lib.h
Original file line number Diff line number Diff line change
Expand Up @@ -567,10 +567,12 @@ struct misdn_bchannel {
};


enum event_response_e (*cb_event) (enum event_e event, struct misdn_bchannel *bc, void *user_data);
void (*cb_log) (int level, int port, char *tmpl, ...)
extern enum event_response_e (*cb_event) (enum event_e event, struct misdn_bchannel *bc, void *user_data);

extern void (*cb_log) (int level, int port, char *tmpl, ...)
__attribute__ ((format (printf, 3, 4)));
int (*cb_jb_empty)(struct misdn_bchannel *bc, char *buffer, int len);

extern int (*cb_jb_empty)(struct misdn_bchannel *bc, char *buffer, int len);

struct misdn_lib_iface {
enum event_response_e (*cb_event)(enum event_e event, struct misdn_bchannel *bc, void *user_data);
Expand Down
2 changes: 2 additions & 0 deletions channels/misdn/isdn_lib_intern.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@
#endif


#if 0
ibuffer_t *astbuf; /* Not used */
ibuffer_t *misdnbuf; /* Not used */
#endif

struct send_lock {
pthread_mutex_t lock;
Expand Down
3 changes: 2 additions & 1 deletion codecs/lpc10/chanwr.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Some OSS fixes and a few lpc changes to make it actually work
-lf2c -lm (in that order)
*/

#include <stdlib.h>
#include "f2c.h"

/* *********************************************************************** */
Expand Down Expand Up @@ -228,5 +229,5 @@ Some OSS fixes and a few lpc changes to make it actually work
/* Subroutine */ int chanrd_(integer *order, integer *ipitv, integer *irms,
integer *irc, integer *ibits)
{
return chanwr_0_(1, order, ipitv, irms, irc, ibits, 0);
return chanwr_0_(1, order, ipitv, irms, irc, ibits, NULL);
}
8 changes: 1 addition & 7 deletions main/asterisk.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ int daemon(int, int); /* defined in libresolv of all places */
#include "asterisk/devicestate.h"
#include "asterisk/module.h"
#include "asterisk/dsp.h"
#include "asterisk/buildinfo.h"

#include "asterisk/doxyref.h" /* Doxygen documentation */

Expand Down Expand Up @@ -246,13 +247,6 @@ static char ast_config_AST_CTL_OWNER[PATH_MAX] = "\0";
static char ast_config_AST_CTL_GROUP[PATH_MAX] = "\0";
static char ast_config_AST_CTL[PATH_MAX] = "asterisk.ctl";

extern const char *ast_build_hostname;
extern const char *ast_build_kernel;
extern const char *ast_build_machine;
extern const char *ast_build_os;
extern const char *ast_build_date;
extern const char *ast_build_user;

static char *_argv[256];
static int shuttingdown;
static int restartnow;
Expand Down
1 change: 1 addition & 0 deletions main/buildinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
* \author Kevin P. Fleming <[email protected]>
*/

#include "asterisk/buildinfo.h"
#include "asterisk/build.h"

const char *ast_build_hostname = BUILD_HOSTNAME;
Expand Down
18 changes: 9 additions & 9 deletions main/dial.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,15 @@ struct ast_dial {

/*! \brief Dialing channel structure. Contains per-channel dialing options, asterisk channel, and more! */
struct ast_dial_channel {
int num; /*!< Unique number for dialed channel */
int timeout; /*!< Maximum time allowed for attempt */
char *tech; /*!< Technology being dialed */
char *device; /*!< Device being dialed */
void *options[AST_DIAL_OPTION_MAX]; /*!< Channel specific options */
int cause; /*!< Cause code in case of failure */
int is_running_app:1; /*!< Is this running an application? */
struct ast_channel *owner; /*!< Asterisk channel */
AST_LIST_ENTRY(ast_dial_channel) list; /*!< Linked list information */
int num; /*!< Unique number for dialed channel */
int timeout; /*!< Maximum time allowed for attempt */
char *tech; /*!< Technology being dialed */
char *device; /*!< Device being dialed */
void *options[AST_DIAL_OPTION_MAX]; /*!< Channel specific options */
int cause; /*!< Cause code in case of failure */
unsigned int is_running_app:1; /*!< Is this running an application? */
struct ast_channel *owner; /*!< Asterisk channel */
AST_LIST_ENTRY(ast_dial_channel) list; /*!< Linked list information */
};

/*! \brief Typedef for dial option enable */
Expand Down
2 changes: 1 addition & 1 deletion main/dnsmgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ struct ast_dnsmgr_entry {
/*! SRV record to lookup, if provided. Composed of service, protocol, and domain name: _Service._Proto.Name */
char *service;
/*! Set to 1 if the entry changes */
int changed:1;
unsigned int changed:1;
ast_mutex_t lock;
AST_RWLIST_ENTRY(ast_dnsmgr_entry) list;
/*! just 1 here, but we use calloc to allocate the correct size */
Expand Down
2 changes: 1 addition & 1 deletion utils/astcanary.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
* Asterisk itself.
*/

const char explanation[] =
static const char explanation[] =
"This file is created when Asterisk is run with a realtime priority (-p). It\n"
"must continue to exist, and the astcanary process must be allowed to continue\n"
"running, or else the Asterisk process will, within a short period of time,\n"
Expand Down

0 comments on commit 10d36d9

Please sign in to comment.