[Asterisk-Dev] LOCAL_USER cleanup update

Luigi Rizzo rizzo at icir.org
Thu Jan 12 00:39:00 MST 2006


[more architectural comments below]

On Wed, Jan 11, 2006 at 05:21:50AM -0800, Luigi Rizzo wrote:
> As mentioned a few times e.g. in
> 
>         http://bugs.digium.com/view.php?id=6146
> 
> i am in the process of moving the LOCAL_USER calls within the loader,
> thus removing all the instances of identical code that at the moment
> are repeated in each module. This is in the interest of code size,
> clarity and correctness. It is also a useful complement to the
> work i am doing on the improved loader as documented in
> 
>         http://bugs.digium.com/view.php?id=4377
> 
> Fixing LOCAL_USER* requires the following steps:
> 
>  1   fix abuses of the 'struct localuser' structure. These are
>      in app_dial, app_externalivr, app_queue, see description
>      below;
> 
>  2   #define STANDARD_LOCALUSER to empty, and fix accordingly
>      the code in asterisk/module.h
> 
>  3   move the functionality of the LOCAL_USER_* macros into 
>      the loader, together with the changes in

ouch... just realised that to achieve this, the load_module() function
requires an argument (a pointer to the module descriptor), that in
turn needs to be passed to the various ast_register_*() calls,
so that the dispatcher knows where the refcounts etc are.
In C++ we would just use "this", but in C we don't have it :(
Anyways, there is a relatively easy workaround because we can
use the function address as a search key in the module's list.
Unfortunately, this is a bit more intrusive than i expected...

note to self: always include a pointer to the object when simulating
OO programming...

	cheers
	luigi



More information about the asterisk-dev mailing list