Version 0.1.8 from FTP

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@294 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.0
Mark Spencer 24 years ago
parent 3de1dabd91
commit ad0aa8091a

@ -123,6 +123,21 @@ char *ast_variable_retrieve(struct ast_config *config, char *category, char *val
return NULL; return NULL;
} }
int ast_category_exist(struct ast_config *config, char *category_name)
{
struct ast_category *category = NULL;
category = config->root;
while(category) {
if (!strcasecmp(category->name,category_name))
return 1;
category = category->next;
}
return 0;
}
struct ast_config *ast_load(char *configfile) struct ast_config *ast_load(char *configfile)
{ {
char fn[256]; char fn[256];
@ -133,6 +148,7 @@ struct ast_config *ast_load(char *configfile)
FILE *f; FILE *f;
char *c, *cur; char *c, *cur;
int lineno=0; int lineno=0;
if (configfile[0] == '/') { if (configfile[0] == '/') {
strncpy(fn, configfile, sizeof(fn)); strncpy(fn, configfile, sizeof(fn));
} else { } else {
@ -167,10 +183,23 @@ struct ast_config *ast_load(char *configfile)
/* Actually parse the entry */ /* Actually parse the entry */
if (cur[0] == '[') { if (cur[0] == '[') {
/* A category header */ /* A category header */
/* XXX Don't let them use the same category twice XXX */
c = strchr(cur, ']'); c = strchr(cur, ']');
if (c) { if (c) {
*c = 0; *c = 0;
/*
* Check category duplicity before structure
* allocation
*/
if (ast_category_exist(tmp,cur+1)) {
ast_destroy(tmp);
ast_log(LOG_WARNING,
"Found duplicit category [%s] in "
"file %s line %d\n",
cur+1,configfile,lineno);
fclose(f);
return NULL;
}
tmpc = malloc(sizeof(struct ast_category)); tmpc = malloc(sizeof(struct ast_category));
if (!tmpc) { if (!tmpc) {
ast_destroy(tmp); ast_destroy(tmp);
@ -204,11 +233,15 @@ struct ast_config *ast_load(char *configfile)
if (c) { if (c) {
*c = 0; *c = 0;
c++; c++;
/* Ignore > in => */
if (*c== '>')
c++;
v = malloc(sizeof(struct ast_variable)); v = malloc(sizeof(struct ast_variable));
if (v) { if (v) {
v->next = NULL; v->next = NULL;
v->name = strdup(strip(cur)); v->name = strdup(strip(cur));
v->value = strdup(strip(c)); v->value = strdup(strip(c));
v->lineno = lineno;
if (last) if (last)
last->next = v; last->next = v;
else else

@ -23,6 +23,7 @@ struct ast_config;
struct ast_variable { struct ast_variable {
char *name; char *name;
char *value; char *value;
int lineno;
struct ast_variable *next; struct ast_variable *next;
}; };
@ -38,6 +39,8 @@ struct ast_variable *ast_variable_browse(struct ast_config *config, char *catego
char *ast_variable_retrieve(struct ast_config *config, char *category, char *value); char *ast_variable_retrieve(struct ast_config *config, char *category, char *value);
/* Determine affermativeness of a boolean value */ /* Determine affermativeness of a boolean value */
int ast_true(char *val); int ast_true(char *val);
/* Browse config structure and check for category duplicity Return non-zero if found */
int ast_category_exist(struct ast_config *config, char *category_name);
#if defined(__cplusplus) || defined(c_plusplus) #if defined(__cplusplus) || defined(c_plusplus)
} }

@ -124,10 +124,10 @@ static void __verboser(char *stuff, int opos, int replacelast, int complete)
static void verboser(char *stuff, int opos, int replacelast, int complete) static void verboser(char *stuff, int opos, int replacelast, int complete)
{ {
pthread_mutex_lock(&verb_lock); ast_pthread_mutex_lock(&verb_lock);
/* Lock appropriately if we're really being called in verbose mode */ /* Lock appropriately if we're really being called in verbose mode */
__verboser(stuff, opos, replacelast, complete); __verboser(stuff, opos, replacelast, complete);
pthread_mutex_unlock(&verb_lock); ast_pthread_mutex_unlock(&verb_lock);
} }
static void cliinput(void *data, int source, GdkInputCondition ic) static void cliinput(void *data, int source, GdkInputCondition ic)
@ -297,7 +297,7 @@ static void exit_now(GtkWidget *widget, gpointer data)
ast_unload_resource("pbx_gtkconsole", 0); ast_unload_resource("pbx_gtkconsole", 0);
if (option_verbose > 1) if (option_verbose > 1)
ast_verbose(VERBOSE_PREFIX_2 "GTK Console Monitor Exiting\n"); ast_verbose(VERBOSE_PREFIX_2 "GTK Console Monitor Exiting\n");
/* XXX Trying to quit after calling this makes asterisk segfault XXX */
} }
static void exit_completely(GtkWidget *widget, gpointer data) static void exit_completely(GtkWidget *widget, gpointer data)
@ -467,8 +467,6 @@ int load_module(void)
} }
g_thread_init(NULL); g_thread_init(NULL);
if (gtk_init_check(NULL, NULL)) { if (gtk_init_check(NULL, NULL)) {
/* XXX Do we need to call this twice? XXX */
gtk_init(NULL, NULL);
if (!show_console()) { if (!show_console()) {
inuse++; inuse++;
ast_update_use_count(); ast_update_use_count();

@ -62,8 +62,10 @@ struct sched_context *sched_context_create(void)
tmp->eventcnt = 1; tmp->eventcnt = 1;
tmp->schedcnt = 0; tmp->schedcnt = 0;
tmp->schedq = NULL; tmp->schedq = NULL;
#ifdef SCHED_MAX_CACHE
tmp->schedc = NULL; tmp->schedc = NULL;
tmp->schedccnt = 0; tmp->schedccnt = 0;
#endif
} }
return tmp; return tmp;
} }
@ -71,6 +73,7 @@ struct sched_context *sched_context_create(void)
void sched_context_destroy(struct sched_context *con) void sched_context_destroy(struct sched_context *con)
{ {
struct sched *s, *sl; struct sched *s, *sl;
#ifdef SCHED_MAX_CACHE
/* Eliminate the cache */ /* Eliminate the cache */
s = con->schedc; s = con->schedc;
while(s) { while(s) {
@ -78,6 +81,7 @@ void sched_context_destroy(struct sched_context *con)
s = s->next; s = s->next;
free(sl); free(sl);
} }
#endif
/* And the queue */ /* And the queue */
s = con->schedq; s = con->schedq;
while(s) { while(s) {
@ -255,8 +259,14 @@ void ast_sched_dump(struct sched_context *con)
struct timeval tv; struct timeval tv;
time_t s, ms; time_t s, ms;
gettimeofday(&tv, NULL); gettimeofday(&tv, NULL);
ast_log(LOG_DEBUG, "Cheops Schedule Dump (%d in Q, %d Total, %d Cache)\n", #ifdef SCHED_MAX_CACHE
ast_log(LOG_DEBUG, "Asterisk Schedule Dump (%d in Q, %d Total, %d Cache)\n",
con-> schedcnt, con->eventcnt - 1, con->schedccnt); con-> schedcnt, con->eventcnt - 1, con->schedccnt);
#else
ast_log(LOG_DEBUG, "Asterisk Schedule Dump (%d in Q, %d Total)\n",
con-> schedcnt, con->eventcnt - 1);
#endif
ast_log(LOG_DEBUG, "=================================================\n"); ast_log(LOG_DEBUG, "=================================================\n");
ast_log(LOG_DEBUG, "|ID Callback Data Time (sec:ms) |\n"); ast_log(LOG_DEBUG, "|ID Callback Data Time (sec:ms) |\n");
ast_log(LOG_DEBUG, "+-----+-----------+-----------+-----------------+\n"); ast_log(LOG_DEBUG, "+-----+-----------+-----------+-----------------+\n");

Loading…
Cancel
Save