Gitweb links:
...log
http://git.netsurf-browser.org/libparserutils.git/shortlog/010c5f5b3c3db4c07c19e706c9a70c886b614497
...commit
http://git.netsurf-browser.org/libparserutils.git/commit/010c5f5b3c3db4c07c19e706c9a70c886b614497
...tree
http://git.netsurf-browser.org/libparserutils.git/tree/010c5f5b3c3db4c07c19e706c9a70c886b614497
The branch, master has been updated
via 010c5f5b3c3db4c07c19e706c9a70c886b614497 (commit)
via 429245749eeb99196d82d140af6522f962fc4601 (commit)
from 02ea538ed08a1b3dd5acc016762e951ff006299f (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff
http://git.netsurf-browser.org/libparserutils.git/commit/?id=010c5f5b3c3db4c07c19e706c9a70c886b614497
commit 010c5f5b3c3db4c07c19e706c9a70c886b614497
Author: Daniel Silverstone <[email protected]>
Commit: Daniel Silverstone <[email protected]>
(buffer): Add parserutils_buffer_appendv()
Signed-off-by: Daniel Silverstone <[email protected]>
diff --git a/include/parserutils/utils/buffer.h
b/include/parserutils/utils/buffer.h
index 5f8f696..5b8b793 100644
--- a/include/parserutils/utils/buffer.h
+++ b/include/parserutils/utils/buffer.h
@@ -30,6 +30,8 @@ parserutils_error
parserutils_buffer_destroy(parserutils_buffer *buffer);
parserutils_error parserutils_buffer_append(parserutils_buffer *buffer,
const uint8_t *data, size_t len);
+parserutils_error parserutils_buffer_appendv(parserutils_buffer *buffer,
+ size_t count, ...);
parserutils_error parserutils_buffer_insert(parserutils_buffer *buffer,
size_t offset, const uint8_t *data, size_t len);
parserutils_error parserutils_buffer_discard(parserutils_buffer *buffer,
diff --git a/src/utils/buffer.c b/src/utils/buffer.c
index 5e0f58c..b568948 100644
--- a/src/utils/buffer.c
+++ b/src/utils/buffer.c
@@ -6,6 +6,7 @@
*/
#include <string.h>
+#include <stdarg.h>
#include <parserutils/utils/buffer.h>
@@ -131,6 +132,38 @@ parserutils_error
parserutils_buffer_append(parserutils_buffer *buffer,
}
/**
+ * Append multiple data blocks to a memory buffer.
+ *
+ * Each data block must be passed as a pair of const uint8_t* and size_t
+ *
+ * \param buffer The buffer to append to
+ * \param count The number of data blocks to append
+ * \param ... The pairs of pointer and size
+ * \return PARSERUTILS_OK on success, appropriate error otherwise.
+*/
+parserutils_error parserutils_buffer_appendv(parserutils_buffer *buffer,
+ size_t count, ...)
+{
+ va_list ap;
+ parserutils_error error;
+ const uint8_t *data;
+ size_t len;
+
+ va_start(ap, count);
+ while (count > 0) {
+ data = va_arg(ap, const uint8_t *);
+ len = va_arg(ap, size_t);
+ error = parserutils_buffer_append(buffer, data, len);
+ if (error != PARSERUTILS_OK)
+ break;
+ count--;
+ }
+ va_end(ap);
+
+ return error;
+}
+
+/**
* Insert data into a memory buffer
*
* \param buffer The buffer to insert into
commitdiff
http://git.netsurf-browser.org/libparserutils.git/commit/?id=429245749eeb99196d82d140af6522f962fc4601
commit 429245749eeb99196d82d140af6522f962fc4601
Author: Daniel Silverstone <[email protected]>
Commit: Daniel Silverstone <[email protected]>
(gitignore): Ignore aliases.inc
Signed-off-by: Daniel Silverstone <[email protected]>
diff --git a/.gitignore b/.gitignore
index d5c7a48..479e8d6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
build-*
Makefile.config.override
+src/charset/aliases.inc
-----------------------------------------------------------------------
Summary of changes:
.gitignore | 1 +
include/parserutils/utils/buffer.h | 2 ++
src/utils/buffer.c | 33 +++++++++++++++++++++++++++++++++
3 files changed, 36 insertions(+)
diff --git a/.gitignore b/.gitignore
index d5c7a48..479e8d6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
build-*
Makefile.config.override
+src/charset/aliases.inc
diff --git a/include/parserutils/utils/buffer.h
b/include/parserutils/utils/buffer.h
index 5f8f696..5b8b793 100644
--- a/include/parserutils/utils/buffer.h
+++ b/include/parserutils/utils/buffer.h
@@ -30,6 +30,8 @@ parserutils_error
parserutils_buffer_destroy(parserutils_buffer *buffer);
parserutils_error parserutils_buffer_append(parserutils_buffer *buffer,
const uint8_t *data, size_t len);
+parserutils_error parserutils_buffer_appendv(parserutils_buffer *buffer,
+ size_t count, ...);
parserutils_error parserutils_buffer_insert(parserutils_buffer *buffer,
size_t offset, const uint8_t *data, size_t len);
parserutils_error parserutils_buffer_discard(parserutils_buffer *buffer,
diff --git a/src/utils/buffer.c b/src/utils/buffer.c
index 5e0f58c..b568948 100644
--- a/src/utils/buffer.c
+++ b/src/utils/buffer.c
@@ -6,6 +6,7 @@
*/
#include <string.h>
+#include <stdarg.h>
#include <parserutils/utils/buffer.h>
@@ -131,6 +132,38 @@ parserutils_error
parserutils_buffer_append(parserutils_buffer *buffer,
}
/**
+ * Append multiple data blocks to a memory buffer.
+ *
+ * Each data block must be passed as a pair of const uint8_t* and size_t
+ *
+ * \param buffer The buffer to append to
+ * \param count The number of data blocks to append
+ * \param ... The pairs of pointer and size
+ * \return PARSERUTILS_OK on success, appropriate error otherwise.
+*/
+parserutils_error parserutils_buffer_appendv(parserutils_buffer *buffer,
+ size_t count, ...)
+{
+ va_list ap;
+ parserutils_error error;
+ const uint8_t *data;
+ size_t len;
+
+ va_start(ap, count);
+ while (count > 0) {
+ data = va_arg(ap, const uint8_t *);
+ len = va_arg(ap, size_t);
+ error = parserutils_buffer_append(buffer, data, len);
+ if (error != PARSERUTILS_OK)
+ break;
+ count--;
+ }
+ va_end(ap);
+
+ return error;
+}
+
+/**
* Insert data into a memory buffer
*
* \param buffer The buffer to insert into
--
Lexer/parser utility functions
_______________________________________________
netsurf-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]