[libxml2/ddkilzer/use-UPDATE_COMPAT-consistently-in-buf.c: 2/2] Use UPDATE_COMPAT() consistently in buf.c
- From: Nick Wellnhofer <nwellnhof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libxml2/ddkilzer/use-UPDATE_COMPAT-consistently-in-buf.c: 2/2] Use UPDATE_COMPAT() consistently in buf.c
- Date: Sun, 10 Apr 2022 12:55:53 +0000 (UTC)
commit a15f2abef1463c20bc62a455e983e34b2278f279
Author: David Kilzer <ddkilzer webkit org>
Date: Fri Apr 8 12:16:51 2022 -0700
Use UPDATE_COMPAT() consistently in buf.c
* buf.c:
(xmlBufCreate):
(xmlBufCreateSize):
(xmlBufDetach):
(xmlBufCreateStatic):
(xmlBufFromBuffer):
buf.c | 20 +++++---------------
1 file changed, 5 insertions(+), 15 deletions(-)
---
diff --git a/buf.c b/buf.c
index f4356540..9d95e801 100644
--- a/buf.c
+++ b/buf.c
@@ -123,12 +123,11 @@ xmlBufCreate(void) {
xmlBufMemoryError(NULL, "creating buffer");
return(NULL);
}
- ret->compat_use = 0;
ret->use = 0;
ret->error = 0;
ret->buffer = NULL;
ret->size = xmlDefaultBufferSize;
- ret->compat_size = xmlDefaultBufferSize;
+ UPDATE_COMPAT(ret);
ret->alloc = xmlBufferAllocScheme;
ret->content = (xmlChar *) xmlMallocAtomic(ret->size * sizeof(xmlChar));
if (ret->content == NULL) {
@@ -157,13 +156,12 @@ xmlBufCreateSize(size_t size) {
xmlBufMemoryError(NULL, "creating buffer");
return(NULL);
}
- ret->compat_use = 0;
ret->use = 0;
ret->error = 0;
ret->buffer = NULL;
ret->alloc = xmlBufferAllocScheme;
ret->size = (size ? size+2 : 0); /* +1 for ending null */
- ret->compat_size = (int) ret->size;
+ UPDATE_COMPAT(ret);
if (ret->size){
ret->content = (xmlChar *) xmlMallocAtomic(ret->size * sizeof(xmlChar));
if (ret->content == NULL) {
@@ -205,8 +203,7 @@ xmlBufDetach(xmlBufPtr buf) {
buf->content = NULL;
buf->size = 0;
buf->use = 0;
- buf->compat_use = 0;
- buf->compat_size = 0;
+ UPDATE_COMPAT(buf);
return ret;
}
@@ -235,15 +232,9 @@ xmlBufCreateStatic(void *mem, size_t size) {
xmlBufMemoryError(NULL, "creating buffer");
return(NULL);
}
- if (size < INT_MAX) {
- ret->compat_use = size;
- ret->compat_size = size;
- } else {
- ret->compat_use = INT_MAX;
- ret->compat_size = INT_MAX;
- }
ret->use = size;
ret->size = size;
+ UPDATE_COMPAT(ret);
ret->alloc = XML_BUFFER_ALLOC_IMMUTABLE;
ret->content = (xmlChar *) mem;
ret->error = 0;
@@ -1173,8 +1164,7 @@ xmlBufFromBuffer(xmlBufferPtr buffer) {
}
ret->use = buffer->use;
ret->size = buffer->size;
- ret->compat_use = buffer->use;
- ret->compat_size = buffer->size;
+ UPDATE_COMPAT(ret);
ret->error = 0;
ret->buffer = buffer;
ret->alloc = buffer->alloc;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]