Use a shuffling algorithm to find unused IAX2 call numbers.
authorSean Bright <sean@malleable.com>
Thu, 14 Feb 2013 17:06:02 +0000 (17:06 +0000)
committerSean Bright <sean@malleable.com>
Thu, 14 Feb 2013 17:06:02 +0000 (17:06 +0000)
commit86a537c2712f99842d1076dc093ce654a76ed55c
tree65b10ad228eaaddfb5706be8083c1631490932a2
parent064c65d5a2eda5191a2f998f4ed3e08edce33785
Use a shuffling algorithm to find unused IAX2 call numbers.

While adding red-black tree containers to astobj2 in r376575, Richard pointed
out the way chan_iax2 finds unused call numbers will prevent ao2_container
integrity checks at runtime.

This patch removes the ao2_container and instead uses fixed sized arrays and a
modified Fisher-Yates-Durstenfeld shuffle to maintain the call number list.

While the locking semantics are similar to the ao2_container implementation,
this implementation should be faster and more memory efficient.

Review: https://reviewboard.asterisk.org/r/2288/

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@381427 65c4cc65-6c06-0410-ace0-fbb531ad65f3
channels/chan_iax2.c