[asterisk-commits] russell: branch russell/chan_refcount r105897 - in /team/russell/chan_refcoun...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Mar 4 18:35:52 CST 2008
Author: russell
Date: Tue Mar 4 18:35:51 2008
New Revision: 105897
URL: http://svn.digium.com/view/asterisk?view=rev&rev=105897
Log:
resolve, reset
Modified:
team/russell/chan_refcount/ (props changed)
team/russell/chan_refcount/apps/app_queue.c
team/russell/chan_refcount/channels/chan_zap.c
team/russell/chan_refcount/channels/console_gui.c
team/russell/chan_refcount/main/alaw.c
team/russell/chan_refcount/main/app.c
team/russell/chan_refcount/main/asterisk.c
team/russell/chan_refcount/main/astobj2.c
team/russell/chan_refcount/main/callerid.c
team/russell/chan_refcount/main/channel.c
team/russell/chan_refcount/main/cli.c
team/russell/chan_refcount/main/config.c
team/russell/chan_refcount/main/cryptostub.c
team/russell/chan_refcount/main/dial.c
team/russell/chan_refcount/main/dlfcn.c
team/russell/chan_refcount/main/dns.c
team/russell/chan_refcount/main/dsp.c
team/russell/chan_refcount/main/enum.c
team/russell/chan_refcount/main/features.c
team/russell/chan_refcount/main/file.c
team/russell/chan_refcount/main/frame.c
team/russell/chan_refcount/main/fskmodem.c
team/russell/chan_refcount/main/image.c
team/russell/chan_refcount/main/jitterbuf.c
team/russell/chan_refcount/main/loader.c
team/russell/chan_refcount/main/logger.c
team/russell/chan_refcount/main/manager.c
team/russell/chan_refcount/main/netsock.c
team/russell/chan_refcount/main/pbx.c
team/russell/chan_refcount/main/poll.c
team/russell/chan_refcount/main/rtp.c
team/russell/chan_refcount/main/say.c
team/russell/chan_refcount/main/strcompat.c
team/russell/chan_refcount/main/tdd.c
team/russell/chan_refcount/main/term.c
team/russell/chan_refcount/main/translate.c
team/russell/chan_refcount/main/utils.c
Propchange: team/russell/chan_refcount/
------------------------------------------------------------------------------
automerge = *
Propchange: team/russell/chan_refcount/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Tue Mar 4 18:35:51 2008
@@ -1,1 +1,1 @@
-/trunk:1-104106,104108-105834
+/trunk:1-104106,104108-105896
Modified: team/russell/chan_refcount/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/russell/chan_refcount/apps/app_queue.c?view=diff&rev=105897&r1=105896&r2=105897
==============================================================================
--- team/russell/chan_refcount/apps/app_queue.c (original)
+++ team/russell/chan_refcount/apps/app_queue.c Tue Mar 4 18:35:51 2008
@@ -583,7 +583,7 @@
if (qe->parent->callscompleted > 0)
sl = 100 * ((float) qe->parent->callscompletedinsl / (float) qe->parent->callscompleted);
- snprintf(interfacevar,sizeof(interfacevar),
+ snprintf(interfacevar, sizeof(interfacevar),
"QUEUENAME=%s|QUEUEMAX=%d|QUEUESTRATEGY=%s|QUEUECALLS=%d|QUEUEHOLDTIME=%d|QUEUECOMPLETED=%d|QUEUEABANDONED=%d|QUEUESRVLEVEL=%d|QUEUESRVLEVELPERF=%2.1f",
qe->parent->name, qe->parent->maxlen, int2strat(qe->parent->strategy), qe->parent->count, qe->parent->holdtime, qe->parent->callscompleted,
qe->parent->callsabandoned, qe->parent->servicelevel, sl);
@@ -2735,8 +2735,8 @@
min_penalty = 0;
if (min_penalty > max_penalty)
min_penalty = max_penalty;
- snprintf(max_penalty_str, sizeof(max_penalty_str) - 1, "%d", max_penalty);
- snprintf(min_penalty_str, sizeof(min_penalty_str) - 1, "%d", min_penalty);
+ snprintf(max_penalty_str, sizeof(max_penalty_str), "%d", max_penalty);
+ snprintf(min_penalty_str, sizeof(min_penalty_str), "%d", min_penalty);
pbx_builtin_setvar_helper(qe->chan, "QUEUE_MAX_PENALTY", max_penalty_str);
pbx_builtin_setvar_helper(qe->chan, "QUEUE_MIN_PENALTY", min_penalty_str);
qe->max_penalty = max_penalty;
@@ -3340,7 +3340,7 @@
/* if setinterfacevar is defined, make member variables available to the channel */
/* use pbx_builtin_setvar to set a load of variables with one call */
if (qe->parent->setinterfacevar) {
- snprintf(interfacevar,sizeof(interfacevar), "MEMBERINTERFACE=%s|MEMBERNAME=%s|MEMBERCALLS=%d|MEMBERLASTCALL=%ld|MEMBERPENALTY=%d|MEMBERDYNAMIC=%d|MEMBERREALTIME=%d",
+ snprintf(interfacevar, sizeof(interfacevar), "MEMBERINTERFACE=%s|MEMBERNAME=%s|MEMBERCALLS=%d|MEMBERLASTCALL=%ld|MEMBERPENALTY=%d|MEMBERDYNAMIC=%d|MEMBERREALTIME=%d",
member->interface, member->membername, member->calls, (long)member->lastcall, member->penalty, member->dynamic, member->realtime);
pbx_builtin_setvar(qe->chan, interfacevar);
}
@@ -3348,7 +3348,7 @@
/* if setqueueentryvar is defined, make queue entry (i.e. the caller) variables available to the channel */
/* use pbx_builtin_setvar to set a load of variables with one call */
if (qe->parent->setqueueentryvar) {
- snprintf(interfacevar,sizeof(interfacevar), "QEHOLDTIME=%ld|QEORIGINALPOS=%d",
+ snprintf(interfacevar, sizeof(interfacevar), "QEHOLDTIME=%ld|QEORIGINALPOS=%d",
(long) time(NULL) - qe->start, qe->opos);
pbx_builtin_setvar(qe->chan, interfacevar);
}
@@ -4581,7 +4581,7 @@
if (q->callscompleted > 0)
sl = 100 * ((float) q->callscompletedinsl / (float) q->callscompleted);
- snprintf(interfacevar,sizeof(interfacevar),
+ snprintf(interfacevar, sizeof(interfacevar),
"QUEUEMAX=%d|QUEUESTRATEGY=%s|QUEUECALLS=%d|QUEUEHOLDTIME=%d|QUEUECOMPLETED=%d|QUEUEABANDONED=%d|QUEUESRVLEVEL=%d|QUEUESRVLEVELPERF=%2.1f",
q->maxlen, int2strat(q->strategy), q->count, q->holdtime, q->callscompleted, q->callsabandoned, q->servicelevel, sl);
Modified: team/russell/chan_refcount/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/team/russell/chan_refcount/channels/chan_zap.c?view=diff&rev=105897&r1=105896&r2=105897
==============================================================================
--- team/russell/chan_refcount/channels/chan_zap.c (original)
+++ team/russell/chan_refcount/channels/chan_zap.c Tue Mar 4 18:35:51 2008
@@ -10597,7 +10597,7 @@
}
#endif
- snprintf(calledtonstr, sizeof(calledtonstr)-1, "%d", e->ring.calledplan);
+ snprintf(calledtonstr, sizeof(calledtonstr), "%d", e->ring.calledplan);
pbx_builtin_setvar_helper(c, "CALLEDTON", calledtonstr);
if (e->ring.redirectingreason >= 0)
pbx_builtin_setvar_helper(c, "PRIREDIRECTREASON", redirectingreason2str(e->ring.redirectingreason));
@@ -10642,7 +10642,7 @@
if (e->ring.redirectingreason >= 0)
pbx_builtin_setvar_helper(c, "PRIREDIRECTREASON", redirectingreason2str(e->ring.redirectingreason));
- snprintf(calledtonstr, sizeof(calledtonstr)-1, "%d", e->ring.calledplan);
+ snprintf(calledtonstr, sizeof(calledtonstr), "%d", e->ring.calledplan);
pbx_builtin_setvar_helper(c, "CALLEDTON", calledtonstr);
ast_mutex_lock(&pri->pvts[chanpos]->lock);
@@ -12512,7 +12512,7 @@
astman_send_ack(s, m, "Zapata channel status will follow");
if (!ast_strlen_zero(id))
- snprintf(idText, sizeof(idText) - 1, "ActionID: %s\r\n", id);
+ snprintf(idText, sizeof(idText), "ActionID: %s\r\n", id);
ast_mutex_lock(&iflock);
Modified: team/russell/chan_refcount/channels/console_gui.c
URL: http://svn.digium.com/view/asterisk/team/russell/chan_refcount/channels/console_gui.c?view=diff&rev=105897&r1=105896&r2=105897
==============================================================================
--- team/russell/chan_refcount/channels/console_gui.c (original)
+++ team/russell/chan_refcount/channels/console_gui.c Tue Mar 4 18:35:51 2008
@@ -306,7 +306,7 @@
char buf[160];
const char *who = ast_skip_blanks(read_message(gui->bd_msg));
buf[sizeof(buf) - 1] = '\0';
- snprintf(buf, sizeof(buf) - 1, "console dial %s", who);
+ snprintf(buf, sizeof(buf), "console dial %s", who);
ast_log(LOG_WARNING, "doing <%s>\n", buf);
print_message(gui->bd_dialed, "\n");
print_message(gui->bd_dialed, who);
Modified: team/russell/chan_refcount/main/alaw.c
URL: http://svn.digium.com/view/asterisk/team/russell/chan_refcount/main/alaw.c?view=diff&rev=105897&r1=105896&r2=105897
==============================================================================
--- team/russell/chan_refcount/main/alaw.c (original)
+++ team/russell/chan_refcount/main/alaw.c Tue Mar 4 18:35:51 2008
@@ -34,31 +34,32 @@
static inline unsigned char linear2alaw(short int linear)
{
- int mask;
- int seg;
- int pcm_val;
- static int seg_end[8] =
+ int mask;
+ int seg;
+ int pcm_val;
+ static int seg_end[8] =
{
0xFF, 0x1FF, 0x3FF, 0x7FF, 0xFFF, 0x1FFF, 0x3FFF, 0x7FFF
};
-
- pcm_val = linear;
- if (pcm_val >= 0) {
- /* Sign (7th) bit = 1 */
- mask = AMI_MASK | 0x80;
- } else {
- /* Sign bit = 0 */
- mask = AMI_MASK;
- pcm_val = -pcm_val;
- }
-
- /* Convert the scaled magnitude to segment number. */
- for (seg = 0; seg < 8; seg++) {
- if (pcm_val <= seg_end[seg])
- break;
- }
- /* Combine the sign, segment, and quantization bits. */
- return ((seg << 4) | ((pcm_val >> ((seg) ? (seg + 3) : 4)) & 0x0F)) ^ mask;
+
+ pcm_val = linear;
+ if (pcm_val >= 0) {
+ /* Sign (7th) bit = 1 */
+ mask = AMI_MASK | 0x80;
+ } else {
+ /* Sign bit = 0 */
+ mask = AMI_MASK;
+ pcm_val = -pcm_val;
+ }
+
+ /* Convert the scaled magnitude to segment number. */
+ for (seg = 0; seg < 8; seg++) {
+ if (pcm_val <= seg_end[seg]) {
+ break;
+ }
+ }
+ /* Combine the sign, segment, and quantization bits. */
+ return ((seg << 4) | ((pcm_val >> ((seg) ? (seg + 3) : 4)) & 0x0F)) ^ mask;
}
#else
static unsigned char linear2alaw(short sample, int full_coding)
@@ -107,15 +108,16 @@
#ifndef G711_NEW_ALGORITHM
static inline short int alaw2linear (unsigned char alaw)
{
- int i;
- int seg;
-
- alaw ^= AMI_MASK;
- i = ((alaw & 0x0F) << 4) + 8 /* rounding error */;
- seg = (((int) alaw & 0x70) >> 4);
- if (seg)
- i = (i + 0x100) << (seg - 1);
- return (short int) ((alaw & 0x80) ? i : -i);
+ int i;
+ int seg;
+
+ alaw ^= AMI_MASK;
+ i = ((alaw & 0x0F) << 4) + 8 /* rounding error */;
+ seg = (((int) alaw & 0x70) >> 4);
+ if (seg) {
+ i = (i + 0x100) << (seg - 1);
+ }
+ return (short int) ((alaw & 0x80) ? i : -i);
}
#else
static inline short alaw2linear(unsigned char alawbyte)
Modified: team/russell/chan_refcount/main/app.c
URL: http://svn.digium.com/view/asterisk/team/russell/chan_refcount/main/app.c?view=diff&rev=105897&r1=105896&r2=105897
==============================================================================
--- team/russell/chan_refcount/main/app.c (original)
+++ team/russell/chan_refcount/main/app.c Tue Mar 4 18:35:51 2008
@@ -78,7 +78,7 @@
if ((ts = ast_get_indication_tone(chan->zone, "dial")) && ts->data[0])
res = ast_playtones_start(chan, 0, ts->data, 0);
else
- ast_log(LOG_NOTICE,"Huh....? no dial for indications?\n");
+ ast_log(LOG_NOTICE, "Huh....? no dial for indications?\n");
for (x = strlen(collect); x < maxlen; ) {
res = ast_waitfordigit(chan, timeout);
@@ -118,7 +118,7 @@
s[0] = '\0';
if (!prompt)
- prompt="";
+ prompt = "";
filename = ast_strdupa(prompt);
while ((front = strsep(&filename, "&"))) {
@@ -274,7 +274,7 @@
if ((res = ast_safe_sleep(chan, between)))
break;
} else
- ast_log(LOG_WARNING, "Illegal DTMF character '%c' in string. (0-9*#aAbBcCdD allowed)\n",*ptr);
+ ast_log(LOG_WARNING, "Illegal DTMF character '%c' in string. (0-9*#aAbBcCdD allowed)\n", *ptr);
}
if (peer) {
@@ -312,16 +312,16 @@
short buf[2048 + AST_FRIENDLY_OFFSET / 2];
struct linear_state *ls = data;
struct ast_frame f = {
- .frametype = AST_FRAME_VOICE,
- .subclass = AST_FORMAT_SLINEAR,
- .data = buf + AST_FRIENDLY_OFFSET / 2,
+ .frametype = AST_FRAME_VOICE,
+ .subclass = AST_FORMAT_SLINEAR,
+ .data = buf + AST_FRIENDLY_OFFSET / 2,
.offset = AST_FRIENDLY_OFFSET,
- };
+ };
int res;
len = samples * 2;
if (len > sizeof(buf) - AST_FRIENDLY_OFFSET) {
- ast_log(LOG_WARNING, "Can't generate %d bytes of data!\n" ,len);
+ ast_log(LOG_WARNING, "Can't generate %d bytes of data!\n" , len);
len = sizeof(buf) - AST_FRIENDLY_OFFSET;
}
res = read(ls->fd, buf + AST_FRIENDLY_OFFSET/2, len);
@@ -430,7 +430,7 @@
res = ast_answer(chan);
if (file) {
- if ((end = strchr(file,':'))) {
+ if ((end = strchr(file, ':'))) {
if (!strcasecmp(end, ":end")) {
*end = '\0';
end++;
@@ -974,7 +974,7 @@
ast_free(gi);
}
}
- AST_RWLIST_TRAVERSE_SAFE_END;
+ AST_RWLIST_TRAVERSE_SAFE_END;
AST_RWLIST_UNLOCK(&groups);
return 0;
@@ -1161,7 +1161,7 @@
time(&start);
while ((
#ifdef SOLARIS
- (res = fcntl(pl->fd, F_SETLK, fcntl(pl->fd,F_GETFL)|O_NONBLOCK)) < 0) &&
+ (res = fcntl(pl->fd, F_SETLK, fcntl(pl->fd, F_GETFL) | O_NONBLOCK)) < 0) &&
#else
(res = flock(pl->fd, LOCK_EX | LOCK_NB)) < 0) &&
#endif
Modified: team/russell/chan_refcount/main/asterisk.c
URL: http://svn.digium.com/view/asterisk/team/russell/chan_refcount/main/asterisk.c?view=diff&rev=105897&r1=105896&r2=105897
==============================================================================
--- team/russell/chan_refcount/main/asterisk.c (original)
+++ team/russell/chan_refcount/main/asterisk.c Tue Mar 4 18:35:51 2008
@@ -2201,7 +2201,7 @@
len = lf->cursor - ptr;
if (ast_opt_remote) {
- snprintf(buf, sizeof(buf),"_COMMAND NUMMATCHES \"%s\" \"%s\"", lf->buffer, ptr);
+ snprintf(buf, sizeof(buf), "_COMMAND NUMMATCHES \"%s\" \"%s\"", lf->buffer, ptr);
fdprint(ast_consock, buf);
res = read(ast_consock, buf, sizeof(buf));
buf[res] = '\0';
@@ -2213,7 +2213,7 @@
/* Start with a 2048 byte buffer */
if (!(mbuf = ast_malloc(maxmbuf)))
return (char *)(CC_ERROR);
- snprintf(buf, sizeof(buf),"_COMMAND MATCHESARRAY \"%s\" \"%s\"", lf->buffer, ptr);
+ snprintf(buf, sizeof(buf), "_COMMAND MATCHESARRAY \"%s\" \"%s\"", lf->buffer, ptr);
fdprint(ast_consock, buf);
res = 0;
mbuf[0] = '\0';
@@ -2516,7 +2516,7 @@
ast_copy_string(cfg_paths.config_dir, DEFAULT_CONFIG_DIR, sizeof(cfg_paths.config_dir));
ast_copy_string(cfg_paths.spool_dir, DEFAULT_SPOOL_DIR, sizeof(cfg_paths.spool_dir));
ast_copy_string(cfg_paths.module_dir, DEFAULT_MODULE_DIR, sizeof(cfg_paths.module_dir));
- snprintf(cfg_paths.monitor_dir, sizeof(cfg_paths.monitor_dir) - 1, "%s/monitor", cfg_paths.spool_dir);
+ snprintf(cfg_paths.monitor_dir, sizeof(cfg_paths.monitor_dir), "%s/monitor", cfg_paths.spool_dir);
ast_copy_string(cfg_paths.var_dir, DEFAULT_VAR_DIR, sizeof(cfg_paths.var_dir));
ast_copy_string(cfg_paths.data_dir, DEFAULT_DATA_DIR, sizeof(cfg_paths.data_dir));
ast_copy_string(cfg_paths.log_dir, DEFAULT_LOG_DIR, sizeof(cfg_paths.log_dir));
@@ -2548,7 +2548,7 @@
ast_copy_string(cfg_paths.config_dir, v->value, sizeof(cfg_paths.config_dir));
} else if (!strcasecmp(v->name, "astspooldir")) {
ast_copy_string(cfg_paths.spool_dir, v->value, sizeof(cfg_paths.spool_dir));
- snprintf(cfg_paths.monitor_dir, sizeof(cfg_paths.monitor_dir) - 1, "%s/monitor", v->value);
+ snprintf(cfg_paths.monitor_dir, sizeof(cfg_paths.monitor_dir), "%s/monitor", v->value);
} else if (!strcasecmp(v->name, "astvarlibdir")) {
ast_copy_string(cfg_paths.var_dir, v->value, sizeof(cfg_paths.var_dir));
if (!found.dbdir)
Modified: team/russell/chan_refcount/main/astobj2.c
URL: http://svn.digium.com/view/asterisk/team/russell/chan_refcount/main/astobj2.c?view=diff&rev=105897&r1=105896&r2=105897
==============================================================================
--- team/russell/chan_refcount/main/astobj2.c (original)
+++ team/russell/chan_refcount/main/astobj2.c Tue Mar 4 18:35:51 2008
@@ -82,18 +82,18 @@
void ao2_bt(void)
{
- int c, i;
+ int c, i;
#define N1 20
- void *addresses[N1];
- char **strings;
-
- c = backtrace(addresses, N1);
- strings = backtrace_symbols(addresses,c);
- ast_verbose("backtrace returned: %d\n", c);
- for(i = 0; i < c; i++) {
- ast_verbose("%d: %p %s\n", i, addresses[i], strings[i]);
- }
- free(strings);
+ void *addresses[N1];
+ char **strings;
+
+ c = backtrace(addresses, N1);
+ strings = backtrace_symbols(addresses,c);
+ ast_verbose("backtrace returned: %d\n", c);
+ for(i = 0; i < c; i++) {
+ ast_verbose("%d: %p %s\n", i, addresses[i], strings[i]);
+ }
+ free(strings);
}
#endif
Modified: team/russell/chan_refcount/main/callerid.c
URL: http://svn.digium.com/view/asterisk/team/russell/chan_refcount/main/callerid.c?view=diff&rev=105897&r1=105896&r2=105897
==============================================================================
--- team/russell/chan_refcount/main/callerid.c (original)
+++ team/russell/chan_refcount/main/callerid.c Tue Mar 4 18:35:51 2008
@@ -412,7 +412,7 @@
/* length */
x++;
/* number type */
- switch (cid->rawdata[x]) {
+ switch (cid->rawdata[x]) {
case 0x00: /* unknown */
case 0x01: /* international number */
case 0x02: /* domestic number */
@@ -451,8 +451,8 @@
case 'O': /* service not available */
case 'C': /* pay phone */
case 'S': /* service congested */
- cid->flags |= CID_UNKNOWN_NUMBER;
- ast_debug(2, "no cid reason:%c\n",cid->rawdata[x]);
+ cid->flags |= CID_UNKNOWN_NUMBER;
+ ast_debug(2, "no cid reason:%c\n", cid->rawdata[x]);
break ;
}
x++;
@@ -483,7 +483,7 @@
x++;
/* numbering plan octed 4 */
x++;
- /* numbering plan octed 5 */
+ /* numbering plan octed 5 */
switch (cid->rawdata[x]) {
case 0x00: /* unknown */
case 0x01: /* recommendation E.164 ISDN */
@@ -772,7 +772,7 @@
int vmwi_generate(unsigned char *buf, int active, int mdmf, int codec)
{
unsigned char msg[256];
- int len=0;
+ int len = 0;
int sum;
int x;
int bytes = 0;
@@ -834,7 +834,7 @@
int callerid_generate(unsigned char *buf, const char *number, const char *name, int flags, int callwaiting, int codec)
{
- int bytes=0;
+ int bytes = 0;
int x, sum;
int len;
@@ -881,7 +881,7 @@
*/
void ast_shrink_phone_number(char *n)
{
- int x, y=0;
+ int x, y = 0;
int bracketed = 0;
for (x = 0; n[x]; x++) {
Modified: team/russell/chan_refcount/main/channel.c
URL: http://svn.digium.com/view/asterisk/team/russell/chan_refcount/main/channel.c?view=diff&rev=105897&r1=105896&r2=105897
==============================================================================
--- team/russell/chan_refcount/main/channel.c (original)
+++ team/russell/chan_refcount/main/channel.c Tue Mar 4 18:35:51 2008
@@ -3385,8 +3385,8 @@
\brief Transfer a call to dest, if the channel supports transfer
Called by:
- \arg app_transfer
- \arg the manager interface
+ \arg app_transfer
+ \arg the manager interface
*/
int ast_transfer(struct ast_channel *chan, char *dest)
{
Modified: team/russell/chan_refcount/main/cli.c
URL: http://svn.digium.com/view/asterisk/team/russell/chan_refcount/main/cli.c?view=diff&rev=105897&r1=105896&r2=105897
==============================================================================
--- team/russell/chan_refcount/main/cli.c (original)
+++ team/russell/chan_refcount/main/cli.c Tue Mar 4 18:35:51 2008
@@ -509,7 +509,7 @@
int printsec;
switch (cmd) {
- case CLI_INIT:
+ case CLI_INIT:
e->command = "core show uptime [seconds]";
e->usage =
"Usage: core show uptime [seconds]\n"
Modified: team/russell/chan_refcount/main/config.c
URL: http://svn.digium.com/view/asterisk/team/russell/chan_refcount/main/config.c?view=diff&rev=105897&r1=105896&r2=105897
==============================================================================
--- team/russell/chan_refcount/main/config.c (original)
+++ team/russell/chan_refcount/main/config.c Tue Mar 4 18:35:51 2008
@@ -150,7 +150,7 @@
total += tmp; /* multiply by 3 */
total <<= 2; /* multiply by 12 */
total += tmp; /* multiply by 13 */
-
+
total += ((unsigned int)(*str));
}
if (total < 0)
@@ -242,9 +242,9 @@
struct ast_config_include *ast_include_new(struct ast_config *conf, const char *from_file, const char *included_file, int is_exec, const char *exec_file, int from_lineno, char *real_included_file_name, int real_included_file_name_size)
{
/* a file should be included ONCE. Otherwise, if one of the instances is changed,
- then all be changed. -- how do we know to include it? -- Handling modified
- instances is possible, I'd have
- to create a new master for each instance. */
+ * then all be changed. -- how do we know to include it? -- Handling modified
+ * instances is possible, I'd have
+ * to create a new master for each instance. */
struct ast_config_include *inc;
struct stat statbuf;
@@ -290,13 +290,13 @@
return;
/* the manager code allows you to read in one config file, then
- write it back out under a different name. But, the new arrangement
- ties output lines to the file name. So, before you try to write
- the config file to disk, better riffle thru the data and make sure
- the file names are changed.
- */
+ * write it back out under a different name. But, the new arrangement
+ * ties output lines to the file name. So, before you try to write
+ * the config file to disk, better riffle thru the data and make sure
+ * the file names are changed.
+ */
/* file names are on categories, includes (of course), and on variables. So,
- traverse all this and swap names */
+ * traverse all this and swap names */
for (incl = conf->includes; incl; incl=incl->next) {
if (strcmp(incl->include_location_file,from_file) == 0) {
@@ -2154,7 +2154,7 @@
* See documentation in config.h
*/
int ast_parse_arg(const char *arg, enum ast_parse_flags flags,
- void *p_result, ...)
+ void *p_result, ...)
{
va_list ap;
int error = 0;
Modified: team/russell/chan_refcount/main/cryptostub.c
URL: http://svn.digium.com/view/asterisk/team/russell/chan_refcount/main/cryptostub.c?view=diff&rev=105897&r1=105896&r2=105897
==============================================================================
--- team/russell/chan_refcount/main/cryptostub.c (original)
+++ team/russell/chan_refcount/main/cryptostub.c Tue Mar 4 18:35:51 2008
@@ -39,22 +39,22 @@
#define build_stub(func_name,...) \
static int stub_ ## func_name(__VA_ARGS__) \
{ \
- ast_log(LOG_NOTICE, "Crypto support not loaded!\n"); \
- return -1; \
+ ast_log(LOG_NOTICE, "Crypto support not loaded!\n"); \
+ return -1; \
} \
\
int (*func_name)(__VA_ARGS__) = \
- stub_ ## func_name;
+ stub_ ## func_name;
#endif
#define build_stub(func_name,...) \
static int stub_##func_name(__VA_ARGS__) \
{ \
- ast_log(LOG_NOTICE, "Crypto support not loaded!\n"); \
- return -1; \
+ ast_log(LOG_NOTICE, "Crypto support not loaded!\n"); \
+ return -1; \
} \
\
int (*func_name)(__VA_ARGS__) = \
- stub_##func_name;
+ stub_##func_name;
struct ast_key *(*ast_key_get)(const char *key, int type) =
stub_ast_key_get;
Modified: team/russell/chan_refcount/main/dial.c
URL: http://svn.digium.com/view/asterisk/team/russell/chan_refcount/main/dial.c?view=diff&rev=105897&r1=105896&r2=105897
==============================================================================
--- team/russell/chan_refcount/main/dial.c (original)
+++ team/russell/chan_refcount/main/dial.c Tue Mar 4 18:35:51 2008
@@ -174,12 +174,13 @@
};
/*! \brief free the buffer if allocated, and set the pointer to the second arg */
-#define S_REPLACE(s, new_val) \
- do { \
- if (s) \
- free(s); \
- s = (new_val); \
- } while (0)
+#define S_REPLACE(s, new_val) \
+ do { \
+ if (s) { \
+ free(s); \
+ } \
+ s = (new_val); \
+ } while (0)
/*! \brief Maximum number of channels we can watch at a time */
#define AST_MAX_WATCHERS 256
@@ -871,7 +872,7 @@
}
AST_LIST_TRAVERSE_SAFE_END;
AST_LIST_UNLOCK(&dial->channels);
-
+
/* Disable any enabled options globally */
for (i = 0; i < AST_DIAL_OPTION_MAX; i++) {
if (!dial->options[i])
@@ -954,7 +955,7 @@
if (channel->options[option])
return -1;
- /* Execute enable callback if it exists, if not simply make sure the value is set */
+ /* Execute enable callback if it exists, if not simply make sure the value is set */
if (option_types[option].enable)
channel->options[option] = option_types[option].enable(data);
else
@@ -970,9 +971,10 @@
*/
int ast_dial_option_global_disable(struct ast_dial *dial, enum ast_dial_option option)
{
- /* If the option is not enabled, return failure */
- if (!dial->options[option])
- return -1;
+ /* If the option is not enabled, return failure */
+ if (!dial->options[option]) {
+ return -1;
+ }
/* Execute callback of option to disable if it exists */
if (option_types[option].disable)
@@ -981,7 +983,7 @@
/* Finally disable option on the structure */
dial->options[option] = NULL;
- return 0;
+ return 0;
}
/*! \brief Disables an option per channel
Modified: team/russell/chan_refcount/main/dlfcn.c
URL: http://svn.digium.com/view/asterisk/team/russell/chan_refcount/main/dlfcn.c?view=diff&rev=105897&r1=105896&r2=105897
==============================================================================
--- team/russell/chan_refcount/main/dlfcn.c (original)
+++ team/russell/chan_refcount/main/dlfcn.c Tue Mar 4 18:35:51 2008
@@ -1,7 +1,7 @@
/*
Copyright (c) 2002 Jorge Acereda <jacereda at users.sourceforge.net> &
Peter O'Gorman <ogorman at users.sourceforge.net>
-
+
Portions may be copyright others, see the AUTHORS file included with this
distribution.
@@ -544,10 +544,9 @@
const char *dyldfile;
const char* retStr = NULL;
NSLinkEditError(&dylder, &dylderno, &dyldfile, &dylderrstr);
- if (dylderrstr && strlen(dylderrstr))
- {
- retStr = ast_malloc(strlen(dylderrstr) +1);
- strcpy((char*)retStr,dylderrstr);
+ if (dylderrstr && strlen(dylderrstr)) {
+ retStr = ast_malloc(strlen(dylderrstr) + 1);
+ strcpy((char*)retStr, dylderrstr);
}
return retStr;
}
@@ -564,51 +563,41 @@
#endif
if (NULL == dls)
dls = RTLD_SELF;
- if ((RTLD_NEXT == dls) || (RTLD_SELF == dls))
- {
- if (dyld_NSIsSymbolNameDefinedInImage && dyld_NSLookupSymbolInImage)
- {
+ if ((RTLD_NEXT == dls) || (RTLD_SELF == dls)) {
+ if (dyld_NSIsSymbolNameDefinedInImage && dyld_NSLookupSymbolInImage) {
caller_mh = image_for_address(caller);
- if (RTLD_SELF == dls)
- {
+ if (RTLD_SELF == dls) {
/* FIXME: We should be using the NSModule api, if SELF is an MH_BUNDLE
* But it appears to work anyway, and looking at the code in dyld_libfuncs.c
* this is acceptable.
*/
- if (dyld_NSIsSymbolNameDefinedInImage(caller_mh, symbol))
- {
+ if (dyld_NSIsSymbolNameDefinedInImage(caller_mh, symbol)) {
nssym = dyld_NSLookupSymbolInImage(caller_mh,
symbol,
NSLOOKUPSYMBOLINIMAGE_OPTION_BIND |
NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR);
}
}
- if (!nssym)
- {
+ if (!nssym) {
if (RTLD_SELF == dls)
savedErrorStr = dyld_error_str();
nssym = search_linked_libs(caller_mh, symbol);
}
- }
- else
- {
+ } else {
if (canSetError)
error("RTLD_SELF and RTLD_NEXT are not supported");
return NULL;
}
}
- if (!nssym)
- {
-
- if (RTLD_DEFAULT == dls)
- {
+ if (!nssym) {
+
+ if (RTLD_DEFAULT == dls) {
dls = &mainStatus;
}
if (!isValidStatus(dls))
return NULL;
- if (dls->module != MAGIC_DYLIB_MOD)
- {
+ if (dls->module != MAGIC_DYLIB_MOD) {
nssym = NSLookupSymbolInModule(dls->module, symbol);
if (!nssym && NSIsSymbolNameDefined(symbol))
{
@@ -616,58 +605,43 @@
savedErrorStr = dyld_error_str();
nssym = search_linked_libs(get_mach_header_from_NSModule(dls->module), symbol);
}
- }
- else if (dls->lib && dyld_NSIsSymbolNameDefinedInImage && dyld_NSLookupSymbolInImage)
- {
- if (dyld_NSIsSymbolNameDefinedInImage(dls->lib, symbol))
- {
+ } else if (dls->lib && dyld_NSIsSymbolNameDefinedInImage && dyld_NSLookupSymbolInImage) {
+ if (dyld_NSIsSymbolNameDefinedInImage(dls->lib, symbol)) {
nssym = dyld_NSLookupSymbolInImage(dls->lib,
symbol,
NSLOOKUPSYMBOLINIMAGE_OPTION_BIND |
NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR);
- }
- else if (NSIsSymbolNameDefined(symbol))
- {
+ } else if (NSIsSymbolNameDefined(symbol)) {
debug("Searching dependencies");
savedErrorStr = dyld_error_str();
nssym = search_linked_libs(dls->lib, symbol);
}
- }
- else if (dls->module == MAGIC_DYLIB_MOD)
- {
+ } else if (dls->module == MAGIC_DYLIB_MOD) {
/* Global context, use NSLookupAndBindSymbol */
- if (NSIsSymbolNameDefined(symbol))
- {
+ if (NSIsSymbolNameDefined(symbol)) {
/* There doesn't seem to be a return on error option for this call???
this is potentially broken, if binding fails, it will improperly
exit the application. */
nssym = NSLookupAndBindSymbol(symbol);
- }
- else
- {
+ } else {
if (savedErrorStr)
ast_free(savedErrorStr);
savedErrorStr = ast_malloc(256);
- snprintf((char*)savedErrorStr, 256, "Symbol \"%s\" not in global context",symbol);
+ snprintf((char*)savedErrorStr, 256, "Symbol \"%s\" not in global context", symbol);
}
}
}
/* Error reporting */
- if (!nssym)
- {
- if (!savedErrorStr || !strlen(savedErrorStr))
- {
+ if (!nssym) {
+ if (!savedErrorStr || !strlen(savedErrorStr)) {
if (savedErrorStr)
ast_free(savedErrorStr);
savedErrorStr = ast_malloc(256);
- snprintf((char*)savedErrorStr, 256,"Symbol \"%s\" not found",symbol);
- }
- if (canSetError)
- {
+ snprintf((char*)savedErrorStr, 256, "Symbol \"%s\" not found", symbol);
+ }
+ if (canSetError) {
error(savedErrorStr);
- }
- else
- {
+ } else {
debug(savedErrorStr);
}
if (savedErrorStr)
@@ -688,57 +662,48 @@
const char *file;
void (*init) (void);
ofirc = NSCreateObjectFileImageFromFile(path, &ofi);
- switch (ofirc)
- {
- case NSObjectFileImageSuccess:
- break;
- case NSObjectFileImageInappropriateFile:
- if (dyld_NSAddImage && dyld_NSIsSymbolNameDefinedInImage && dyld_NSLookupSymbolInImage)
- {
- if (!isFlagSet(mode, RTLD_GLOBAL))
- {
- warning("trying to open a .dylib with RTLD_LOCAL");
- error("unable to open this file with RTLD_LOCAL");
- return NULL;
- }
- }
- else
- {
- error("opening this file is unsupported on this system");
+ switch (ofirc) {
+ case NSObjectFileImageSuccess:
+ break;
+ case NSObjectFileImageInappropriateFile:
+ if (dyld_NSAddImage && dyld_NSIsSymbolNameDefinedInImage && dyld_NSLookupSymbolInImage) {
+ if (!isFlagSet(mode, RTLD_GLOBAL)) {
+ warning("trying to open a .dylib with RTLD_LOCAL");
+ error("unable to open this file with RTLD_LOCAL");
return NULL;
}
- break;
- case NSObjectFileImageFailure:
- error("object file setup failure");
+ } else {
+ error("opening this file is unsupported on this system");
return NULL;
- case NSObjectFileImageArch:
- error("no object for this architecture");
- return NULL;
- case NSObjectFileImageFormat:
- error("bad object file format");
- return NULL;
- case NSObjectFileImageAccess:
- error("can't read object file");
- return NULL;
- default:
- error("unknown error from NSCreateObjectFileImageFromFile()");
- return NULL;
+ }
+ break;
+ case NSObjectFileImageFailure:
+ error("object file setup failure");
+ return NULL;
+ case NSObjectFileImageArch:
+ error("no object for this architecture");
+ return NULL;
+ case NSObjectFileImageFormat:
+ error("bad object file format");
+ return NULL;
+ case NSObjectFileImageAccess:
+ error("can't read object file");
+ return NULL;
+ default:
+ error("unknown error from NSCreateObjectFileImageFromFile()");
+ return NULL;
}
dls = lookupStatus(sbuf);
- if (!dls)
- {
+ if (!dls) {
dls = allocStatus();
}
- if (!dls)
- {
+ if (!dls) {
error("unable to allocate memory");
return NULL;
}
dls->lib = 0;
- if (ofirc == NSObjectFileImageInappropriateFile)
- {
- if ((dls->lib = dyld_NSAddImage(path, NSADDIMAGE_OPTION_RETURN_ON_ERROR)))
- {
+ if (ofirc == NSObjectFileImageInappropriateFile) {
+ if ((dls->lib = dyld_NSAddImage(path, NSADDIMAGE_OPTION_RETURN_ON_ERROR))) {
debug("Dynamic lib loaded at %ld", dls->lib);
ofi = MAGIC_DYLIB_OFI;
dls->module = MAGIC_DYLIB_MOD;
@@ -746,8 +711,7 @@
/* Although it is possible with a bit of work to modify this so it works and
functions with RTLD_NOW, I don't deem it necessary at the moment */
}
- if (!(dls->module))
- {
+ if (!(dls->module)) {
NSLinkEditError(&ler, &lerno, &file, &errstr);
if (!errstr || (!strlen(errstr)))
error("Can't open this file type");
@@ -759,24 +723,19 @@
}
return NULL;
}
- }
- else
- {
+ } else {
dls->module = NSLinkModule(ofi, path,
NSLINKMODULE_OPTION_RETURN_ON_ERROR |
NSLINKMODULE_OPTION_PRIVATE |
(isFlagSet(mode, RTLD_NOW) ? NSLINKMODULE_OPTION_BINDNOW : 0));
NSDestroyObjectFileImage(ofi);
- if (dls->module)
- {
+ if (dls->module) {
dls->lib = get_mach_header_from_NSModule(dls->module);
}
}
- if (!dls->module)
- {
+ if (!dls->module) {
NSLinkEditError(&ler, &lerno, &file, &errstr);
- if ((dls->flags & DL_IN_LIST) == 0)
- {
+ if ((dls->flags & DL_IN_LIST) == 0) {
ast_free(dls);
}
error(errstr);
@@ -785,8 +744,7 @@
insertStatus(dls, sbuf);
dls = reference(dls, mode);
- if ((init = dlsymIntern(dls, "__init", 0)))
- {
+ if ((init = dlsymIntern(dls, "__init", 0))) {
debug("calling _init()");
init();
}
@@ -796,8 +754,7 @@
static void dlcompat_init_func(void)
{
static int inited = 0;
- if (!inited)
- {
+ if (!inited) {
inited = 1;
_dyld_func_lookup("__dyld_NSAddImage", (unsigned long *)&dyld_NSAddImage);
_dyld_func_lookup("__dyld_NSIsSymbolNameDefinedInImage",
@@ -830,8 +787,7 @@
pthread_mutex_destroy(&dlcompat_mutex);
pthread_key_delete(dlerror_key);
next = stqueue;
- while (next && (next != &mainStatus))
- {
+ while (next && (next != &mainStatus)) {
dls = next;
next = dls->next;
ast_free(dls);
@@ -859,20 +815,18 @@
int err = 0;
struct dlthread *tss;
tss = pthread_getspecific(dlerror_key);
- if (!tss)
- {
+ if (!tss) {
tss = ast_malloc(sizeof(*tss));
tss->lockcnt = 0;
tss->errset = 0;
- if (pthread_setspecific(dlerror_key, tss))
- {
- fprintf(stderr,"dlcompat: pthread_setspecific failed\n");
+ if (pthread_setspecific(dlerror_key, tss)) {
+ fprintf(stderr, "dlcompat: pthread_setspecific failed\n");
exit(1);
}
}
if (!tss->lockcnt)
err = pthread_mutex_lock(&dlcompat_mutex);
- tss->lockcnt = tss->lockcnt +1;
+ tss->lockcnt = tss->lockcnt + 1;
if (err)
exit(err);
}
@@ -897,41 +851,36 @@
dlcompat_init_func(); /* Just in case */
dolock();
resetdlerror();
- if (!path)
- {
+ if (!path) {
dls = &mainStatus;
goto dlopenok;
}
- if (!(sbuf = findFile(path, &fullPath)))
- {
+ if (!(sbuf = findFile(path, &fullPath))) {
error("file \"%s\" not found", path);
goto dlopenerror;
}
/* Now checks that it hasn't been closed already */
- if ((dls = lookupStatus(sbuf)) && (dls->refs > 0))
- {
+ if ((dls = lookupStatus(sbuf)) && (dls->refs > 0)) {
/* debug("status found"); */
dls = reference(dls, mode);
goto dlopenok;
}
#ifdef RTLD_NOLOAD
- if (isFlagSet(mode, RTLD_NOLOAD))
- {
+ if (isFlagSet(mode, RTLD_NOLOAD)) {
error("no existing handle and RTLD_NOLOAD specified");
goto dlopenerror;
}
#endif
- if (isFlagSet(mode, RTLD_LAZY) && isFlagSet(mode, RTLD_NOW))
- {
+ if (isFlagSet(mode, RTLD_LAZY) && isFlagSet(mode, RTLD_NOW)) {
error("how can I load something both RTLD_LAZY and RTLD_NOW?");
goto dlopenerror;
}
dls = loadModule(fullPath, sbuf, mode);
- dlopenok:
+dlopenok:
dounlock();
return (void *)dls;
- dlopenerror:
+dlopenerror:
dounlock();
return NULL;
}
@@ -944,20 +893,17 @@
char *malloc_sym = NULL;
dolock();
malloc_sym = ast_malloc(sym_len + 2);
- if (malloc_sym)
- {
+ if (malloc_sym) {
sprintf(malloc_sym, "_%s", symbol);
value = dlsymIntern(handle, malloc_sym, 1);
ast_free(malloc_sym);
- }
- else
- {
+ } else {
error("Unable to allocate memory");
goto dlsymerror;
}
dounlock();
return value;
- dlsymerror:
+dlsymerror:
dounlock();
return NULL;
}
@@ -989,14 +935,11 @@
void *value = NULL;
char *malloc_sym = NULL;
malloc_sym = ast_malloc(sym_len + 2);
- if (malloc_sym)
- {
+ if (malloc_sym) {
sprintf(malloc_sym, "_%s", symbol);
value = dlsymIntern(handle, malloc_sym, 1);
ast_free(malloc_sym);
- }
- else
- {
+ } else {
error("Unable to allocate memory");
}
return value;
@@ -1038,37 +981,29 @@
struct dlstatus *dls = handle;
dolock();
resetdlerror();
- if (!isValidStatus(dls))
- {
+ if (!isValidStatus(dls)) {
goto dlcloseerror;
}
- if (dls->module == MAGIC_DYLIB_MOD)
- {
+ if (dls->module == MAGIC_DYLIB_MOD) {
const char *name;
- if (!dls->lib)
- {
+ if (!dls->lib) {
name = "global context";
- }
- else
- {
+ } else {
name = get_lib_name(dls->lib);
}
warning("trying to close a .dylib!");
error("Not closing \"%s\" - dynamic libraries cannot be closed", name);
goto dlcloseerror;
}
- if (!dls->module)
- {
+ if (!dls->module) {
error("module already closed");
goto dlcloseerror;
}
- if (dls->refs == 1)
- {
+ if (dls->refs == 1) {
unsigned long options = 0;
void (*fini) (void);
- if ((fini = dlsymIntern(dls, "__fini", 0)))
- {
+ if ((fini = dlsymIntern(dls, "__fini", 0))) {
debug("calling _fini()");
fini();
}
@@ -1083,8 +1018,7 @@
*/
if ((const struct section *)NULL !=
getsectbynamefromheader(get_mach_header_from_NSModule(dls->module),
- "__DATA", "__mod_term_func"))
- {
+ "__DATA", "__mod_term_func")) {
options |= NSUNLINKMODULE_OPTION_KEEP_MEMORY_MAPPED;
}
#endif
@@ -1092,8 +1026,7 @@
if (isFlagSet(dls->mode, RTLD_NODELETE))
options |= NSUNLINKMODULE_OPTION_KEEP_MEMORY_MAPPED;
#endif
- if (!NSUnLinkModule(dls->module, options))
- {
+ if (!NSUnLinkModule(dls->module, options)) {
error("unable to unlink module");
goto dlcloseerror;
}
@@ -1106,7 +1039,7 @@
}
dounlock();
return 0;
- dlcloseerror:
+dlcloseerror:
dounlock();
return 1;
}
@@ -1135,27 +1068,23 @@
struct mach_header *mh = 0;
struct load_command *lc = 0;
unsigned long addr = NULL;
- for (i = 0; i < count; i++)
- {
+ for (i = 0; i < count; i++) {
addr = (unsigned long)address - _dyld_get_image_vmaddr_slide(i);
mh = _dyld_get_image_header(i);
- if (mh)
- {
+ if (mh) {
lc = (struct load_command *)((char *)mh + sizeof(struct mach_header));
- for (j = 0; j < mh->ncmds; j++, lc = (struct load_command *)((char *)lc + lc->cmdsize))
- {
+ for (j = 0; j < mh->ncmds; j++, lc = (struct load_command *)((char *)lc + lc->cmdsize)) {
if (LC_SEGMENT == lc->cmd &&
addr >= ((struct segment_command *)lc)->vmaddr &&
addr <
- ((struct segment_command *)lc)->vmaddr + ((struct segment_command *)lc)->vmsize)
- {
+ ((struct segment_command *)lc)->vmaddr + ((struct segment_command *)lc)->vmsize) {
goto image_found;
}
}
}
mh = 0;
}
- image_found:
+image_found:
return mh;
}
@@ -1183,20 +1112,16 @@
[... 1692 lines stripped ...]
More information about the asterisk-commits
mailing list