[asterisk-dev] [Code Review] Add FIELDNUM() function which returns the position number of a field in a list.
Gareth Palmer
gareth at acsdata.co.nz
Thu Jul 29 21:03:54 CDT 2010
On Thu, 2010-07-29 at 15:02 -0500, Tilghman Lesher wrote:
> On Thursday 29 July 2010 14:51:22 Rod Dorman wrote:
> > On Thursday, July 29, 2010, 15:20:24, Tilghman Lesher wrote:
> > > /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.
> >
> > Why not use a -1 to signal an error?
>
> That would be fine, as well, as long as it's documented that way.
The problem have with returning -1 is that constructs like
GotoIf(${FIELDNUM(...)}?true:false) will take the 'true' path on error.
I will change it so that it returns 0 on error.
> --
> Tilghman Lesher
> Digium, Inc. | Senior Software Developer
> twitter: Corydon76 | IRC: Corydon76-dig (Freenode)
> Check us out at: www.digium.com & www.asterisk.org
>
More information about the asterisk-dev
mailing list