[OpenSER-Devel] SF.net SVN: openser: [3156] trunk/modules/permissions/mi.c

Dan Pascu dan at ag-projects.com
Mon Nov 19 10:54:46 UTC 2007


On Monday 19 November 2007, Bogdan-Andrei Iancu wrote:
> 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.

I think this is a short term solution to avoid issues, but I do not see it 
as an ideal solution. The main issue with it is that it hides the 
interface and makes a 3 argument function look like a 2 argument one in 
the code. I still believe that after 1.3 we should make that function 
receive a char* only and compute the length internally because a str 
doesn't help here and the macro computes strlen(_s) so there will be no 
runtime penalty anyway.

-- 
Dan



More information about the Devel mailing list