diff options
author | Loek Le Blansch <loek@pipeframe.xyz> | 2024-06-05 16:48:59 +0200 |
---|---|---|
committer | Loek Le Blansch <loek@pipeframe.xyz> | 2024-06-05 16:48:59 +0200 |
commit | 68471e5800b81285453a26547721d264dbcf49b9 (patch) | |
tree | b583df193179f5d5a2cee34d5d5dab61210148f6 /lib/mpack/read-remaining.c | |
parent | d9093e3245f9619850cea391adcad1a12164d38e (diff) |
add `mpack_read_remaining_bytes` function to mpack
Diffstat (limited to 'lib/mpack/read-remaining.c')
-rw-r--r-- | lib/mpack/read-remaining.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/mpack/read-remaining.c b/lib/mpack/read-remaining.c new file mode 100644 index 0000000..ebc9b56 --- /dev/null +++ b/lib/mpack/read-remaining.c @@ -0,0 +1,10 @@ +#include "mpack.h" + +size_t mpack_read_remaining_bytes(mpack_reader_t * reader, char * p, size_t count) { + size_t limit =mpack_reader_remaining(reader, NULL); + if (0 < count && count < limit) + limit = count; + memcpy(p, reader->data, limit); + return limit; +} + |