[asterisk-dev] [Code Review] Eliminate memmove from pbx_spool implementation

Kevin Fleming kpfleming at digium.com
Tue Sep 7 17:30:00 CDT 2010


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/912/#review2693
-----------------------------------------------------------



/branches/1.8/pbx/pbx_spool.c
<https://reviewboard.asterisk.org/r/912/#comment5846>

    You *might* be able to use aligned(alignof(struct inotify_event)) here, but I'm not quite sure which versions of GCC support the 'alignof' keyword. It was created for this very reason, though :-)



/branches/1.8/pbx/pbx_spool.c
<https://reviewboard.asterisk.org/r/912/#comment5847>

    Might as well use 'size_t' here, if it doesn't result in compiler warnings when included in the operations involving 'res'.



/branches/1.8/pbx/pbx_spool.c
<https://reviewboard.asterisk.org/r/912/#comment5848>

    This won't do what you expect; it will advance the 'iev' pointer by the size of 'len' inotify_events (len * sizeof(*iev)). To be able to advance it by a specific number of bytes, you'll have to either cast it to a 'char *' before adding to it, or put it in a union with a 'char *' that overlays it and add the offset to the 'char *' instead. The former method is used fairly often in Asterisk code, so it should be fine.


- Kevin


On 2010-09-07 17:21:52, Tilghman Lesher wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/912/
> -----------------------------------------------------------
> 
> (Updated 2010-09-07 17:21:52)
> 
> 
> Review request for Asterisk Developers and Kevin Fleming.
> 
> 
> Summary
> -------
> 
> As requested by kpfleming
> 
> 
> Diffs
> -----
> 
>   /branches/1.8/pbx/pbx_spool.c 285386 
> 
> Diff: https://reviewboard.asterisk.org/r/912/diff
> 
> 
> Testing
> -------
> 
> Compile testing only
> 
> 
> Thanks,
> 
> Tilghman
> 
>




More information about the asterisk-dev mailing list