[asterisk-bugs] [Asterisk 0017713]: [patch] Add FIELDNUM() function, returns position of a field in a list
Asterisk Bug Tracker
noreply at bugs.digium.com
Mon Jul 26 23:42:56 CDT 2010
A NOTE has been added to this issue.
======================================================================
https://issues.asterisk.org/view.php?id=17713
======================================================================
Reported By: gareth
Assigned To:
======================================================================
Project: Asterisk
Issue ID: 17713
Category: Functions/NewFeature
Reproducibility: N/A
Severity: feature
Priority: normal
Status: ready for testing
Asterisk Version: SVN
JIRA: SWP-1947
Regression: No
Reviewboard Link:
SVN Branch (only for SVN checkouts, not tarball releases): trunk
SVN Revision (number only!): 276613
Request Review:
======================================================================
Date Submitted: 2010-07-26 00:08 CDT
Last Modified: 2010-07-26 23:42 CDT
======================================================================
Summary: [patch] Add FIELDNUM() function, returns position of
a field in a list
Description:
FIELDNUM() returns the position of a field in a character delimited list,
ie:
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)
======================================================================
----------------------------------------------------------------------
(0125096) tilghman (administrator) - 2010-07-26 23:42
https://issues.asterisk.org/view.php?id=17713#c125096
----------------------------------------------------------------------
Please add your patch to https://reviewboard.asterisk.org/. Use your same
username and password as on issues to login. I'd like to review this patch
line by line.
One thing that needs to be done is to check the return value of
ast_get_encoded_char, to ensure that the input for the field is valid. A
second thing to do is to use the read2 API for your custom function instead
of the original; there is an additional efficiency benefit with returning a
dynamic string buffer, as Asterisk does not need to allocate a large buffer
for a small numeric result. Even if you didn't do this, specifying
read_max as 12 (maximum size for a positive integer) additionally assists
in this efficiency.
Issue History
Date Modified Username Field Change
======================================================================
2010-07-26 23:42 tilghman Note Added: 0125096
======================================================================
More information about the asterisk-bugs
mailing list