[Asterisk-cvs] asterisk cli.c,1.45,1.46 enum.c,1.19,1.20 file.c,1.45,1.46 logger.c,1.41,1.42 manager.c,1.63,1.64 muted.c,1.3,1.4 pbx.c,1.136,1.137 srv.c,1.9,1.10 translate.c,1.27,1.28
markster at lists.digium.com
markster at lists.digium.com
Wed Jul 14 03:58:34 CDT 2004
- Previous message: [Asterisk-cvs] asterisk/apps app_qcall.c,1.11,1.12 app_queue.c,1.75,1.76 app_record.c,1.19,1.20 app_rpt.c,1.16,1.17 app_setcidnum.c,1.3,1.4 app_sms.c,1.7,1.8 app_sql_postgres.c,1.6,1.7 app_striplsd.c,1.3,1.4 app_substring.c,1.8,1.9 app_txtcidname.c,1.6,1.7 app_voicemail.c,1.132,1.133 app_zapbarge.c,1.6,1.7 app_zapscan.c,1.13,1.14
- Next message: [Asterisk-cvs] asterisk/apps app_setcidname.c,1.3,1.4
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /usr/cvsroot/asterisk
In directory mongoose.digium.com:/tmp/cvs-serv22249
Modified Files:
cli.c enum.c file.c logger.c manager.c muted.c pbx.c srv.c
translate.c
Log Message:
Remaining rgagnon source audit improvements (bug #2011)
Index: cli.c
===================================================================
RCS file: /usr/cvsroot/asterisk/cli.c,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -d -r1.45 -r1.46
--- cli.c 8 Jul 2004 19:41:34 -0000 1.45
+++ cli.c 14 Jul 2004 07:44:19 -0000 1.46
@@ -39,12 +39,19 @@
void ast_cli(int fd, char *fmt, ...)
{
char *stuff;
+ int res = 0;
+
va_list ap;
va_start(ap, fmt);
- vasprintf(&stuff, fmt, ap);
+ res = vasprintf(&stuff, fmt, ap);
va_end(ap);
- ast_carefulwrite(fd, stuff, strlen(stuff), 100);
- free(stuff);
+ if (res == -1) {
+ ast_log(LOG_ERROR, "Out of memory\n");
+ }
+ else {
+ ast_carefulwrite(fd, stuff, strlen(stuff), 100);
+ free(stuff);
+ }
}
AST_MUTEX_DEFINE_STATIC(clilock);
@@ -179,62 +186,76 @@
static char *format_uptimestr(time_t timeval)
{
int years = 0, weeks = 0, days = 0, hours = 0, mins = 0, secs = 0;
- char timestr[256];
- int pos = 0;
+ char timestr[256]="";
+ int bytes = 0;
+ int maxbytes = 0;
+ int offset = 0;
#define SECOND (1)
#define MINUTE (SECOND*60)
#define HOUR (MINUTE*60)
#define DAY (HOUR*24)
#define WEEK (DAY*7)
#define YEAR (DAY*365)
+#define ESS(x) ((x == 1) ? "" : "s")
+ maxbytes = sizeof(timestr);
if (timeval < 0)
return NULL;
if (timeval > YEAR) {
years = (timeval / YEAR);
timeval -= (years * YEAR);
- if (years > 1)
- pos += sprintf(timestr + pos, "%d years, ", years);
- else
- pos += sprintf(timestr + pos, "1 year, ");
+ if (years > 0) {
+ snprintf(timestr + offset, maxbytes, "%d year%s, ", years, ESS(years));
+ bytes = strlen(timestr + offset);
+ offset += bytes;
+ maxbytes -= bytes;
+ }
}
if (timeval > WEEK) {
weeks = (timeval / WEEK);
timeval -= (weeks * WEEK);
- if (weeks > 1)
- pos += sprintf(timestr + pos, "%d weeks, ", weeks);
- else
- pos += sprintf(timestr + pos, "1 week, ");
+ if (weeks > 0) {
+ snprintf(timestr + offset, maxbytes, "%d week%s, ", weeks, ESS(weeks));
+ bytes = strlen(timestr + offset);
+ offset += bytes;
+ maxbytes -= bytes;
+ }
}
if (timeval > DAY) {
days = (timeval / DAY);
timeval -= (days * DAY);
- if (days > 1)
- pos += sprintf(timestr + pos, "%d days, ", days);
- else
- pos += sprintf(timestr + pos, "1 day, ");
-
+ if (days > 0) {
+ snprintf(timestr + offset, maxbytes, "%d day%s, ", days, ESS(days));
+ bytes = strlen(timestr + offset);
+ offset += bytes;
+ maxbytes -= bytes;
+ }
}
if (timeval > HOUR) {
hours = (timeval / HOUR);
timeval -= (hours * HOUR);
- if (hours > 1)
- pos += sprintf(timestr + pos, "%d hours, ", hours);
- else
- pos += sprintf(timestr + pos, "1 hour, ");
+ if (hours > 0) {
+ snprintf(timestr + offset, maxbytes, "%d hour%s, ", hours, ESS(hours));
+ bytes = strlen(timestr + offset);
+ offset += bytes;
+ maxbytes -= bytes;
+ }
}
if (timeval > MINUTE) {
mins = (timeval / MINUTE);
timeval -= (mins * MINUTE);
- if (mins > 1)
- pos += sprintf(timestr + pos, "%d minutes, ", mins);
- else if (mins > 0)
- pos += sprintf(timestr + pos, "1 minute, ");
+ if (mins > 0) {
+ snprintf(timestr + offset, maxbytes, "%d minute%s, ", mins, ESS(mins));
+ bytes = strlen(timestr + offset);
+ offset += bytes;
+ maxbytes -= bytes;
+ }
}
secs = timeval;
- if (secs > 0)
- pos += sprintf(timestr + pos, "%d seconds", secs);
+ if (secs > 0) {
+ snprintf(timestr + offset, maxbytes, "%d second%s", secs, ESS(secs));
+ }
return timestr ? strdup(timestr) : NULL;
}
@@ -657,25 +678,31 @@
return e;
}
-static void join(char *s, int len, char *w[])
+static void join(char *dest, size_t destsize, char *w[])
{
int x;
/* Join words into a string */
- strcpy(s, "");
+ if (!dest || destsize < 1) {
+ return;
+ }
+ dest[0] = '\0';
for (x=0;w[x];x++) {
if (x)
- strncat(s, " ", len - strlen(s));
- strncat(s, w[x], len - strlen(s));
+ strncat(dest, " ", destsize - strlen(dest) - 1);
+ strncat(dest, w[x], destsize - strlen(dest) - 1);
}
}
-static void join2(char *s, int len, char *w[])
+static void join2(char *dest, size_t destsize, char *w[])
{
int x;
/* Join words into a string */
- strcpy(s, "");
+ if (!dest || destsize < 1) {
+ return;
+ }
+ dest[0] = '\0';
for (x=0;w[x];x++) {
- strncat(s, w[x], len - strlen(s));
+ strncat(dest, w[x], destsize - strlen(dest) - 1);
}
}
Index: enum.c
===================================================================
RCS file: /usr/cvsroot/asterisk/enum.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- enum.c 2 Jul 2004 19:20:09 -0000 1.19
+++ enum.c 14 Jul 2004 07:44:19 -0000 1.20
@@ -94,7 +94,7 @@
regmatch_t pmatch[9];
- strcpy(dst, "");
+ dst[0] = '\0';
if (len < sizeof(struct naptr)) {
ast_log(LOG_WARNING, "Length too short\n");
@@ -151,7 +151,7 @@
}
/* DEDBUGGING STUB
- strcpy(regexp, "!^\\+43(.*)$!\\1 at bla.fasel!");
+ strncpy(regexp, "!^\\+43(.*)$!\\1 at bla.fasel!", sizeof(regexp) - 1);
*/
regexp_len = strlen(regexp);
@@ -222,7 +222,8 @@
}
}
*d = 0;
- strncpy(dst, temp, dstsize);
+ strncpy(dst, temp, dstsize - 1);
+ dst[dstsize - 1] = '\0';
return 0;
}
@@ -245,8 +246,8 @@
if (answer != NULL) {
c->txtlen = strlen(answer);
- strncpy(c->txt, answer, 255);
- c->txt[c->txtlen] = 0;
+ strncpy(c->txt, answer, sizeof(c->txt) - 1);
+ c->txt[sizeof(c->txt) - 1] = 0;
return 1;
} else {
c->txt = NULL;
@@ -309,7 +310,7 @@
s = s->next;
}
if (s) {
- strcpy(tmp + newpos, s->toplev);
+ strncpy(tmp + newpos, s->toplev, sizeof(tmp) - newpos - 1);
}
ast_mutex_unlock(&enumlock);
if (!s)
@@ -368,7 +369,7 @@
s = s->next;
}
if (s) {
- strcpy(tmp + newpos, s->toplev);
+ strncpy(tmp + newpos, s->toplev, sizeof(tmp) - newpos - 1);
}
ast_mutex_unlock(&enumlock);
if (!s)
Index: file.c
===================================================================
RCS file: /usr/cvsroot/asterisk/file.c,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -d -r1.45 -r1.46
--- file.c 30 Jun 2004 03:22:29 -0000 1.45
+++ file.c 14 Jul 2004 07:44:19 -0000 1.46
@@ -279,14 +279,17 @@
static char *build_filename(char *filename, char *ext)
{
char *fn;
+ int fnsize = 0;
char tmp[AST_CONFIG_MAX_PATH]="";
- snprintf(tmp,sizeof(tmp)-1,"%s/%s",(char *)ast_config_AST_VAR_DIR,"sounds");
- fn = malloc(strlen(tmp) + strlen(filename) + strlen(ext) + 10);
+
+ snprintf(tmp, sizeof(tmp), "%s/%s", ast_config_AST_VAR_DIR, "sounds");
+ fnsize = strlen(tmp) + strlen(filename) + strlen(ext) + 10;
+ fn = malloc(fnsize);
if (fn) {
if (filename[0] == '/')
- sprintf(fn, "%s.%s", filename, ext);
+ snprintf(fn, fnsize, "%s.%s", filename, ext);
else
- sprintf(fn, "%s/%s.%s", (char *)tmp, filename, ext);
+ snprintf(fn, fnsize, "%s/%s.%s", tmp, filename, ext);
}
return fn;
Index: logger.c
===================================================================
RCS file: /usr/cvsroot/asterisk/logger.c,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -d -r1.41 -r1.42
--- logger.c 29 Jun 2004 04:42:19 -0000 1.41
+++ logger.c 14 Jul 2004 07:44:19 -0000 1.42
@@ -211,7 +211,7 @@
ast_mutex_lock(&loglock);
if ((s = ast_variable_retrieve(cfg, "general", "dateformat"))) {
- (void)strncpy(dateformat,s,sizeof(dateformat));
+ strncpy(dateformat, s, sizeof(dateformat) - 1);
}
var = ast_variable_browse(cfg, "logfiles");
while(var) {
@@ -266,7 +266,7 @@
int reload_logger(int rotate)
{
- char old[AST_CONFIG_MAX_PATH];
+ char old[AST_CONFIG_MAX_PATH] = "";
char new[AST_CONFIG_MAX_PATH];
struct logchannel *f;
FILE *myf;
@@ -307,7 +307,7 @@
fclose(f->fileptr);
f->fileptr = NULL;
if(rotate) {
- strncpy(old, f->filename, sizeof(old));
+ strncpy(old, f->filename, sizeof(old) - 1);
for(x=0;;x++) {
snprintf(new, sizeof(new), "%s.%d", f->filename, x);
Index: manager.c
===================================================================
RCS file: /usr/cvsroot/asterisk/manager.c,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -d -r1.63 -r1.64
--- manager.c 8 Jul 2004 17:08:38 -0000 1.63
+++ manager.c 14 Jul 2004 07:44:19 -0000 1.64
@@ -651,7 +651,7 @@
if (c->bridge)
snprintf(bridge, sizeof(bridge), "Link: %s\r\n", c->bridge->name);
else
- strcpy(bridge, "");
+ bridge[0] = '\0';
if (c->pbx) {
ast_cli(s->fd,
"Event: Status\r\n"
@@ -992,13 +992,13 @@
static int process_message(struct mansession *s, struct message *m)
{
- char action[80];
+ char action[80] = "";
struct manager_action *tmp = first_action;
char *id = astman_get_header(m,"ActionID");
char idText[256] = "";
char iabuf[INET_ADDRSTRLEN];
- strncpy(action, astman_get_header(m, "Action"), sizeof(action));
+ strncpy(action, astman_get_header(m, "Action"), sizeof(action) - 1);
ast_log( LOG_DEBUG, "Manager received command '%s'\n", action );
if (ast_strlen_zero(action)) {
Index: muted.c
===================================================================
RCS file: /usr/cvsroot/asterisk/muted.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- muted.c 19 May 2004 03:16:59 -0000 1.3
+++ muted.c 14 Jul 2004 07:44:19 -0000 1.4
@@ -25,9 +25,9 @@
static char *config = "/etc/muted.conf";
-static char host[256];
-static char user[256];
-static char pass[256];
+static char host[256] = "";
+static char user[256] = "";
+static char pass[256] = "";
static int smoothfade = 0;
static int mutelevel = 20;
static int muted = 0;
@@ -98,17 +98,17 @@
}
if (!strcasecmp(buf, "host")) {
if (val && strlen(val))
- strncpy(host, val, sizeof(host));
+ strncpy(host, val, sizeof(host) - 1);
else
fprintf(stderr, "host needs an argument (the host) at line %d\n", lineno);
} else if (!strcasecmp(buf, "user")) {
if (val && strlen(val))
- strncpy(user, val, sizeof(user));
+ strncpy(user, val, sizeof(user) - 1);
else
fprintf(stderr, "user needs an argument (the user) at line %d\n", lineno);
} else if (!strcasecmp(buf, "pass")) {
if (val && strlen(val))
- strncpy(pass, val, sizeof(pass));
+ strncpy(pass, val, sizeof(pass) - 1);
else
fprintf(stderr, "pass needs an argument (the password) at line %d\n", lineno);
} else if (!strcasecmp(buf, "smoothfade")) {
@@ -264,7 +264,7 @@
char tmp[256] = "";
char *s, *t;
struct channel *chan;
- strncpy(tmp, channel, sizeof(tmp));
+ strncpy(tmp, channel, sizeof(tmp) - 1);
s = strchr(tmp, '/');
if (s) {
*s = '\0';
@@ -460,15 +460,15 @@
return -1;
}
if (!strncasecmp(resp, "Event: ", strlen("Event: "))) {
- strncpy(event, resp + strlen("Event: "), sizeof(event));
+ strncpy(event, resp + strlen("Event: "), sizeof(event) - 1);
/* Consume the rest of the non-event */
while((resp = get_line()) && strlen(resp)) {
if (!strncasecmp(resp, "Channel: ", strlen("Channel: ")))
- strncpy(channel, resp + strlen("Channel: "), sizeof(channel));
+ strncpy(channel, resp + strlen("Channel: "), sizeof(channel) - 1);
if (!strncasecmp(resp, "Newname: ", strlen("Newname: ")))
- strncpy(newname, resp + strlen("Newname: "), sizeof(newname));
+ strncpy(newname, resp + strlen("Newname: "), sizeof(newname) - 1);
if (!strncasecmp(resp, "Oldname: ", strlen("Oldname: ")))
- strncpy(oldname, resp + strlen("Oldname: "), sizeof(oldname));
+ strncpy(oldname, resp + strlen("Oldname: "), sizeof(oldname) - 1);
}
if (strlen(channel)) {
if (!strcasecmp(event, "Hangup"))
Index: pbx.c
===================================================================
RCS file: /usr/cvsroot/asterisk/pbx.c,v
retrieving revision 1.136
retrieving revision 1.137
diff -u -d -r1.136 -r1.137
--- pbx.c 9 Jul 2004 08:32:09 -0000 1.136
+++ pbx.c 14 Jul 2004 07:44:19 -0000 1.137
@@ -875,7 +875,7 @@
} else
*ret = NULL;
} else if (c && !strcmp(var, "HINT")) {
- if (!ast_get_hint(workspace, workspacelen - 1, c, c->context, c->exten))
+ if (!ast_get_hint(workspace, workspacelen, c, c->context, c->exten))
*ret = NULL;
else
*ret = workspace;
@@ -908,12 +908,12 @@
strncpy(workspace, c->name, workspacelen - 1);
*ret = workspace;
} else if (c && !strcmp(var, "EPOCH")) {
- snprintf(workspace, workspacelen -1, "%u",(int)time(NULL));
+ snprintf(workspace, workspacelen, "%u",(int)time(NULL));
*ret = workspace;
} else if (c && !strcmp(var, "DATETIME")) {
thistime=time(NULL);
localtime_r(&thistime, &brokentime);
- snprintf(workspace, workspacelen -1, "%02d%02d%04d-%02d:%02d:%02d",
+ snprintf(workspace, workspacelen, "%02d%02d%04d-%02d:%02d:%02d",
brokentime.tm_mday,
brokentime.tm_mon+1,
brokentime.tm_year+1900,
@@ -926,7 +926,7 @@
thistime=time(NULL);
localtime_r(&thistime, &brokentime);
/* 20031130-150612 */
- snprintf(workspace, workspacelen -1, "%04d%02d%02d-%02d%02d%02d",
+ snprintf(workspace, workspacelen, "%04d%02d%02d-%02d%02d%02d",
brokentime.tm_year+1900,
brokentime.tm_mon+1,
brokentime.tm_mday,
@@ -936,10 +936,10 @@
);
*ret = workspace;
} else if (c && !strcmp(var, "UNIQUEID")) {
- snprintf(workspace, workspacelen -1, "%s", c->uniqueid);
+ snprintf(workspace, workspacelen, "%s", c->uniqueid);
*ret = workspace;
} else if (c && !strcmp(var, "HANGUPCAUSE")) {
- snprintf(workspace, workspacelen -1, "%i", c->hangupcause);
+ snprintf(workspace, workspacelen, "%i", c->hangupcause);
*ret = workspace;
} else if (c && !strcmp(var, "ACCOUNTCODE")) {
strncpy(workspace, c->accountcode, workspacelen - 1);
@@ -1083,7 +1083,7 @@
}
/* Retrieve variable value */
- strcpy(workspace, "");
+ workspace[0] = '\0';
pbx_substitute_variables_temp(c,vars,&cp4, workspace, sizeof(workspace));
if (cp4) {
length = strlen(cp4);
@@ -1378,69 +1378,69 @@
int ast_device_state_changed(const char *fmt, ...)
{
- struct ast_hint *list;
- struct ast_state_cb *cblist;
- char hint[AST_MAX_EXTENSION];
- char device[AST_MAX_EXTENSION];
- char *cur, *rest;
- int state;
-
- va_list ap;
+ struct ast_hint *list;
+ struct ast_state_cb *cblist;
+ char hint[AST_MAX_EXTENSION] = "";
+ char device[AST_MAX_EXTENSION];
+ char *cur, *rest;
+ int state;
- va_start(ap, fmt);
- vsnprintf(device, sizeof(device)-1, fmt, ap);
- va_end(ap);
+ va_list ap;
- rest = strchr(device, '-');
- if (rest) {
- *rest = 0;
- }
-
- ast_mutex_lock(&hintlock);
+ va_start(ap, fmt);
+ vsnprintf(device, sizeof(device), fmt, ap);
+ va_end(ap);
- list = hints;
-
- while (list) {
-
- strcpy(hint, ast_get_extension_app(list->exten));
- cur = hint;
- do {
- rest = strchr(cur, '&');
- if (rest) {
+ rest = strchr(device, '-');
+ if (rest) {
*rest = 0;
- rest++;
- }
-
- if (!strcmp(cur, device)) {
- // Found extension execute callbacks
- state = ast_extension_state2(list->exten);
- if ((state != -1) && (state != list->laststate)) {
- // For general callbacks
- cblist = statecbs;
- while (cblist) {
- cblist->callback(list->exten->parent->name, list->exten->exten, state, cblist->data);
- cblist = cblist->next;
- }
-
- // For extension callbacks
- cblist = list->callbacks;
- while (cblist) {
- cblist->callback(list->exten->parent->name, list->exten->exten, state, cblist->data);
- cblist = cblist->next;
- }
-
- list->laststate = state;
- }
- break;
- }
- cur = rest;
- } while (cur);
-
- list = list->next;
- }
+ }
- ast_mutex_unlock(&hintlock);
- return 1;
+ ast_mutex_lock(&hintlock);
+
+ list = hints;
+
+ while (list) {
+
+ strncpy(hint, ast_get_extension_app(list->exten), sizeof(hint) - 1);
+ cur = hint;
+ do {
+ rest = strchr(cur, '&');
+ if (rest) {
+ *rest = 0;
+ rest++;
+ }
+
+ if (!strcmp(cur, device)) {
+ // Found extension execute callbacks
+ state = ast_extension_state2(list->exten);
+ if ((state != -1) && (state != list->laststate)) {
+ // For general callbacks
+ cblist = statecbs;
+ while (cblist) {
+ cblist->callback(list->exten->parent->name, list->exten->exten, state, cblist->data);
+ cblist = cblist->next;
+ }
+
+ // For extension callbacks
+ cblist = list->callbacks;
+ while (cblist) {
+ cblist->callback(list->exten->parent->name, list->exten->exten, state, cblist->data);
+ cblist = cblist->next;
+ }
+
+ list->laststate = state;
+ }
+ break;
+ }
+ cur = rest;
+ } while (cur);
+
+ list = list->next;
+ }
+
+ ast_mutex_unlock(&hintlock);
+ return 1;
}
int ast_extension_state_add(char *context, char *exten,
@@ -1684,12 +1684,12 @@
}
-int ast_get_hint(char *hint, int maxlen, struct ast_channel *c, char *context, char *exten)
+int ast_get_hint(char *hint, int hintsize, struct ast_channel *c, char *context, char *exten)
{
struct ast_exten *e;
e = ast_hint_extension(c, context, exten);
if (e) {
- strncpy(hint, ast_get_extension_app(e), maxlen);
+ strncpy(hint, ast_get_extension_app(e), hintsize - 1);
return -1;
}
return 0;
@@ -1907,7 +1907,8 @@
ast_log(LOG_WARNING, "Don't know what to do with '%s'\n", c->name);
out:
if ((res != AST_PBX_KEEPALIVE) && ast_exists_extension(c, c->context, "h", 1, c->callerid)) {
- strcpy(c->exten, "h");
+ c->exten[0] = 'h';
+ c->exten[1] = '\0';
c->priority = 1;
while(ast_exists_extension(c, c->context, c->exten, c->priority, c->callerid)) {
if ((res = ast_spawn_extension(c, c->context, c->exten, c->priority, c->callerid))) {
@@ -3696,7 +3697,7 @@
ext_strncpy(tmp->cidmatch, callerid, sizeof(tmp->cidmatch));
tmp->matchcid = 1;
} else {
- strcpy(tmp->cidmatch, "");
+ tmp->cidmatch[0] = '\0';
tmp->matchcid = 0;
}
strncpy(tmp->app, application, sizeof(tmp->app)-1);
Index: srv.c
===================================================================
RCS file: /usr/cvsroot/asterisk/srv.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- srv.c 22 Jun 2004 20:11:15 -0000 1.9
+++ srv.c 14 Jul 2004 07:44:19 -0000 1.10
@@ -60,7 +60,7 @@
if (res && strcmp(repl, ".")) {
ast_verbose( VERBOSE_PREFIX_3 "parse_srv: SRV mapped to host %s, port %d\n", repl, ntohs(srv->portnum));
if (host) {
- strncpy(host, repl, hostlen - 2);
+ strncpy(host, repl, hostlen - 1);
host[hostlen-1] = '\0';
}
if (portno)
@@ -109,7 +109,7 @@
ret |= ast_autoservice_stop(chan);
if (ret <= 0) {
- strcpy(host, "");
+ host[0] = '\0';
*port = -1;
return ret;
}
Index: translate.c
===================================================================
RCS file: /usr/cvsroot/asterisk/translate.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- translate.c 22 Jun 2004 20:11:15 -0000 1.27
+++ translate.c 14 Jul 2004 07:44:19 -0000 1.28
@@ -351,7 +351,9 @@
ast_cli(fd, " Source Format (Rows) Destination Format(Columns)\n\n");
ast_mutex_lock(&list_lock);
for (x=-1;x<SHOW_TRANS; x++) {
- strcpy(line, " ");
+ /* next 2 lines run faster than using strcpy() */
+ line[0] = ' ';
+ line[1] = '\0';
for (y=-1;y<SHOW_TRANS;y++) {
if (x >= 0 && y >= 0 && tr_matrix[x][y].step)
snprintf(line + strlen(line), sizeof(line) - strlen(line), " %5d", tr_matrix[x][y].cost >= 99999 ? tr_matrix[x][y].cost-99999 : tr_matrix[x][y].cost);
- Previous message: [Asterisk-cvs] asterisk/apps app_qcall.c,1.11,1.12 app_queue.c,1.75,1.76 app_record.c,1.19,1.20 app_rpt.c,1.16,1.17 app_setcidnum.c,1.3,1.4 app_sms.c,1.7,1.8 app_sql_postgres.c,1.6,1.7 app_striplsd.c,1.3,1.4 app_substring.c,1.8,1.9 app_txtcidname.c,1.6,1.7 app_voicemail.c,1.132,1.133 app_zapbarge.c,1.6,1.7 app_zapscan.c,1.13,1.14
- Next message: [Asterisk-cvs] asterisk/apps app_setcidname.c,1.3,1.4
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the svn-commits
mailing list