summaryrefslogtreecommitdiff
path: root/main/config.c
diff options
context:
space:
mode:
authorTilghman Lesher <tilghman@meg.abyt.es>2007-01-07 16:21:12 +0000
committerTilghman Lesher <tilghman@meg.abyt.es>2007-01-07 16:21:12 +0000
commitc4c2c546da7546a3ebd349cfd61e5ec27a3e2e12 (patch)
tree7a7b6db348f112659b0159872ae3b3aa727df3ea /main/config.c
parent785483f3040f47d2fd34e9904f04d6408470d083 (diff)
When calling the Realtime app more than once, unset fields which were
previously set are erroneously still set (Bug 6701). After discussion, it was determined this should only be changed in trunk. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@49801 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/config.c')
-rw-r--r--main/config.c31
1 files changed, 30 insertions, 1 deletions
diff --git a/main/config.c b/main/config.c
index 4a14d21b5..28e9708a7 100644
--- a/main/config.c
+++ b/main/config.c
@@ -1314,7 +1314,7 @@ struct ast_config *ast_config_load_with_comments(const char *filename)
return result;
}
-struct ast_variable *ast_load_realtime(const char *family, ...)
+struct ast_variable *ast_load_realtime_all(const char *family, ...)
{
struct ast_config_engine *eng;
char db[256]="";
@@ -1331,6 +1331,35 @@ struct ast_variable *ast_load_realtime(const char *family, ...)
return res;
}
+struct ast_variable *ast_load_realtime(const char *family, ...)
+{
+ struct ast_variable *res, *cur, *prev = NULL, *freeme = NULL;
+ va_list ap;
+
+ va_start(ap, family);
+ res = ast_load_realtime_all(family, ap);
+ va_end(ap);
+
+ /* Eliminate blank entries */
+ for (cur = res; cur; cur = cur->next) {
+ if (freeme) {
+ free(freeme);
+ freeme = NULL;
+ }
+
+ if (ast_strlen_zero(cur->value)) {
+ if (prev)
+ prev->next = cur->next;
+ else
+ res = cur->next;
+ freeme = cur;
+ } else {
+ prev = cur;
+ }
+ }
+ return res;
+}
+
/*! \brief Check if realtime engine is configured for family */
int ast_check_realtime(const char *family)
{