[asterisk-dev] [Code Review] Introduce CLI aliases and remove deprecated CLI commands because we now have aliases for them

Eliel Sardañons eliel at eliel.net
Fri Nov 7 10:51:51 CST 2008


You could look at how __ast_alloc_region() is allocating the space for the
structure:
strptr = malloc(size + sizeof(*reg) + sizeof(*data) + extrada);
so, we only have one pointer for the structure, i think he is talking about
this...


On Fri, Nov 7, 2008 at 1:59 PM, Michiel van Baak <michiel at vanbaak.info>wrote:

>
>
> > On 2008-11-07 08:38:08, Russell Bryant wrote:
> > > trunk/res/res_clialiases.c, lines 47-48
> > > <http://reviewboard.digium.com/r/32/diff/2/?file=1214#file1214line47>
> > >
> > >     Usually, instead of having multiple malloc'd strings in a struct, I
> would say use the stringfields API instead.  Since it's only 2 here, the
> benefits aren't quite as big.  However, for the sake of consistency, I'd
> still say go with stringfields.
> >
> >  wrote:
> >     If the strings are not modified after the structure allocation, even
> stringfields are too much overhead; I'd just use the 'allocate after the
> structure' trick and put the strings directly into the same memory block as
> the structure.
> >
> >  wrote:
> >     Good point.  +1 to this suggestion.
>
> ehm, can you give me an example of what you mean with this ?
> I notice that my C skillz are poor every day ;-)
>
>
> > On 2008-11-07 08:38:08, Russell Bryant wrote:
> > > trunk/main/cli.c, line 1931
> > > <http://reviewboard.digium.com/r/32/diff/2/?file=1207#file1207line1931
> >
> > >
> > >     brace on the next line
>
> Function is removed in the new version (patch will be added soon, waiting
> for the sample I asked on the next comment)
>
>
> > On 2008-11-07 08:38:08, Russell Bryant wrote:
> > > trunk/res/res_clialiases.c, lines 236-238
> > > <http://reviewboard.digium.com/r/32/diff/2/?file=1214#file1214line236>
> > >
> > >     You can simplify this a bit:
> > >
> > >     ao2_callback(cli_aliases, OBJ_UNLINK | OBJ_NODATA | OBJ_MULTIPLE,
> alias_marked, NULL);
>
> done
>
>
> > On 2008-11-07 08:38:08, Russell Bryant wrote:
> > > trunk/res/res_clialiases.c, line 188
> > > <http://reviewboard.digium.com/r/32/diff/2/?file=1214#file1214line188>
> > >
> > >     return CMP_MATCH | CMP_STOP to be more explicit about what you want
> it to do
>
> done
>
>
> - Michiel
>
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://reviewboard.digium.com/r/32/#review98
> -----------------------------------------------------------
>
>
> On 2008-11-05 17:11:12, Michiel van Baak wrote:
> >
> > -----------------------------------------------------------
> > This is an automatically generated e-mail. To reply, visit:
> > http://reviewboard.digium.com/r/32/
> > -----------------------------------------------------------
> >
> > (Updated 2008-11-05 17:11:12)
> >
> >
> > Review request for Asterisk Developers.
> >
> >
> > Summary
> > -------
> >
> > This patch introduces cli aliases.
> > The config file holds a bunch of aliases for the deprecated commands in
> trunk so I could remove them from the code.
> >
> >
> > Diffs
> > -----
> >
> >   trunk/channels/chan_mgcp.c 154935
> >   trunk/channels/chan_sip.c 154935
> >   trunk/channels/chan_skinny.c 154935
> >   trunk/configs/cli_aliases.conf.sample PRE-CREATION
> >   trunk/funcs/func_devstate.c 154935
> >   trunk/include/asterisk/cli.h 154935
> >   trunk/main/asterisk.c 154935
> >   trunk/main/cdr.c 154935
> >   trunk/main/cli.c 154935
> >   trunk/main/pbx.c 154935
> >   trunk/main/rtp.c 154935
> >   trunk/main/udptl.c 154935
> >   trunk/pbx/pbx_ael.c 154935
> >   trunk/pbx/pbx_dundi.c 154935
> >   trunk/res/res_agi.c 154935
> >   trunk/res/res_clialiases.c PRE-CREATION
> >   trunk/res/res_jabber.c 154935
> >
> > Diff: http://reviewboard.digium.com/r/32/diff
> >
> >
> > Testing
> > -------
> >
> > compiles, installs and runs fine on my development laptop running OpenBSD
> 4.4
> >
> >
> > Thanks,
> >
> > Michiel
> >
> >
>
>
> _______________________________________________
> --Bandwidth and Colocation Provided by http://www.api-digital.com--
>
> asterisk-dev mailing list
> To UNSUBSCRIBE or update options visit:
>   http://lists.digium.com/mailman/listinfo/asterisk-dev
>



-- 
Eliel Sardañons
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-dev/attachments/20081107/32f74d74/attachment-0001.htm 


More information about the asterisk-dev mailing list