[asterisk-bugs] [Asterisk 0015025]: [patch] Functions INC and DEC

Asterisk Bug Tracker noreply at bugs.digium.com
Wed May 13 10:09:37 CDT 2009


A NOTE has been added to this issue. 
====================================================================== 
https://issues.asterisk.org/view.php?id=15025 
====================================================================== 
Reported By:                greenfieldtech
Assigned To:                
====================================================================== 
Project:                    Asterisk
Issue ID:                   15025
Category:                   Functions/func_math
Reproducibility:            N/A
Severity:                   feature
Priority:                   normal
Status:                     new
Asterisk Version:           SVN 
Regression:                 No 
SVN Branch (only for SVN checkouts, not tarball releases):  trunk 
SVN Revision (number only!): 191919M 
Request Review:              
====================================================================== 
Date Submitted:             2009-05-03 20:30 CDT
Last Modified:              2009-05-13 10:09 CDT
====================================================================== 
Summary:                    [patch] Functions INC and DEC
Description: 
Over the course of time, developing Asterisk dialplans becomes fairly
cumbersome, especially when writing While() loops in the dialplan. Mainly,
when we want to iterate a few times, the ever annoying Set(Var=$[${Var} +
1]) is really annoying.
INCrement and DECrement follow the old PASCAL functions, allowing to
increment and decrement a variable.

The functions are built to handle both numeric and alpha-numeric values.
If an alpha-numeric value is given, the functions will simply bail out and
issue a LOG_NOTICE accordingly.

In order to implement this, i've added some functionality to func_math.c
and added a new ast_is_numeric function to strings.h

Please find attached patches for TRUNK.
====================================================================== 

---------------------------------------------------------------------- 
 (0104685) tilghman (administrator) - 2009-05-13 10:09
 https://issues.asterisk.org/view.php?id=15025#c104685 
---------------------------------------------------------------------- 
Yes, ast_strdupa does require you to lock the channel prior to using it. 
The point was that as the patch locks the channel for the entire time that
the duplicated string was in use, the ast_strdupa was not necessary (the
original string would have remained protected, since the channel was still
locked).  So you should either a) eliminate the ast_strdupa or b) reduce
the time the channel is locked to JUST the time that the lock is needed. 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2009-05-13 10:09 tilghman       Note Added: 0104685                          
======================================================================




More information about the asterisk-bugs mailing list