Re: problem with an array of strings



Hi Peter,

On Thu, 2003-10-16 at 16:53, Peter Van Osta wrote:
> mypointer->name = CORBA_string_alloc( 64 );
> mypointer->name = CORBA_string_dup( "-" );

	That leaks - the 'dup' allocates memory for it's return value; the
function doesn't have access to the value that it's return value is
assigned to - so the above could never work.

> mypointer->pos ?????????????
> for( i = 0; i < 5; i++ ){
> 	mypointer->pos[i] = CORBA_string_alloc( 64 );
> 	mypointer->pos[i] = CORBA_string_dup( "-" );
> }
> 
> It looks that I will need to allocate "mypointer->pos" first, where to 
> find the routine to allocate the memory space ?

	So; when you added the string typedef it should have generated an
_alloc method in the header. Poke in the IDL compiler generated header,
I forget it's name - search for the typename.

	Regards,

		Michael.

-- 
 michael@ximian.com  <><, Pseudo Engineer, itinerant idiot




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]