[asterisk-dev] [Code Review] Add FIELDNUM() function which returns the position number of a field in a list.

Tilghman Lesher tlesher at digium.com
Thu Jul 29 14:20:24 CDT 2010


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/810/#review2505
-----------------------------------------------------------



/trunk/funcs/func_strings.c
<https://reviewboard.asterisk.org/r/810/#comment5529>

    Just had one more thought.  Since "0" is our "not found" value, should we set that value on error, as well?  Blank is always a somewhat problematic return value for functions that normally return integers.


- Tilghman


On 2010-07-28 23:15:39, gareth wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/810/
> -----------------------------------------------------------
> 
> (Updated 2010-07-28 23:15:39)
> 
> 
> Review request for Asterisk Developers and Tilghman Lesher.
> 
> 
> Summary
> -------
> 
> Add FIELDNUM() function which returns the position number of a field in a list. Examples:
> 
> Set(LIST=apples/oranges/bananas/grapes)
> ${FIELDNUM(LIST,/,oranges)} => Returns '2'
> ${FIELDNUM(LIST,/,bananas)} => Returns '3'
> ${FIELDNUM(LIST,/,chicken)} => Returns '0'
> ${FIELDNUM(LIST,#,bananas)} => Returns '0' (Note: wrong delimiter)
> 
> 
> This addresses bug 17713.
>     https://issues.asterisk.org/view.php?id=17713
> 
> 
> Diffs
> -----
> 
>   /trunk/CHANGES 279754 
>   /trunk/funcs/func_strings.c 279754 
> 
> Diff: https://reviewboard.asterisk.org/r/810/diff
> 
> 
> Testing
> -------
> 
> Performed a few tests using SetVar/GetVar via AMI. Added test function for TEST_FRAMEWORK and verified that all tests passed.
> 
> 
> Thanks,
> 
> gareth
> 
>




More information about the asterisk-dev mailing list