axis-c-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Hawkins <HAWKI...@uk.ibm.com>
Subject Attribute setx()
Date Tue, 03 Aug 2004 16:10:51 GMT




Hi Folks,

the set methods on Attribute all simply use the pointer given to them -
they do not copy the data e.g.


void Attribute::setLocalName(const AxisChar* localname)
{
    m_localname= localname;
}

void Attribute::setPrefix(const AxisChar* prefix)
{
    m_prefix= prefix;
}

void Attribute::setUri(const AxisChar* uri)
{
    m_uri= uri;
}

void Attribute::setValue(const AxisChar* value)
{
    m_value= value;
}

The set methods on BasicNodes do copy the data. e.g.

int CharacterElement::setValue(const AxisChar* pachValue)
{
    m_pachValue = (AxisChar*) malloc(strlen(pachValue)+1);
    strcpy(m_pachValue, pachValue);

    return AXIS_SUCCESS;
}

Is there any reason why they are different?

I would assume that we would like the Basicnode style of copying the data
then the user can be happy in the knowledge that the memory clean up is
given to them "for free"?




John Hawkins


Mime
View raw message