[xml] xmlNodeGetContent behavior



I found that when I call xmlNodeGetContent with an element node that has
no content, the return value is non-null. From the header comments I
expected a return value of NULL. Looking at the code (line 3608 of
tree):
            ret = buffer->content;
            buffer->content = NULL;
            xmlBufferFree(buffer);
            return(ret);
the code is returning the buffer content which is allocated memory with
the first byte set to 0.
What is the correct behavior? Maybe the buffer should be created with
xmlBufferCreateSize(0) or the buffer content should be checked for 0
before returning.

Charlie B.



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