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 11:50:56 -0500
commit5eb7875243905927693242b52f5434634e64a1d8 (patch)
treed8ccc8112c6c17722e8b52ae0487bb233e3685f4 /addons
parentf29ea24d9f1d5771f7a5fe2f0bae51c4bf9a657a (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 b9ca81f36..cdc641bd1 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]);