[asterisk-dev] [Code Review] 4313: func_config: Add ability to retrieve specific occurrence of a variable
    George Joseph 
    reviewboard at asterisk.org
       
    Wed Jan  7 11:52:05 CST 2015
    
    
  
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/4313/
-----------------------------------------------------------
(Updated Jan. 7, 2015, 11:52 a.m.)
Status
------
This change has been marked as submitted.
Review request for Asterisk Developers.
Changes
-------
Committed in revision 430315
Repository: Asterisk
Description
-------
I guess nobody uses templates with AST_CONFIG because today if you have a context that inherits from a template and you call AST_CONFIG on the context, you'll get the value from the template even if you've overridden it in the context.  This is because AST_CONFIG only gets the first occurrence which is always from the template.
This patch adds an optional 'index' parameter to AST_CONFIG which lets you specify the exact occurrence to retrieve, or '-1' to retrieve the last.  The default behavior is the current behavior.
>From the new help...
[Syntax]
AST_CONFIG(config_file,category,variable_name[,index])
[Arguments]
index
    If there are multiple variables with the same name, you can specify
    '0' for the first item (default), '-1' for the last item, or any other
    number for that specific item.  '-1' is useful when the variable is derived
    from a template and you want the effective value (the last occurrence),
    not the value from the template (the first occurrence).
Diffs
-----
  branches/13/tests/test_config.c 430293 
  branches/13/funcs/func_config.c 430293 
Diff: https://reviewboard.asterisk.org/r/4313/diff/
Testing
-------
Added a unit test to test_config which passes of course.
Thanks,
George Joseph
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20150107/a62fc3d7/attachment.html>
    
    
More information about the asterisk-dev
mailing list