axis-c-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Damitha Kumarage <damith...@gmail.com>
Subject [Axis2] Duplicating array list
Date Thu, 23 Nov 2006 08:32:26 GMT
Hi,
In a situation like this

 outflow = AXIS2_OP_GET_OUT_FLOW(app_msg_op_desc, env);
 AXIS2_OP_SET_OUT_FLOW(create_seq_op, env, outflow);

Simply getting and setting the arraylist like this would leave to seg faults
when both operations try to free the flow. Therefore I would like to have
a new function in utilities

axis2_status_t AXIS2_CALL
axis2_utils_array_copy(
    const axis2_env_t *env,
    const axis2_array_list_t *array_to_copy)
{
     int size = 0, i = 0;
     axis2_array_list_t *new_array = NULL;
     if(array_to_copy)
         size = AXIS2_ARRAY_LIST_SIZE(array_to_copy, env);
     if(size > 0)
     {
          new_array = axis2_array_list_create(env, 0);
          if(!new_array)
          {
               AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, 
AXIS2_FAILURE);
               return AXIS2_FAILURE;
           }
     }
     for(i = 0; i < size; i++)
    {
         void *item = AXIS2_ARRAY_LIST_GET(array_to_copy, env);
         AXIS2_ARRAY_LIST_ADD(new_array, env, item);
    }
    return new_array;
}


Or may be we can have this function in array_list it self

Damitha

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-c-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-c-dev-help@ws.apache.org


Mime
View raw message