aboutsummaryrefslogtreecommitdiffstats
path: root/pack.c
diff options
context:
space:
mode:
authorTomasz Kramkowski <tk@the-tk.com>2021-11-07 22:32:46 +0000
committerTomasz Kramkowski <tk@the-tk.com>2021-11-07 22:32:46 +0000
commit3c380db8e51a9f4f22da47325b7f01759f1ad880 (patch)
tree3cc8ef675174f982dedd79bbecea80ac7544299d /pack.c
parentf38ce04c0ab9b0b4b93ad6d79ce1d9410201611d (diff)
downloadpack-3c380db8e51a9f4f22da47325b7f01759f1ad880.tar.gz
pack-3c380db8e51a9f4f22da47325b7f01759f1ad880.tar.xz
pack-3c380db8e51a9f4f22da47325b7f01759f1ad880.zip
change buf to src or dest depending on context
Diffstat (limited to 'pack.c')
-rw-r--r--pack.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/pack.c b/pack.c
index e18455c..1d225cb 100644
--- a/pack.c
+++ b/pack.c
@@ -12,21 +12,21 @@
#include "pack.h"
#include "trace.h"
-static void write_val(unsigned char *buf, size_t size, enum pack_endian e, uintmax_t val)
+static void write_val(unsigned char *dest, size_t size, enum pack_endian e, uintmax_t val)
{
for (size_t i = 0; i < size; i++)
- buf[i] = (val >> (e == PACK_ENDIAN_LITTLE ? i : size - i - 1) * 8) & 0xff;
+ dest[i] = (val >> (e == PACK_ENDIAN_LITTLE ? i : size - i - 1) * 8) & 0xff;
}
-enum pack_status pack(void *buf_, size_t size, const char *fmt, ...)
+enum pack_status pack(void *dest_, size_t size, const char *fmt, ...)
{
enum pack_endian endianness = PACK_ENDIAN_BIG;
- unsigned char *buf = buf_;
+ unsigned char *dest = dest_;
enum pack_status ret = PACK_OK;
size_t offset = 0;
va_list ap;
- tr_call("pack(%p, %" PRIuSIZE ", %s, ...)", (void *)buf, size, fmt);
+ tr_call("pack(%p, %" PRIuSIZE ", %s, ...)", (void *)dest, size, fmt);
va_start(ap, fmt);
@@ -62,7 +62,7 @@ enum pack_status pack(void *buf_, size_t size, const char *fmt, ...)
v.unsigned_ = n;
}
tr_debug("val.u: %" PRIuMAX, v.unsigned_);
- write_val(&buf[offset], s, endianness, v.unsigned_);
+ write_val(&dest[offset], s, endianness, v.unsigned_);
offset += s;
}