[asterisk-dev] [Code Review] Restore ao2 API compatibility and add new ao2_callback_data function

Sean Bright sean.bright at gmail.com
Sun Nov 23 09:49:09 CST 2008


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://reviewboard.digium.com/r/64/
-----------------------------------------------------------

(Updated 2008-11-23 09:49:09.415423)


Review request for Asterisk Developers.


Changes
-------

I updated the patch to move the cast from the void * to the correct function pointer outside of the loop.  I was concerned there would be a per-iteration penalty for casting each time.  I also introduced cb_true_data to mimic cb_true in the cases that ao2_callback_data is called with a NULL cb_fn.


Summary
-------

This patch, for all intents and purposes, simply reverts the majority of the ao2 changes that added the 'void *data' argument to the ao2_callback_fn, ao2_callback, and ao2_find calls.  It adds a new function, ao2_callback_data which takes the extra void *, and chan_sip is updated to use it (as this was the only place that was actually using the new argument).

Not included in this patch is documentation of the new function ao2_callback_data.  This will be added before commit.  Secondly, Russell suggested adding an ao2_find_data, but this is problematic since this calls the cmp callback on the container being passed.  I opted not to include it in this patch.

The real meat-and-potatoes to keep an eye on are the changes to main/astobj2.c.  The changes (casting a void * to the appropriate callback type) feels dirty, but it is necessary to avoid a good chunk of code duplication.

(As a total aside, for those of you having problems using post-review, I used `post-review --branch=/trunk --username=seanbright --password=mypassword` in my WC and it worked perfectly)


Diffs (updated)
-----

  /trunk/apps/app_queue.c 158786 
  /trunk/channels/chan_console.c 158786 
  /trunk/channels/chan_iax2.c 158786 
  /trunk/channels/chan_sip.c 158786 
  /trunk/funcs/func_dialgroup.c 158786 
  /trunk/include/asterisk/astobj2.h 158786 
  /trunk/main/astobj2.c 158786 
  /trunk/main/config.c 158786 
  /trunk/main/features.c 158786 
  /trunk/main/manager.c 158786 
  /trunk/main/taskprocessor.c 158786 
  /trunk/res/res_clialiases.c 158786 
  /trunk/res/res_phoneprov.c 158786 
  /trunk/res/res_timing_pthread.c 158786 
  /trunk/res/res_timing_timerfd.c 158786 
  /trunk/utils/hashtest2.c 158786 

Diff: http://reviewboard.digium.com/r/64/diff


Testing
-------

Compilation and developer tests.


Thanks,

Sean




More information about the asterisk-dev mailing list