diff options
author | Richard Mudgett <rmudgett@digium.com> | 2014-09-29 21:18:54 +0000 |
---|---|---|
committer | Richard Mudgett <rmudgett@digium.com> | 2014-09-29 21:18:54 +0000 |
commit | 270932635d8fa0babe6af40e71b5e867e7cb0599 (patch) | |
tree | 2ffbd6142aa6c2293b2330e15779c2f85673f909 /res/res_pjsip.c | |
parent | 9d2bc0675a6de60ea6df50a6becaa0b4f84bba93 (diff) |
Simplify UUID generation in several places.
Replace code using ast_uuid_generate() with simpler and faster code using
ast_uuid_generate_str(). The new code avoids a malloc(), free(), and
copy.
........
Merged revisions 424103 from http://svn.asterisk.org/svn/asterisk/branches/12
........
Merged revisions 424105 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@424109 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/res_pjsip.c')
-rw-r--r-- | res/res_pjsip.c | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/res/res_pjsip.c b/res/res_pjsip.c index b87be9140..a7f684650 100644 --- a/res/res_pjsip.c +++ b/res/res_pjsip.c @@ -1978,11 +1978,7 @@ static int sip_dialog_create_from(pj_pool_t *pool, pj_str_t *from, const char *u char uuid_str[AST_UUID_STR_LEN]; if (ast_strlen_zero(user)) { - RAII_VAR(struct ast_uuid *, uuid, ast_uuid_generate(), ast_free_ptr); - if (!uuid) { - return -1; - } - user = ast_uuid_to_str(uuid, uuid_str, sizeof(uuid_str)); + user = ast_uuid_generate_str(uuid_str, sizeof(uuid_str)); } /* Parse the provided target URI so we can determine what transport it will end up using */ @@ -2731,14 +2727,9 @@ int ast_sip_append_body(pjsip_tx_data *tdata, const char *body_text) struct ast_taskprocessor *ast_sip_create_serializer(void) { struct ast_taskprocessor *serializer; - RAII_VAR(struct ast_uuid *, uuid, ast_uuid_generate(), ast_free_ptr); char name[AST_UUID_STR_LEN]; - if (!uuid) { - return NULL; - } - - ast_uuid_to_str(uuid, name, sizeof(name)); + ast_uuid_generate_str(name, sizeof(name)); serializer = ast_threadpool_serializer(name, sip_threadpool); if (!serializer) { |