[Expat-discuss] expat parsing destructively?
Mukesh Kumar
Mukesh.S at mphasis.com
Mon Oct 29 11:27:20 CET 2007
Hi Mark,
it only extends one more heap memory... :) basically it is used as temporary buffer & later on he is calling free, bascially the similar logics works for me too... it is just a small trick......... :)
Regards,
-Mukesh Kumar
Sr.Sofrware Engineer,
India,
Bangalore.
________________________________
From: expat-discuss-bounces+mukesh.s=mphasis.com at libexpat.org on behalf of Mark
Sent: Mon 10/29/2007 3:52 PM
To: expat-discuss at libexpat.org
Subject: Re: [Expat-discuss] expat parsing destructively?
I think this is extremely unlikely this will work. You are assuming that expat will always return a pointer to the data contained within the original memory buffer and not in any internal buffers.
---- Original Message ----
Simply allocate 2 copies of the same data... i.e. read in the data to
one buffer, malloc() another buffer the same size, and do a huge
memcpy() to make a duplicate copy. Now let eXpat scan one copy, and
doing some quick and dirty pointer math, you can now find
corresponding locations in the "non-eXpat" buffer and destroy it to
your hearts content. When you're all done, simply free both buffers.
Its a little more memory intensive.. but sounds fairly elegant to me,
and you don't need to worry about doing anything unsupported by eXpat.
--------------------------------------
Protect yourself from spam,
use http://sneakemail.com <http://sneakemail.com/>
_______________________________________________
Expat-discuss mailing list
Expat-discuss at libexpat.org
http://mail.libexpat.org/mailman/listinfo/expat-discuss
More information about the Expat-discuss
mailing list