[asterisk-dev] [asterisk-commits] eliel: branch group/appdocsxml r136850 - in /team/group/appdocsxml: apps/ cha...
Eliel Sardañons
eliels at gmail.com
Fri Aug 8 23:47:12 CDT 2008
Kevin,
I rolledback the commited code, I found a better way of doing
this, adding just two casts will remain the interface
(ast_register_application2) as is (I didn't think about other
applications compatibility), and let synopsis, description and syntax
be non-constant *char.
Thanks for the review!
Eliel
On 8/8/08, Eliel Sardanons <eliel at eliel.com.ar> wrote:
> Kevin,
> this strings are not the problem, they will never be changed at
> runtime, but the application/function structure ast_app and
> ast_custom_function are now populated with the XML documentation at runtime
> (the description,synopsis and syntax) with dynamically allocated memory so
> they won't be anymore 'const' data.
>
> ast_app {
> const char *description;
> }
>
> is now
>
> ast_app {
> char *description;
> }
>
> So, we need to pass as a paramater a non-constant argument to
> ast_register_application().
>
> Notice also that when finishing this proyect all this (const) descriptions
> will dissappear, and we will read all the documentation at runtime from the
> XMLs.
>
> We have two paths to follow:
> 1) Stay with those strings as constant and do some casting to avoid WARNINGs
> when passing them to the ast_register_application (that was my previous
> commit). This casting is needed because ast_register_application is waiting
> a constant string too.
>
> 2) Stay with them like non constant strings, while the proyect is not
> complete.
>
> I hope you understand why this was done... I dont know if it is the best
> way.
>
> Thanks in advanced
>
> Eliel
>
>
>
> On Fri, Aug 8, 2008 at 7:49 PM, Kevin P. Fleming <kpfleming at digium.com>
> wrote:
> > commits to the Asterisk project wrote:
> > > Author: eliel
> > > Date: Fri Aug 8 14:54:28 2008
> > > New Revision: 136850
> > >
> > > URL:
> http://svn.digium.com/view/asterisk?view=rev&rev=136850
> > > Log:
> > > Janitor (Move from 'static const char *' to 'static char *').
> > >
> > > Now we have syntax, description and synopsis of every
> application/function defined as 'char *'. This is an attempt to
> > > move every parameter in a register_application as
> custom_function_register to use 'char *' instead of 'const char *' when
> > > referencing a 'description' or a 'synopsys'.
> > >
> > > Also the casting made in ast_register_application2() to prevent WARNINGs
> was removed.
> >
> > Can someone explain why this was done? These strings are most definitely
> > *NOT* to be modified at runtime, unless you can absolutely guarantee
> > that they will never need extra storage. Even then, most of the usage of
> > these strings does not make copies of them, so changing them after
> > registration would be unacceptable.
> >
> > --
> > Kevin P. Fleming
> > Director of Software Technologies
> > Digium, Inc. - "The Genuine Asterisk Experience" (TM)
> >
> > _______________________________________________
> > --Bandwidth and Colocation Provided by http://www.api-digital.com--
> >
> > AstriCon 2008 - September 22 - 25 Phoenix, Arizona
> > Register Now: http://www.astricon.net
> >
> > asterisk-dev mailing list
> > To UNSUBSCRIBE or update options visit:
> >
> http://lists.digium.com/mailman/listinfo/asterisk-dev
> >
>
>
>
> --
> Eliel Sardañons
>
--
Eliel Sardañons
More information about the asterisk-dev
mailing list