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

Re: [xml] Some things about xmlCharEncodingHandler



oliverst online de said:
<snip>
> I also recognised, that in the function xmlFindCharEncodingHandler()
> in
> encoding.c the parameter "const char *name" is changed in the
> function.
> The pointer will be set to the returning pointer of
> xmlGetEncodingAlias(). IMO it should not be altered, because you
> might
> want to use that var in the calling function with the (maybe wrong)
> name. And I guess it causes a little memory leak. After the
> xmlGetEncodingAlias call the var "nalias" should be used and
> "nalias"
> set to name if the result was NULL.
>
> So long
> Oliver

I think there may be a little confusion here (although I frequently
get confused in this area of C programming :).  I think that "const
char *name" means that the string pointed to by the variable 'name'
is constant; the variable itself is a stack variable "owned" by the
function, and changing it has no effect on the calling function.

Bill



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