mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-10-24 13:33:01 +03:00
Expose xmlBufShrink in the public tree API
As suggested by Andrew W. Nosenko: Proposal: expose the new xmlBufShrink() to the "public" API for compatibility with xmlBufUse(). Reason: the following scenario: 1. Read something into xmlParserInputBuffer (e.g. using xmlParserInputBufferRead()) 2. Extract content through xmlBufContent() 3. Extract content length through xmlBufUse(). Result have type 'size_t'. 4. Use this content 5. Now, you need to shrink the buffer. How to do it? Doing that through legacy xmlBufferShrink() is unsafe because it uses 'unsigned int' and the whole point of introducing the new API was handling the cases, when 'unsigned int' is not enough. Therefore, need to use the new xmlBufShrink(). But it is "private". Therefore, I propose to expose the new xmlBufShrink() in the same way, as xmlBufContent() and xmlBufUse() are exposed.
This commit is contained in:
13
testapi.c
13
testapi.c
@@ -18530,6 +18530,16 @@ test_xmlBufNodeDump(void) {
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
test_xmlBufShrink(void) {
|
||||
int test_ret = 0;
|
||||
|
||||
|
||||
/* missing type support */
|
||||
return(test_ret);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
test_xmlBufUse(void) {
|
||||
int test_ret = 0;
|
||||
@@ -24170,7 +24180,7 @@ static int
|
||||
test_tree(void) {
|
||||
int test_ret = 0;
|
||||
|
||||
if (quiet == 0) printf("Testing tree : 142 of 163 functions ...\n");
|
||||
if (quiet == 0) printf("Testing tree : 142 of 164 functions ...\n");
|
||||
test_ret += test_xmlAddChild();
|
||||
test_ret += test_xmlAddChildList();
|
||||
test_ret += test_xmlAddNextSibling();
|
||||
@@ -24181,6 +24191,7 @@ test_tree(void) {
|
||||
test_ret += test_xmlBufEnd();
|
||||
test_ret += test_xmlBufGetNodeContent();
|
||||
test_ret += test_xmlBufNodeDump();
|
||||
test_ret += test_xmlBufShrink();
|
||||
test_ret += test_xmlBufUse();
|
||||
test_ret += test_xmlBufferAdd();
|
||||
test_ret += test_xmlBufferAddHead();
|
||||
|
||||
Reference in New Issue
Block a user