Re: [xml] Some things about xmlCharEncodingHandler



Oliver Stöneberg wrote:
The calling function will never see that change to name. Note that the pointer declared as 'const char* name' is local for the function, regardless wether it is declared in the parameter list or in the function body. The memory pointed to by this pointer wasn't modified.

"const" D'OH! I tend to overlook these a lot in the last time.

As for the leak, where is it? I am failing to see it.

There is none. I thought of a leak if you can change the poiner and the old content stays in memory, unfree'd, if alloc'd. But because it's a const pointer. Nevermind.

It has nothing to do with const. Were it a 'char* name' it would still be the same. A parameter in a function is just another local variable. It contains a copy of the data the caller passed to the function.

By the way, which header in my posts ends up called suspicious by the mailing list software? It can't be the subject, since Oliver's posts pass undisturbed. :-)

Ciao,
Igor





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