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_authenticator_digest.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_authenticator_digest.c')
-rw-r--r-- | res/res_pjsip_authenticator_digest.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/res/res_pjsip_authenticator_digest.c b/res/res_pjsip_authenticator_digest.c index d0ce36afb..2688553e5 100644 --- a/res/res_pjsip_authenticator_digest.c +++ b/res/res_pjsip_authenticator_digest.c @@ -443,15 +443,16 @@ static struct ast_sip_authenticator digest_authenticator = { static int build_entity_id(void) { - RAII_VAR(struct ast_uuid *, uu, ast_uuid_generate(), ast_free_ptr); - RAII_VAR(char *, eid, ao2_alloc(AST_UUID_STR_LEN, NULL), ao2_cleanup); + char *eid; - if (!uu || !eid) { + eid = ao2_alloc(AST_UUID_STR_LEN, NULL); + if (!eid) { return -1; } - ast_uuid_to_str(uu, eid, AST_UUID_STR_LEN); + ast_uuid_generate_str(eid, AST_UUID_STR_LEN); ao2_global_obj_replace_unref(entity_id, eid); + ao2_ref(eid, -1); return 0; } |