[Asterisk-code-review] res pjsip outbound publish: Add multi-user support per confi... (asterisk[master])
George Joseph
asteriskteam at digium.com
Tue Apr 26 17:48:37 CDT 2016
George Joseph has posted comments on this change.
Change subject: res_pjsip_outbound_publish: Add multi-user support per configuration
......................................................................
Patch Set 1: Code-Review-1
(3 comments)
Just 2 quickies.
https://gerrit.asterisk.org/#/c/2709/1/res/res_pjsip_outbound_publish.c
File res/res_pjsip_outbound_publish.c:
PS1, Line 202: *! \brief hashing function for multi-user publish objects */
: static int outbound_publish_multi_hash(const void *obj, const int flags)
: {
: const char *key;
:
: switch (flags & OBJ_SEARCH_MASK) {
: case OBJ_SEARCH_KEY:
: key = obj;
: break;
: case OBJ_SEARCH_OBJECT:
: key = ast_sorcery_object_get_id(obj);
: break;
: default:
: ast_assert(0);
: return 0;
: }
: return ast_str_hash(key);
: }
You can use ast_sorcery_object_id_hash()
PS1, Line 222: static int outbound_publish_multi_cmp(void *obj, void *arg, int flags)
: {
: const struct ast_sip_outbound_publish *object_left = obj;
: const struct ast_sip_outbound_publish *object_right = arg;
: const char *right_key = arg;
: int cmp;
:
: switch (flags & OBJ_SEARCH_MASK) {
: case OBJ_SEARCH_OBJECT:
: right_key = ast_sorcery_object_get_id(object_right);
: /* Fall through */
: case OBJ_SEARCH_KEY:
: cmp = strcmp(ast_sorcery_object_get_id(object_left), right_key);
: break;
: case OBJ_SEARCH_PARTIAL_KEY:
: /* Not supported by container. */
: ast_assert(0);
: return 0;
: default:
: cmp = 0;
: break;
: }
: if (cmp) {
: return 0;
: }
: return CMP_MATCH;
: }
You can use ast_sorcery_object_id_cmp()
PS1, Line 1546: multi_publishes = ao2_container_alloc(DEFAULT_MULTI_BUCKETS,
: outbound_publish_multi_hash, outbound_publish_multi_cmp);
see previous note about using the sorcery built-in hash and cmp.
--
To view, visit https://gerrit.asterisk.org/2709
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Ib88dde024cc83c916424645d4f5bb84a0fa936cc
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Kevin Harwell <kharwell at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-HasComments: Yes
More information about the asterisk-code-review
mailing list