You could look at how __ast_alloc_region() is allocating the space for the structure:<br>strptr = malloc(size + sizeof(*reg) + sizeof(*data) + extrada);<br>so, we only have one pointer for the structure, i think he is talking about this...<br>
<br><br><div class="gmail_quote">On Fri, Nov 7, 2008 at 1:59 PM, Michiel van Baak <span dir="ltr"><<a href="mailto:michiel@vanbaak.info">michiel@vanbaak.info</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d"><br>
<br>
> On 2008-11-07 08:38:08, Russell Bryant wrote:<br>
> > trunk/res/res_clialiases.c, lines 47-48<br>
> > <<a href="http://reviewboard.digium.com/r/32/diff/2/?file=1214#file1214line47" target="_blank">http://reviewboard.digium.com/r/32/diff/2/?file=1214#file1214line47</a>><br>
> ><br>
> > 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.<br>
><br>
> wrote:<br>
> 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.<br>
><br>
</div><div class="Ih2E3d">> wrote:<br>
> Good point. +1 to this suggestion.<br>
<br>
</div>ehm, can you give me an example of what you mean with this ?<br>
I notice that my C skillz are poor every day ;-)<br>
<div class="Ih2E3d"><br>
<br>
> On 2008-11-07 08:38:08, Russell Bryant wrote:<br>
> > trunk/main/cli.c, line 1931<br>
</div>> > <<a href="http://reviewboard.digium.com/r/32/diff/2/?file=1207#file1207line1931" target="_blank">http://reviewboard.digium.com/r/32/diff/2/?file=1207#file1207line1931</a>><br>
> ><br>
> > brace on the next line<br>
<br>
Function is removed in the new version (patch will be added soon, waiting for the sample I asked on the next comment)<br>
<br>
<br>
> On 2008-11-07 08:38:08, Russell Bryant wrote:<br>
> > trunk/res/res_clialiases.c, lines 236-238<br>
> > <<a href="http://reviewboard.digium.com/r/32/diff/2/?file=1214#file1214line236" target="_blank">http://reviewboard.digium.com/r/32/diff/2/?file=1214#file1214line236</a>><br>
> ><br>
> > You can simplify this a bit:<br>
> ><br>
> > ao2_callback(cli_aliases, OBJ_UNLINK | OBJ_NODATA | OBJ_MULTIPLE, alias_marked, NULL);<br>
<br>
done<br>
<br>
<br>
> On 2008-11-07 08:38:08, Russell Bryant wrote:<br>
> > trunk/res/res_clialiases.c, line 188<br>
> > <<a href="http://reviewboard.digium.com/r/32/diff/2/?file=1214#file1214line188" target="_blank">http://reviewboard.digium.com/r/32/diff/2/?file=1214#file1214line188</a>><br>
> ><br>
> > return CMP_MATCH | CMP_STOP to be more explicit about what you want it to do<br>
<br>
done<br>
<div class="Ih2E3d"><br>
<br>
- Michiel<br>
<br>
<br>
-----------------------------------------------------------<br>
This is an automatically generated e-mail. To reply, visit:<br>
</div><a href="http://reviewboard.digium.com/r/32/#review98" target="_blank">http://reviewboard.digium.com/r/32/#review98</a><br>
<div><div></div><div class="Wj3C7c">-----------------------------------------------------------<br>
<br>
<br>
On 2008-11-05 17:11:12, Michiel van Baak wrote:<br>
><br>
> -----------------------------------------------------------<br>
> This is an automatically generated e-mail. To reply, visit:<br>
> <a href="http://reviewboard.digium.com/r/32/" target="_blank">http://reviewboard.digium.com/r/32/</a><br>
> -----------------------------------------------------------<br>
><br>
> (Updated 2008-11-05 17:11:12)<br>
><br>
><br>
> Review request for Asterisk Developers.<br>
><br>
><br>
> Summary<br>
> -------<br>
><br>
> This patch introduces cli aliases.<br>
> The config file holds a bunch of aliases for the deprecated commands in trunk so I could remove them from the code.<br>
><br>
><br>
> Diffs<br>
> -----<br>
><br>
> trunk/channels/chan_mgcp.c 154935<br>
> trunk/channels/chan_sip.c 154935<br>
> trunk/channels/chan_skinny.c 154935<br>
> trunk/configs/cli_aliases.conf.sample PRE-CREATION<br>
> trunk/funcs/func_devstate.c 154935<br>
> trunk/include/asterisk/cli.h 154935<br>
> trunk/main/asterisk.c 154935<br>
> trunk/main/cdr.c 154935<br>
> trunk/main/cli.c 154935<br>
> trunk/main/pbx.c 154935<br>
> trunk/main/rtp.c 154935<br>
> trunk/main/udptl.c 154935<br>
> trunk/pbx/pbx_ael.c 154935<br>
> trunk/pbx/pbx_dundi.c 154935<br>
> trunk/res/res_agi.c 154935<br>
> trunk/res/res_clialiases.c PRE-CREATION<br>
> trunk/res/res_jabber.c 154935<br>
><br>
> Diff: <a href="http://reviewboard.digium.com/r/32/diff" target="_blank">http://reviewboard.digium.com/r/32/diff</a><br>
><br>
><br>
> Testing<br>
> -------<br>
><br>
> compiles, installs and runs fine on my development laptop running OpenBSD 4.4<br>
><br>
><br>
> Thanks,<br>
><br>
> Michiel<br>
><br>
><br>
<br>
<br>
</div></div><div><div></div><div class="Wj3C7c">_______________________________________________<br>
--Bandwidth and Colocation Provided by <a href="http://www.api-digital.com--" target="_blank">http://www.api-digital.com--</a><br>
<br>
asterisk-dev mailing list<br>
To UNSUBSCRIBE or update options visit:<br>
<a href="http://lists.digium.com/mailman/listinfo/asterisk-dev" target="_blank">http://lists.digium.com/mailman/listinfo/asterisk-dev</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Eliel Sardaņons<br>