Removed the fn2 field from the vm_state structure.
authorMark Michelson <mmichelson@digium.com>
Thu, 10 Jul 2008 20:33:13 +0000 (20:33 +0000)
committerMark Michelson <mmichelson@digium.com>
Thu, 10 Jul 2008 20:33:13 +0000 (20:33 +0000)
commit1c49415b195048388c7f4bf1bed9d787403ac5e6
treeca4f86ce8c8d3b5c795435ce37ef850fe4b5a07e
parent7588bcf690283cfd4516b8f8c3e9f9d2e87ccd35
Removed the fn2 field from the vm_state structure.

fn2 was used in three functions. In every case, it was initialized
in the function it was used in. This meant there was no need
to have it in a malloc'd structure just taking up space. Furthermore
two of the functions it was used in were completely unnecessary since
fn2 was set to exactly the same value as the vm_state's fn string.

fn2 was a char array sized at PATH_MAX. On my system, PATH_MAX is
4096. This equates to a 4K memory savings per vm_state allocated.
Since there is a vm_state malloc'd for every voicemail user on
the system, this could potentially add up nicely if there are lots
of users. In addition, a vm_state is allocated on the stack each
time a caller calls the VoiceMailMain application, meaning that
there is a significant stack savings with this patch too.

Of course, a single vm_state struct still takes up approximately
20K on my system (when using IMAP storage. Without IMAP storage,
there would be about another 300 bytes fewer usage), even with
this removal. Further optimizations are probably possible,
but most likely not as easy as this one.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@129734 65c4cc65-6c06-0410-ace0-fbb531ad65f3
apps/app_voicemail.c