You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@axis.apache.org by Damitha Kumarage <da...@gmail.com> on 2006/11/10 11:50:20 UTC
[Axis2] Removing macros and reducing OO code
Hi,
Like in all axis2 core and modules Sandesha2 also had lot of unneccesary
OO code and
macros. In order to get rid of this I did the following
1. Find functions which are passed a structure as the first parameter
but not necessary to do so(funcion
is not structure specific).
Removed that argument from the methods making the enviroment the
first argument.
2. Removed op structure from all files where the structure is not used
in a inheritance hierarchy.
I found that in lot files this happened. Removing these op
structures mean getting rid of lot
of function macros which in turn made the code lot simple and lot
readable.
3. Where OO is neccessary(I found in only very few places) I replaced
the macro with the following
code
in header file
axis2_char_t* AXIS2_CALL
sandesha2_iom_rm_element_get_namespace_value(
sandesha2_iom_rm_element_t *element,
const axis2_env_t *env);
In implementation file
axis2_char_t* AXIS2_CALL
sandesha2_iom_rm_element_get_namespace_value(
sandesha2_iom_rm_element_t *element,
const axis2_env_t *env)
{
return
((sandesha2_iom_rm_element_t*)(element))->ops->get_namespace_value(
(sandesha2_iom_rm_element_t*)element, env);
}
All this took about 2 days to complete. But when I look at the cleaner
code I think it is worth
the effort. From this I guess that if we spend about two weeks we can
make similar changes
to whole of axis2c code which will lead to a more cleaner 1.0 release.
Damitha
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-c-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-c-dev-help@ws.apache.org
Re: [Axis2] Removing macros and reducing OO code
Posted by Nandika Jayawardana <ja...@gmail.com>.
Hi all,
As damitha has done to sandesha, If we can get rid of unneccesary OO code in
axis2c core, the code would get much cleaner and small. In addition to that
we can remove some amount of memory leaks in the process because
the memory allocations done for ops structures will be reduced.
+1 for removing unnecessary OO code.
Thanks
Nandika
On 11/10/06, Damitha Kumarage <da...@gmail.com> wrote:
>
> Hi,
> Like in all axis2 core and modules Sandesha2 also had lot of unneccesary
> OO code and
> macros. In order to get rid of this I did the following
>
> 1. Find functions which are passed a structure as the first parameter
> but not necessary to do so(funcion
> is not structure specific).
> Removed that argument from the methods making the enviroment the
> first argument.
>
> 2. Removed op structure from all files where the structure is not used
> in a inheritance hierarchy.
> I found that in lot files this happened. Removing these op
> structures mean getting rid of lot
> of function macros which in turn made the code lot simple and lot
> readable.
>
> 3. Where OO is neccessary(I found in only very few places) I replaced
> the macro with the following
> code
> in header file
>
> axis2_char_t* AXIS2_CALL
> sandesha2_iom_rm_element_get_namespace_value(
> sandesha2_iom_rm_element_t *element,
> const axis2_env_t *env);
>
> In implementation file
>
>
> axis2_char_t* AXIS2_CALL
> sandesha2_iom_rm_element_get_namespace_value(
> sandesha2_iom_rm_element_t *element,
> const axis2_env_t *env)
> {
> return
> ((sandesha2_iom_rm_element_t*)(element))->ops->get_namespace_value(
> (sandesha2_iom_rm_element_t*)element, env);
> }
>
> All this took about 2 days to complete. But when I look at the cleaner
> code I think it is worth
> the effort. From this I guess that if we spend about two weeks we can
> make similar changes
> to whole of axis2c code which will lead to a more cleaner 1.0 release.
>
> Damitha
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-c-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-c-dev-help@ws.apache.org
>
>
Re: [Axis2] Removing macros and reducing OO code
Posted by Chris Darroch <ch...@pearsoncmg.com>.
Damitha Kumarage wrote:
> Like in all axis2 core and modules Sandesha2 also had lot of unneccesary
> OO code and
> macros. In order to get rid of this I did the following
>
> 1. Find functions which are passed a structure as the first parameter
> but not necessary to do so(funcion
> is not structure specific).
> Removed that argument from the methods making the enviroment the
> first argument.
>
> 2. Removed op structure from all files where the structure is not used
> in a inheritance hierarchy.
> I found that in lot files this happened. Removing these op
> structures mean getting rid of lot
> of function macros which in turn made the code lot simple and lot
> readable.
>
> 3. Where OO is neccessary(I found in only very few places) I replaced
> the macro with the following
> code
> in header file
>
> axis2_char_t* AXIS2_CALL
> sandesha2_iom_rm_element_get_namespace_value(
> sandesha2_iom_rm_element_t *element,
> const axis2_env_t *env);
>
> In implementation file
>
>
> axis2_char_t* AXIS2_CALL
> sandesha2_iom_rm_element_get_namespace_value(
> sandesha2_iom_rm_element_t *element,
> const axis2_env_t *env)
> {
> return
> ((sandesha2_iom_rm_element_t*)(element))->ops->get_namespace_value(
> (sandesha2_iom_rm_element_t*)element, env);
> }
>
> All this took about 2 days to complete. But when I look at the cleaner
> code I think it is worth
> the effort. From this I guess that if we spend about two weeks we can
> make similar changes
> to whole of axis2c code which will lead to a more cleaner 1.0 release.
I don't know if this was related to my comments in
http://marc.theaimsgroup.com/?l=axis-c-dev&m=116259914508051&w=2
but it sounds like it might be a big step in that direction. Looking at
some random diffs in svn I'd have to say that looks a lot cleaner to me:
http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/include/sandesha2_create_seq.h?r1=437066&r2=472834&diff_format=h
http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/util/seq_mgr.c?r1=472834&r2=473292&diff_format=h
Nice job! (Now, if only I used Sandesha2 ... but I may someday! :-)
Chris.
--
GPG Key ID: 366A375B
GPG Key Fingerprint: 485E 5041 17E1 E2BB C263 E4DE C8E3 FA36 366A 375B
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-c-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-c-dev-help@ws.apache.org