summaryrefslogtreecommitdiff
path: root/res/res_config_ldap.c
diff options
context:
space:
mode:
authorSean Bright <sean.bright@gmail.com>2017-02-21 09:56:54 -0500
committerSean Bright <sean.bright@gmail.com>2017-02-21 10:53:17 -0600
commit6e6c96d713be2b745c4e033b6e5710dea72088df (patch)
treef112d117f05eaf4ea86b4c08317304ddaf20f0b0 /res/res_config_ldap.c
parent144b09ab41274498637a6cd8601f653658ecca8b (diff)
realtime: Centralize some common realtime backend code
All of the realtime backends create artificial ast_categorys to pass back into the core as query results. These categories have no filename or line number information associated with them and the backends differ slightly on how they create them. So create a couple helper macros to help make things more consistent. Also updated the call sites to remove redundant error messages about memory allocation failure. Note that res_config_ldap sets the category filename to the 'table name' but that is not read by anything in the core, so I've dropped it. Change-Id: I3a1fd91e0c807dea1ce3b643b0a6fe5be9002897
Diffstat (limited to 'res/res_config_ldap.c')
-rw-r--r--res/res_config_ldap.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/res/res_config_ldap.c b/res/res_config_ldap.c
index 5e95853d4..7bbac0ce0 100644
--- a/res/res_config_ldap.c
+++ b/res/res_config_ldap.c
@@ -1043,10 +1043,8 @@ static struct ast_config *realtime_multi_ldap(const char *basedn,
struct ast_variable **p = vars;
while (*p) {
- struct ast_category *cat = NULL;
- cat = ast_category_new("", table_name, -1);
+ struct ast_category *cat = ast_category_new_anonymous();
if (!cat) {
- ast_log(LOG_ERROR, "Unable to create a new category!\n");
break;
} else {
struct ast_variable *var = *p;
@@ -1195,7 +1193,7 @@ static struct ast_config *config_ldap(const char *basedn, const char *table_name
if (!last_category || strcmp(last_category, categories[i].name) ||
last_category_metric != categories[i].metric) {
- cur_cat = ast_category_new(categories[i].name, table_name, -1);
+ cur_cat = ast_category_new_dynamic(categories[i].name);
if (!cur_cat) {
break;
}