|
|
@ -98,6 +98,14 @@ struct cache_file_mtime {
|
|
|
|
|
|
|
|
|
|
|
|
static AST_LIST_HEAD_STATIC(cfmtime_head, cache_file_mtime);
|
|
|
|
static AST_LIST_HEAD_STATIC(cfmtime_head, cache_file_mtime);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int init_appendbuf(void *data)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
struct ast_str **str = data;
|
|
|
|
|
|
|
|
*str = ast_str_create(16);
|
|
|
|
|
|
|
|
return *str ? 0 : -1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
AST_THREADSTORAGE_CUSTOM(appendbuf, init_appendbuf, ast_free_ptr);
|
|
|
|
|
|
|
|
|
|
|
|
/* comment buffers are better implemented using the ast_str_*() API */
|
|
|
|
/* comment buffers are better implemented using the ast_str_*() API */
|
|
|
|
#define CB_SIZE 250 /* initial size of comment buffers */
|
|
|
|
#define CB_SIZE 250 /* initial size of comment buffers */
|
|
|
@ -752,12 +760,8 @@ int ast_variable_update(struct ast_category *category, const char *variable,
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (prev)
|
|
|
|
/* Could not find variable to update */
|
|
|
|
prev->next = newer;
|
|
|
|
return -1;
|
|
|
|
else
|
|
|
|
|
|
|
|
category->root = newer;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int ast_category_delete(struct ast_config *cfg, const char *category)
|
|
|
|
int ast_category_delete(struct ast_config *cfg, const char *category)
|
|
|
@ -1083,23 +1087,51 @@ static int process_text_line(struct ast_config *cfg, struct ast_category **cat,
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
/* Just a line (variable = value) */
|
|
|
|
/* Just a line (variable = value) */
|
|
|
|
|
|
|
|
int object = 0;
|
|
|
|
if (!(*cat)) {
|
|
|
|
if (!(*cat)) {
|
|
|
|
ast_log(LOG_WARNING,
|
|
|
|
ast_log(LOG_WARNING,
|
|
|
|
"parse error: No category context for line %d of %s\n", lineno, configfile);
|
|
|
|
"parse error: No category context for line %d of %s\n", lineno, configfile);
|
|
|
|
return -1;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
c = strchr(cur, '=');
|
|
|
|
c = strchr(cur, '=');
|
|
|
|
if (c) {
|
|
|
|
|
|
|
|
int object;
|
|
|
|
if (c && c > cur && (*(c - 1) == '+')) {
|
|
|
|
|
|
|
|
struct ast_variable *var, *replace = NULL;
|
|
|
|
|
|
|
|
struct ast_str **str = ast_threadstorage_get(&appendbuf, sizeof(*str));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!str || !*str) {
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
*(c - 1) = '\0';
|
|
|
|
|
|
|
|
c++;
|
|
|
|
|
|
|
|
cur = ast_strip(cur);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Must iterate through category until we find last variable of same name (since there could be multiple) */
|
|
|
|
|
|
|
|
for (var = ast_category_first(*cat); var; var = var->next) {
|
|
|
|
|
|
|
|
if (!strcmp(var->name, cur)) {
|
|
|
|
|
|
|
|
replace = var;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!replace) {
|
|
|
|
|
|
|
|
/* Nothing to replace; just set a variable normally. */
|
|
|
|
|
|
|
|
goto set_new_variable;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ast_str_set(str, 0, "%s", replace->value);
|
|
|
|
|
|
|
|
ast_str_append(str, 0, "%s", c);
|
|
|
|
|
|
|
|
ast_variable_update(*cat, replace->name, ast_strip((*str)->str), replace->value, object);
|
|
|
|
|
|
|
|
} else if (c) {
|
|
|
|
*c = 0;
|
|
|
|
*c = 0;
|
|
|
|
c++;
|
|
|
|
c++;
|
|
|
|
/* Ignore > in => */
|
|
|
|
/* Ignore > in => */
|
|
|
|
if (*c== '>') {
|
|
|
|
if (*c== '>') {
|
|
|
|
object = 1;
|
|
|
|
object = 1;
|
|
|
|
c++;
|
|
|
|
c++;
|
|
|
|
} else
|
|
|
|
}
|
|
|
|
object = 0;
|
|
|
|
set_new_variable:
|
|
|
|
if ((v = ast_variable_new(ast_strip(cur), ast_strip(c), *suggested_include_file ? suggested_include_file : configfile))) {
|
|
|
|
if ((v = ast_variable_new(ast_strip(cur), ast_strip(c), S_OR(suggested_include_file, configfile)))) {
|
|
|
|
v->lineno = lineno;
|
|
|
|
v->lineno = lineno;
|
|
|
|
v->object = object;
|
|
|
|
v->object = object;
|
|
|
|
*last_cat = 0;
|
|
|
|
*last_cat = 0;
|
|
|
|