Summary:ASTERISK-20386: Named call pickup groups implementation improvements.
Reporter:Richard Mudgett (rmudgett)Labels:
Date Opened:2012-09-07 11:50:09Date Closed:2012-09-20 12:16:27
Versions:11.0.0-beta1 Frequency of
Description:The implementation of the struct ast_namedgroups leaves something to be desired.  There are a lot of little allocations that do not need to be done.

1) The struct ast_namedgroups is opaque everywhere which is good.  However, inside the implementation methods, it could just simply be cast to a struct ao2_container pointer.

2) The struct namedgroup_entry could be redefined so the name does not have to be separately allocated:
struct namedgroup_entry {
 /*! pre-built hash of groupname string */
 int hash;
 /*! string representation of group (End allocation of name string.) */
 char name[1];
The struct also does not have to be publicly defined.

3) The ast_namedgroups_intersect() routine should iterate over the container with the fewer members.  The other container just looks up the members of the first container in O(1) time.