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:12 -0600
commitdc9bc25de994a487de817ad634548f87b8b03f0a (patch)
treea36cd56c7e1ca48be893148adc31d7a6a40d7b43 /addons
parentee2b02b36fb77591fa647a4ca97dba0807650720 (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 cd72b6c44..259650d4f 100644
--- a/addons/res_config_mysql.c
+++ b/addons/res_config_mysql.c
@@ -525,9 +525,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++) {
@@ -936,8 +935,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]);