mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-06 12:36:58 +00:00
Merge ast_str_opaque branch (discontinue usage of ast_str internals)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@163991 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -321,7 +321,7 @@ static int listfilter(struct ast_channel *chan, const char *cmd, char *parse, ch
|
||||
);
|
||||
const char *orig_list, *ptr;
|
||||
const char *begin, *cur, *next;
|
||||
int dlen, flen;
|
||||
int dlen, flen, first = 1;
|
||||
struct ast_str *result = ast_str_thread_get(&result_buf, 16);
|
||||
char *delim;
|
||||
|
||||
@@ -385,15 +385,12 @@ static int listfilter(struct ast_channel *chan, const char *cmd, char *parse, ch
|
||||
begin += flen + dlen;
|
||||
} else {
|
||||
/* Copy field to output */
|
||||
if (result->used) {
|
||||
if (!first) {
|
||||
ast_str_append(&result, 0, "%s", delim);
|
||||
}
|
||||
|
||||
/* Have to do it this way, since we're not null-terminated. */
|
||||
strncpy(result->str + result->used, begin, cur - begin);
|
||||
result->used += cur - begin;
|
||||
result->str[result->used] = '\0';
|
||||
|
||||
ast_str_append_substr(&result, 0, begin, cur - begin + 1);
|
||||
first = 0;
|
||||
begin = cur + dlen;
|
||||
}
|
||||
} while (*cur != '\0');
|
||||
@@ -401,7 +398,7 @@ static int listfilter(struct ast_channel *chan, const char *cmd, char *parse, ch
|
||||
ast_channel_unlock(chan);
|
||||
}
|
||||
|
||||
ast_copy_string(buf, result->str, len);
|
||||
ast_copy_string(buf, ast_str_buffer(result), len);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user