Optimization, omit unnecessary calls to debug functions

This commit is contained in:
MelwareDE 2009-03-10 22:39:04 +00:00
parent 55de14b36c
commit 8a209fc690
2 changed files with 19 additions and 10 deletions

View File

@ -45,9 +45,9 @@ static struct peerlink_s {
} peerlinkchannel[CAPI_MAX_PEERLINKCHANNELS];
/*
* helper for <pbx>_verbose with different verbose settings
* helper for <pbx>_verbose
*/
void cc_verbose(int o_v, int c_d, char *text, ...)
void cc_verbose_internal(char *text, ...)
{
char line[4096];
va_list ap;
@ -55,6 +55,7 @@ void cc_verbose(int o_v, int c_d, char *text, ...)
va_start(ap, text);
vsnprintf(line, sizeof(line), text, ap);
va_end(ap);
line[sizeof(line)-1]=0;
#if 0
{
@ -66,13 +67,9 @@ void cc_verbose(int o_v, int c_d, char *text, ...)
}
#endif
if ((o_v == 0) || (option_verbose > o_v)) {
if ((!c_d) || ((c_d) && (capidebug))) {
cc_mutex_lock(&verbose_lock);
cc_pbx_verbose(line);
cc_mutex_unlock(&verbose_lock);
}
}
cc_mutex_lock(&verbose_lock);
cc_pbx_verbose(line);
cc_mutex_unlock(&verbose_lock);
}
/*

View File

@ -18,7 +18,19 @@
extern int capidebug;
extern char *emptyid;
extern void cc_verbose(int o_v, int c_d, char *text, ...);
extern void cc_verbose_internal(char *text, ...);
/*
* helper for <pbx>_verbose with different verbose settings
*/
#define cc_verbose(o_v,c_d,text, args...) do { \
if ((o_v == 0) || (option_verbose > o_v)) { \
if ((!c_d) || ((c_d) && (capidebug))) { \
cc_verbose_internal(text , ## args); \
} \
} \
}while(0)
extern _cword get_capi_MessageNumber(void);
extern struct capi_pvt *capi_find_interface_by_msgnum(unsigned short msgnum);
extern struct capi_pvt *capi_find_interface_by_plci(unsigned int plci);