aboutsummaryrefslogtreecommitdiffstats
path: root/main/manager.c
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2008-12-13 08:36:35 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2008-12-13 08:36:35 +0000
commita41b34a63c52608e7e5c8e6aced613815461f4c2 (patch)
tree0559c99680217b78c0bda37a131b5f09794f43c6 /main/manager.c
parentb298a3aa9b396c4055bf75104b4fb89212c44d4a (diff)
Merge ast_str_opaque branch (discontinue usage of ast_str internals)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@163991 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/manager.c')
-rw-r--r--main/manager.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/main/manager.c b/main/manager.c
index 47a7f42b9..f3cda9e82 100644
--- a/main/manager.c
+++ b/main/manager.c
@@ -347,7 +347,7 @@ static char *authority_to_str(int authority, struct ast_str **res)
int i;
char *sep = "";
- (*res)->used = 0;
+ ast_str_reset(*res);
for (i = 0; i < ARRAY_LEN(perms) - 1; i++) {
if (authority & perms[i].num) {
ast_str_append(res, 0, "%s%s", sep, perms[i].label);
@@ -355,10 +355,10 @@ static char *authority_to_str(int authority, struct ast_str **res)
}
}
- if ((*res)->used == 0) /* replace empty string with something sensible */
+ if (ast_str_strlen(*res) == 0) /* replace empty string with something sensible */
ast_str_append(res, 0, "<none>");
- return (*res)->str;
+ return ast_str_buffer(*res);
}
/*! Tells you if smallstr exists inside bigstr
@@ -950,10 +950,11 @@ void astman_append(struct mansession *s, const char *fmt, ...)
ast_str_set_va(&buf, 0, fmt, ap);
va_end(ap);
- if (s->f != NULL)
- send_string(s, buf->str);
- else
+ if (s->f != NULL) {
+ send_string(s, ast_str_buffer(buf));
+ } else {
ast_verbose("fd == -1 in astman_append, should not happen\n");
+ }
}
/*! \note NOTE: XXX this comment is unclear and possibly wrong.
@@ -1525,11 +1526,12 @@ static int action_createconfig(struct mansession *s, const struct message *m)
ast_str_set(&filepath, 0, "%s/", ast_config_AST_CONFIG_DIR);
ast_str_append(&filepath, 0, "%s", fn);
- if ((fd = open(filepath->str, O_CREAT | O_EXCL, AST_FILE_MODE)) != -1) {
+ if ((fd = open(ast_str_buffer(filepath), O_CREAT | O_EXCL, AST_FILE_MODE)) != -1) {
close(fd);
astman_send_ack(s, m, "New configuration file created successfully");
- } else
+ } else {
astman_send_error(s, m, strerror(errno));
+ }
return 0;
}
@@ -1939,7 +1941,7 @@ static int action_status(struct mansession *s, const struct message *m)
c->accountcode,
c->_state,
ast_state2str(c->_state), c->context,
- c->exten, c->priority, (long)elapsed_seconds, bridge, c->uniqueid, str->str, idText);
+ c->exten, c->priority, (long)elapsed_seconds, bridge, c->uniqueid, ast_str_buffer(str), idText);
} else {
astman_append(s,
"Event: Status\r\n"
@@ -1958,7 +1960,7 @@ static int action_status(struct mansession *s, const struct message *m)
S_OR(c->cid.cid_num, "<unknown>"),
S_OR(c->cid.cid_name, "<unknown>"),
c->accountcode,
- ast_state2str(c->_state), bridge, c->uniqueid, str->str, idText);
+ ast_state2str(c->_state), bridge, c->uniqueid, ast_str_buffer(str), idText);
}
ast_channel_unlock(c);
if (!all)
@@ -3268,7 +3270,7 @@ int __manager_event(int category, const char *event,
ast_str_append(&buf, 0, "\r\n");
- append_event(buf->str, category);
+ append_event(ast_str_buffer(buf), category);
/* Wake up any sleeping sessions */
AST_LIST_LOCK(&sessions);
@@ -3289,7 +3291,7 @@ int __manager_event(int category, const char *event,
AST_RWLIST_RDLOCK(&manager_hooks);
AST_RWLIST_TRAVERSE(&manager_hooks, hook, list) {
- hook->helper(category, event, buf->str);
+ hook->helper(category, event, ast_str_buffer(buf));
}
AST_RWLIST_UNLOCK(&manager_hooks);