[OpenSER-Devel] SF.net SVN: openser: [3156] trunk/modules/permissions/mi.c
Bogdan-Andrei Iancu
bogdan at voice-system.ro
Mon Nov 19 10:41:23 UTC 2007
Hi,
To solve this potential problem without any change in the MI interface
and without no runtime penalties (strlen), I just added a small macro
MI_SSTR (MI Static String) to compute the len of a static string at
compile time.
With it, instead of having:
add_mi_node_child( rpl, 0, "Server", 6,......
you can do:
add_mi_node_child( rpl, 0, MI_SSTR("Server"),.....
As a POC, I did the changes on the MI core functions and the permission
module.
Regards,
Bogdan
Dan Pascu wrote:
> On Friday 16 November 2007, Henning Westerholt wrote:
>
>> On Friday 16 November 2007, Dan Pascu wrote:
>>
>>> Revision: 3156
>>>
>>> http://openser.svn.sourceforge.net/openser/?rev=3156&view=rev Author:
>>> dan_pascu
>>> Date: 2007-11-16 04:45:39 -0800 (Fri, 16 Nov 2007)
>>>
>>> Log Message:
>>> -----------
>>> Fixed length of string constants. This should be better done by
>>> #define-ing some constants and using sizeof(constant)-1 on them.
>>>
>> Hi Dan,
>>
>> even better would be to let mi_init_tree calculate the string length,
>> and avoid this manual and error-prone initialization. The small runtime
>> overhead is negligible, as the fifo commands are not performance
>> critical.
>>
>> Just an idea - best regards,
>>
>
> I agree. I see no real reason to pass both the string and its length as
> they are string constants statically defined in the code, not parts
> obtained from a str by processing (in which case a pointer and a length
> would be useful). In this case a simple char pointer would be enough and
> the mi module can compute the len using strlen on it.
>
> But this change is too big for 1.3
>
>
More information about the Devel
mailing list