Misc formatting cleanups

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3279 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
James Golovich
2004-06-22 20:11:15 +00:00
parent 024f486810
commit 3f9c34f415
10 changed files with 45 additions and 51 deletions

21
acl.c
View File

@@ -67,13 +67,11 @@ void ast_free_ha(struct ast_ha *ha)
/* Copy HA structure */ /* Copy HA structure */
static void ast_copy_ha(struct ast_ha *from, struct ast_ha *to) static void ast_copy_ha(struct ast_ha *from, struct ast_ha *to)
{ {
memcpy(&to->netaddr, &from->netaddr, sizeof(from->netaddr));
memcpy(&to->netaddr, &from->netaddr, sizeof(from->netaddr)); memcpy(&to->netmask, &from->netmask, sizeof(from->netmask));
memcpy(&to->netmask, &from->netmask, sizeof(from->netmask)); to->sense = from->sense;
to->sense = from->sense; }
}
/* Create duplicate of ha structure */ /* Create duplicate of ha structure */
static struct ast_ha *ast_duplicate_ha(struct ast_ha *original) static struct ast_ha *ast_duplicate_ha(struct ast_ha *original)
@@ -103,13 +101,12 @@ struct ast_ha *ast_duplicate_ha_list(struct ast_ha *original)
if (!ret) if (!ret)
ret = link; /* Save starting point */ ret = link; /* Save starting point */
start = start->next; /* Go to next object */ start = start->next; /* Go to next object */
prev = link; /* Save pointer to this object */ prev = link; /* Save pointer to this object */
} }
return (ret); /* Return start of list */ return (ret); /* Return start of list */
} }
struct ast_ha *ast_append_ha(char *sense, char *stuff, struct ast_ha *path) struct ast_ha *ast_append_ha(char *sense, char *stuff, struct ast_ha *path)
{ {
struct ast_ha *ha = malloc(sizeof(struct ast_ha)); struct ast_ha *ha = malloc(sizeof(struct ast_ha));

7
cdr.c
View File

@@ -503,11 +503,10 @@ void ast_cdr_reset(struct ast_cdr *cdr, int post)
} }
void ast_cdr_append(struct ast_cdr *cdr, struct ast_cdr *newcdr) { void ast_cdr_append(struct ast_cdr *cdr, struct ast_cdr *newcdr) {
if(cdr) { if (cdr) {
while(cdr->next) while(cdr->next)
cdr = cdr->next; cdr = cdr->next;
cdr->next = newcdr; cdr->next = newcdr;
} else } else
ast_log(LOG_ERROR, "Can't append a CDR to NULL!\n"); ast_log(LOG_ERROR, "Can't append a CDR to NULL!\n");
} }

View File

@@ -143,20 +143,20 @@ int ast_shutting_down(void)
void ast_channel_setwhentohangup(struct ast_channel *chan, time_t offset) void ast_channel_setwhentohangup(struct ast_channel *chan, time_t offset)
{ {
time_t myt; time_t myt;
time(&myt); time(&myt);
if (offset) if (offset)
chan->whentohangup = myt + offset; chan->whentohangup = myt + offset;
else else
chan->whentohangup = 0; chan->whentohangup = 0;
return; return;
} }
int ast_channel_register(char *type, char *description, int capabilities, int ast_channel_register(char *type, char *description, int capabilities,
struct ast_channel *(*requester)(char *type, int format, void *data)) struct ast_channel *(*requester)(char *type, int format, void *data))
{ {
return ast_channel_register_ex(type, description, capabilities, requester, NULL); return ast_channel_register_ex(type, description, capabilities, requester, NULL);
} }
int ast_channel_register_ex(char *type, char *description, int capabilities, int ast_channel_register_ex(char *type, char *description, int capabilities,
@@ -169,7 +169,7 @@ int ast_channel_register_ex(char *type, char *description, int capabilities,
return -1; return -1;
} }
chan = backends; chan = backends;
while(chan) { while (chan) {
if (!strcasecmp(type, chan->type)) { if (!strcasecmp(type, chan->type)) {
ast_log(LOG_WARNING, "Already have a handler for type '%s'\n", type); ast_log(LOG_WARNING, "Already have a handler for type '%s'\n", type);
ast_mutex_unlock(&chlock); ast_mutex_unlock(&chlock);
@@ -711,9 +711,9 @@ int ast_hangup(struct ast_channel *chan)
ast_mutex_unlock(&chan->lock); ast_mutex_unlock(&chan->lock);
manager_event(EVENT_FLAG_CALL, "Hangup", manager_event(EVENT_FLAG_CALL, "Hangup",
"Channel: %s\r\n" "Channel: %s\r\n"
"Uniqueid: %s\r\n" "Uniqueid: %s\r\n"
"Cause: %i\r\n", "Cause: %i\r\n",
chan->name, chan->uniqueid, chan->hangupcause); chan->name, chan->uniqueid, chan->hangupcause);
ast_channel_free(chan); ast_channel_free(chan);
return res; return res;
} }

View File

@@ -441,12 +441,11 @@ static int cfg_process(struct ast_config *tmp, struct ast_category **_tmpc, stru
char *cur; char *cur;
char *arg=NULL; char *arg=NULL;
struct ast_config_reg *reg=NULL; struct ast_config_reg *reg=NULL;
struct ast_config *(*load_func)(char *, struct ast_config *,struct ast_category **,struct ast_variable **,int struct ast_config *(*load_func)(char *, struct ast_config *,struct ast_category **,struct ast_variable **,int
#ifdef PRESERVE_COMMENTS #ifdef PRESERVE_COMMENTS
,struct ast_comment_struct * ,struct ast_comment_struct *
#endif #endif
); );
struct ast_variable *v; struct ast_variable *v;
#ifdef PRESERVE_COMMENTS #ifdef PRESERVE_COMMENTS
struct ast_comment *com = NULL; struct ast_comment *com = NULL;

2
dns.c
View File

@@ -99,7 +99,7 @@ static int dns_parse_answer(void *context,
int res; int res;
int x; int x;
h = (dns_HEADER *)answer; h = (dns_HEADER *)answer;
answer += sizeof(dns_HEADER); answer += sizeof(dns_HEADER);
len -= sizeof(dns_HEADER); len -= sizeof(dns_HEADER);

View File

@@ -502,7 +502,7 @@ char *ast_codec2str(int codec) {
"undefined", /* 13 */ "undefined", /* 13 */
"undefined", /* 14 */ "undefined", /* 14 */
"Maximum audio format", /* 15 */ "Maximum audio format", /* 15 */
/* Image formats */ /* Image formats */
"JPEG image", /* 16 */ "JPEG image", /* 16 */
"PNG image", /* 17 */ "PNG image", /* 17 */
"H.261 Video", /* 18 */ "H.261 Video", /* 18 */
@@ -511,7 +511,7 @@ char *ast_codec2str(int codec) {
"undefined", /* 21 */ "undefined", /* 21 */
"undefined", /* 22 */ "undefined", /* 22 */
"undefined", /* 23 */ "undefined", /* 23 */
"Maximum video format", /* 24 */ "Maximum video format", /* 24 */
}; };
if ((codec >= 0) && (codec <= 24)) if ((codec >= 0) && (codec <= 24))
return codecs[codec]; return codecs[codec];

View File

@@ -167,7 +167,7 @@ int ast_playtones_start(struct ast_channel *chan, int vol, const char *playlst,
else else
separator = ","; separator = ",";
s = strsep(&stringp,separator); s = strsep(&stringp,separator);
while(s && *s) { while (s && *s) {
int freq1, freq2, time, modulate=0; int freq1, freq2, time, modulate=0;
if (s[0]=='!') if (s[0]=='!')

4
srv.c
View File

@@ -88,7 +88,7 @@ static int srv_callback(void *context, u_char *answer, int len, u_char *fullansw
if (!ast_strlen_zero(c->host)) if (!ast_strlen_zero(c->host))
return 1; return 1;
return 0; return 0;
} }
int ast_get_srv(struct ast_channel *chan, char *host, int hostlen, int *port, const char *service) int ast_get_srv(struct ast_channel *chan, char *host, int hostlen, int *port, const char *service)
@@ -110,7 +110,7 @@ int ast_get_srv(struct ast_channel *chan, char *host, int hostlen, int *port, co
if (ret <= 0) { if (ret <= 0) {
strcpy(host, ""); strcpy(host, "");
*port = -1; *port = -1;
return ret; return ret;
} }
return ret; return ret;

View File

@@ -326,26 +326,25 @@ static void rebuild_matrix(int samples)
static int show_translation(int fd, int argc, char *argv[]) static int show_translation(int fd, int argc, char *argv[])
{ {
#define SHOW_TRANS 11 #define SHOW_TRANS 11
int x,y,z; int x, y, z;
char line[80]; char line[80];
if (argc > 4) if (argc > 4)
return RESULT_SHOWUSAGE; return RESULT_SHOWUSAGE;
if(argv[2] && !strcasecmp(argv[2],"recalc")) { if (argv[2] && !strcasecmp(argv[2],"recalc")) {
z = argv[3] ? atoi(argv[3]) : 1; z = argv[3] ? atoi(argv[3]) : 1;
if(z <= 0) { if (z <= 0) {
ast_cli(fd," C'mon let's be serious here... defaulting to 1.\n"); ast_cli(fd," C'mon let's be serious here... defaulting to 1.\n");
z = 1; z = 1;
} }
if(z > MAX_RECALC) {
ast_cli(fd," Maximum limit of recalc exceeded by %d, truncating value to %d\n",z-MAX_RECALC,MAX_RECALC);
z = MAX_RECALC;
}
ast_cli(fd," Recalculating Codec Translation (number of sample seconds: %d)\n\n",z);
rebuild_matrix(z);
if (z > MAX_RECALC) {
ast_cli(fd," Maximum limit of recalc exceeded by %d, truncating value to %d\n",z-MAX_RECALC,MAX_RECALC);
z = MAX_RECALC;
}
ast_cli(fd," Recalculating Codec Translation (number of sample seconds: %d)\n\n",z);
rebuild_matrix(z);
} }
ast_cli(fd, " Translation times between formats (in milliseconds)\n"); ast_cli(fd, " Translation times between formats (in milliseconds)\n");

View File

@@ -24,8 +24,8 @@
AST_MUTEX_DEFINE_STATIC(__mutex); AST_MUTEX_DEFINE_STATIC(__mutex);
static int gethostbyname_r (const char *name, struct hostent *ret, char *buf, static int gethostbyname_r (const char *name, struct hostent *ret, char *buf,
size_t buflen, struct hostent **result, size_t buflen, struct hostent **result,
int *h_errnop) int *h_errnop)
{ {
int hsave; int hsave;
struct hostent *ph; struct hostent *ph;