summaryrefslogtreecommitdiff
path: root/addons
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 /addons
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 'addons')
-rw-r--r--addons/res_config_mysql.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/addons/res_config_mysql.c b/addons/res_config_mysql.c
index f2ef949fc..b080d118b 100644
--- a/addons/res_config_mysql.c
+++ b/addons/res_config_mysql.c
@@ -523,9 +523,8 @@ static struct ast_config *realtime_multi_mysql(const char *database, const char
while ((row = mysql_fetch_row(result))) {
var = NULL;
- cat = ast_category_new("", "", -1);
+ cat = ast_category_new_anonymous();
if (!cat) {
- ast_log(LOG_WARNING, "Out of memory!\n");
continue;
}
for (i = 0; i < numFields; i++) {
@@ -934,8 +933,8 @@ static struct ast_config *config_mysql(const char *database, const char *table,
}
if (strcmp(last, row[0]) || last_cat_metric != atoi(row[3])) {
- if (!(cur_cat = ast_category_new(row[0], "", -1))) {
- ast_log(LOG_WARNING, "Out of memory!\n");
+ cur_cat = ast_category_new_dynamic(row[0]);
+ if (!cur_cat) {
break;
}
strcpy(last, row[0]);