comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Expert information needed
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Expert information needed [message #33880] Wed, 05 February 2003 02:09
Nigel Wade is currently offline  Nigel Wade
Messages: 286
Registered: March 1998
Senior Member
Ed Wright wrote:

>
> Can someone explain the operation differences between:
>
>
> IDL_VarCopy(IDL_StrToSTRING(shape_buf), Argv[2]);

This creates a new IDL_VAR and puts it into Argv[2].

>
> and
>
> IDL_StrStore( &Argv[2]->value.str, shape_buf );

This copies the string into Argv[2], which must be writable. It doesn't free
any memory currently in used by Argv[2], it assumes it contains garbage. As
a precursor to IDL_StrStore I would call
IDL_StoreScalarZero( Argv[2], IDL_TYP_STRING );
to free any resources which Argv[2] might be using and to set its type to
IDL_TYP_STRING (unless I'd created the variable myself in the routine and
new it didn't have any resources allocated).

>
> I discovered use of the second causes a malloc error under certain
> circumstances, while the first does not.

What were the contents of Argv[2] on entry?

>
> As always,
> ED Wright

--
Nigel Wade, System Administrator, Space Plasma Physics Group,
University of Leicester, Leicester, LE1 7RH, UK
E-mail : nmw@ion.le.ac.uk
Phone : +44 (0)116 2523548, Fax : +44 (0)116 2523555
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: OPENW and environment variables in IDL 5.5
Next Topic: Re: TV, AXIS, T3D, Coordinate Systems

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 16:52:03 PDT 2025

Total time taken to generate the page: 0.00437 seconds