[asterisk-dev] Named lists: app submission
John Todd
jtodd at loligo.com
Tue Aug 14 20:20:48 CDT 2007
>On Tuesday 14 August 2007 18:04:38 John Todd wrote:
>> My company has built app_list.c, which creates named arrays. It's
>
>Something like that already exists. It's called HASH(), and it lives in
>trunk, in funcs/func_strings.c.
>
>--
>Tilghman
Ah, I had not understood HASH to work in that way - now it makes a
bit more sense. Thanks for the pointer! I had always seen it as an
adjunct to ODBC, and not as a standalone string function.
Looking at HASH (and ClearHash, and HASHKEYS) I see how we might have
been able to use those functions/app to do what we wanted, but I'm
not disappointed that this app was written. It seems to be a little
less effort on the dialplan side. HASH seems to have the following
differences from app_list:
1) HASH doesn't have the ability to delete and shift within the list
2) HASH can't push/delete values into/from the list at arbitrary points and
push the rest of the stack downwards/upwards
3) HASH can't set a bunch of values at once (minor issue)
4) HASH can't report on the length of the non-null values in the list
It seems that our application works more like a stack or heap than
how HASH works. The iteration involved in making HASH collapse and
expand data in a hashname array seems to imply some additional
dialplan code to make it work like app_list, but I suppose that some
additional complexity could make it mimic those features. It does
seem, however, that HASH might easily be modified to support these
pop/push features.
Donny:
Yes, we'll look at the ast_datastore struct. Some way to prevent
memory leakage seems to be a Very Good Idea.
PS: Mildly related - does anyone other than me find the function
"ARRAY" to be confusingly mis-named as far as historical contextual
meaning of the word "array" in other programming languages?
JT
More information about the asterisk-dev
mailing list